var JHe=Object.defineProperty;var P2e=e=>{throw TypeError(e)};var eWe=(e,t,n)=>t in e?JHe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Wn=(e,t,n)=>eWe(e,typeof t!="symbol"?t+"":t,n),qoe=(e,t,n)=>t.has(e)||P2e("Cannot "+n);var Qt=(e,t,n)=>(qoe(e,t,"read from private field"),n?n.call(e):t.get(e)),li=(e,t,n)=>t.has(e)?P2e("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),us=(e,t,n,s)=>(qoe(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),ia=(e,t,n)=>(qoe(e,t,"access private method"),n);var R6=(e,t,n,s)=>({set _(i){us(e,t,i,n)},get _(){return Qt(e,t,s)}});function tWe(e,t){for(var n=0;ns[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Ax=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function za(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function z5e(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}),n}var B5e={exports:{}},hne={},$5e={exports:{}},Ma={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var tI=Symbol.for("react.element"),rWe=Symbol.for("react.portal"),nWe=Symbol.for("react.fragment"),sWe=Symbol.for("react.strict_mode"),iWe=Symbol.for("react.profiler"),aWe=Symbol.for("react.provider"),oWe=Symbol.for("react.context"),lWe=Symbol.for("react.forward_ref"),cWe=Symbol.for("react.suspense"),dWe=Symbol.for("react.memo"),uWe=Symbol.for("react.lazy"),L2e=Symbol.iterator;function hWe(e){return e===null||typeof e!="object"?null:(e=L2e&&e[L2e]||e["@@iterator"],typeof e=="function"?e:null)}var U5e={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},q5e=Object.assign,V5e={};function WC(e,t,n){this.props=e,this.context=t,this.refs=V5e,this.updater=n||U5e}WC.prototype.isReactComponent={};WC.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};WC.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function H5e(){}H5e.prototype=WC.prototype;function Hpe(e,t,n){this.props=e,this.context=t,this.refs=V5e,this.updater=n||U5e}var Wpe=Hpe.prototype=new H5e;Wpe.constructor=Hpe;q5e(Wpe,WC.prototype);Wpe.isPureReactComponent=!0;var O2e=Array.isArray,W5e=Object.prototype.hasOwnProperty,Gpe={current:null},G5e={key:!0,ref:!0,__self:!0,__source:!0};function K5e(e,t,n){var s,i={},o=null,l=null;if(t!=null)for(s in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(o=""+t.key),t)W5e.call(t,s)&&!G5e.hasOwnProperty(s)&&(i[s]=t[s]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,pe=de[ke];if(0>>1;kei(Me,Ee))Uei(Ie,Me)?(de[ke]=Ie,de[Ue]=Ee,ke=Ue):(de[ke]=Me,de[ge]=Ee,ke=ge);else if(Uei(Ie,Ee))de[ke]=Ie,de[Ue]=Ee,ke=Ue;else break e}}return _e}function i(de,_e){var Ee=de.sortIndex-_e.sortIndex;return Ee!==0?Ee:de.id-_e.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,a=l.now();e.unstable_now=function(){return l.now()-a}}var h=[],p=[],x=1,y=null,w=3,j=!1,S=!1,C=!1,A=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(de){for(var _e=n(p);_e!==null;){if(_e.callback===null)s(p);else if(_e.startTime<=de)s(p),_e.sortIndex=_e.expirationTime,t(h,_e);else break;_e=n(p)}}function z(de){if(C=!1,O(de),!S)if(n(h)!==null)S=!0,ie(F);else{var _e=n(p);_e!==null&&fe(z,_e.startTime-de)}}function F(de,_e){S=!1,C&&(C=!1,E(K),K=-1),j=!0;var Ee=w;try{for(O(_e),y=n(h);y!==null&&(!(y.expirationTime>_e)||de&&!ue());){var ke=y.callback;if(typeof ke=="function"){y.callback=null,w=y.priorityLevel;var pe=ke(y.expirationTime<=_e);_e=e.unstable_now(),typeof pe=="function"?y.callback=pe:y===n(h)&&s(h),O(_e)}else s(h);y=n(h)}if(y!==null)var ae=!0;else{var ge=n(p);ge!==null&&fe(z,ge.startTime-_e),ae=!1}return ae}finally{y=null,w=Ee,j=!1}}var q=!1,H=null,K=-1,Z=5,re=-1;function ue(){return!(e.unstable_now()-rede||125ke?(de.sortIndex=Ee,t(p,de),n(h)===null&&de===n(p)&&(C?(E(K),K=-1):C=!0,fe(z,Ee-ke))):(de.sortIndex=pe,t(h,de),S||j||(S=!0,ie(F))),de},e.unstable_shouldYield=ue,e.unstable_wrapCallback=function(de){var _e=w;return function(){var Ee=w;w=_e;try{return de.apply(this,arguments)}finally{w=Ee}}}})(J5e);Q5e.exports=J5e;var jWe=Q5e.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var kWe=P,rf=jWe;function Mn(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mde=Object.prototype.hasOwnProperty,NWe=/^[: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]*$/,R2e={},F2e={};function SWe(e){return mde.call(F2e,e)?!0:mde.call(R2e,e)?!1:NWe.test(e)?F2e[e]=!0:(R2e[e]=!0,!1)}function CWe(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function MWe(e,t,n,s){if(t===null||typeof t>"u"||CWe(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function zu(e,t,n,s,i,o,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=l}var Dd={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Dd[e]=new zu(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Dd[t]=new zu(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Dd[e]=new zu(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Dd[e]=new zu(e,2,!1,e,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(e){Dd[e]=new zu(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Dd[e]=new zu(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Dd[e]=new zu(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Dd[e]=new zu(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Dd[e]=new zu(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ype=/[\-:]([a-z])/g;function Xpe(e){return e[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(e){var t=e.replace(Ype,Xpe);Dd[t]=new zu(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ype,Xpe);Dd[t]=new zu(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ype,Xpe);Dd[t]=new zu(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Dd[e]=new zu(e,1,!1,e.toLowerCase(),null,!1,!1)});Dd.xlinkHref=new zu("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Dd[e]=new zu(e,1,!1,e.toLowerCase(),null,!0,!0)});function Qpe(e,t,n,s){var i=Dd.hasOwnProperty(t)?Dd[t]:null;(i!==null?i.type!==0:s||!(2a||i[l]!==o[a]){var h=` `+i[l].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=l&&0<=a);break}}}finally{Woe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?rT(e):""}function TWe(e){switch(e.tag){case 5:return rT(e.type);case 16:return rT("Lazy");case 13:return rT("Suspense");case 19:return rT("SuspenseList");case 0:case 2:case 15:return e=Goe(e.type,!1),e;case 11:return e=Goe(e.type.render,!1),e;case 1:return e=Goe(e.type,!0),e;default:return""}}function vde(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j4:return"Fragment";case w4:return"Portal";case gde:return"Profiler";case Jpe:return"StrictMode";case xde:return"Suspense";case yde:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case rMe:return(e.displayName||"Context")+".Consumer";case tMe:return(e._context.displayName||"Context")+".Provider";case eme:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case tme:return t=e.displayName||null,t!==null?t:vde(e.type)||"Memo";case d0:t=e._payload,e=e._init;try{return vde(e(t))}catch{}}return null}function AWe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vde(t);case 8:return t===Jpe?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function I1(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function sMe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function EWe(e){var t=sMe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(l){s=""+l,o.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(l){s=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function B6(e){e._valueTracker||(e._valueTracker=EWe(e))}function iMe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=sMe(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function xee(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function _de(e,t){var n=t.checked;return Dl({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function B2e(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=I1(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function aMe(e,t){t=t.checked,t!=null&&Qpe(e,"checked",t,!1)}function bde(e,t){aMe(e,t);var n=I1(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?wde(e,t.type,n):t.hasOwnProperty("defaultValue")&&wde(e,t.type,I1(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $2e(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function wde(e,t,n){(t!=="number"||xee(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var nT=Array.isArray;function U4(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=$6.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function SA(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var gT={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},IWe=["Webkit","ms","Moz","O"];Object.keys(gT).forEach(function(e){IWe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),gT[t]=gT[e]})});function dMe(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||gT.hasOwnProperty(e)&&gT[e]?(""+t).trim():t+"px"}function uMe(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=dMe(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,i):e[n]=i}}var PWe=Dl({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 Nde(e,t){if(t){if(PWe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Mn(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Mn(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Mn(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Mn(62))}}function Sde(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Cde=null;function rme(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mde=null,q4=null,V4=null;function V2e(e){if(e=sI(e)){if(typeof Mde!="function")throw Error(Mn(280));var t=e.stateNode;t&&(t=xne(t),Mde(e.stateNode,e.type,t))}}function hMe(e){q4?V4?V4.push(e):V4=[e]:q4=e}function fMe(){if(q4){var e=q4,t=V4;if(V4=q4=null,V2e(e),t)for(e=0;e>>=0,e===0?32:31-(VWe(e)/HWe|0)|0}var U6=64,q6=4194304;function sT(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function bee(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes,l=n&268435455;if(l!==0){var a=l&~i;a!==0?s=sT(a):(o&=l,o!==0&&(s=sT(o)))}else l=n&~i,l!==0?s=sT(l):o!==0&&(s=sT(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&i)&&(i=s&-s,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0n;n++)t.push(e);return t}function rI(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-lm(t),e[t]=n}function ZWe(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=yT),J2e=" ",ebe=!1;function PMe(e,t){switch(e){case"keyup":return jGe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function LMe(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var k4=!1;function NGe(e,t){switch(e){case"compositionend":return LMe(t);case"keypress":return t.which!==32?null:(ebe=!0,J2e);case"textInput":return e=t.data,e===J2e&&ebe?null:e;default:return null}}function SGe(e,t){if(k4)return e==="compositionend"||!dme&&PMe(e,t)?(e=EMe(),s8=ome=z0=null,k4=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=sbe(n)}}function FMe(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?FMe(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zMe(){for(var e=window,t=xee();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=xee(e.document)}return t}function ume(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function OGe(e){var t=zMe(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&FMe(n.ownerDocument.documentElement,n)){if(s!==null&&ume(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(s.start,i);s=s.end===void 0?o:Math.min(s.end,i),!e.extend&&o>s&&(i=s,s=o,o=i),i=ibe(n,o);var l=ibe(n,s);i&&l&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>s?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,N4=null,Lde=null,_T=null,Ode=!1;function abe(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ode||N4==null||N4!==xee(s)||(s=N4,"selectionStart"in s&&ume(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),_T&&IA(_T,s)||(_T=s,s=kee(Lde,"onSelect"),0M4||(e.current=$de[M4],$de[M4]=null,M4--)}function Yo(e,t){M4++,$de[M4]=e.current,e.current=t}var P1={},ru=Z1(P1),fh=Z1(!1),Cj=P1;function YS(e,t){var n=e.type.contextTypes;if(!n)return P1;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ph(e){return e=e.childContextTypes,e!=null}function See(){fl(fh),fl(ru)}function fbe(e,t,n){if(ru.current!==P1)throw Error(Mn(168));Yo(ru,t),Yo(fh,n)}function KMe(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var i in s)if(!(i in t))throw Error(Mn(108,AWe(e)||"Unknown",i));return Dl({},n,s)}function Cee(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||P1,Cj=ru.current,Yo(ru,e),Yo(fh,fh.current),!0}function pbe(e,t,n){var s=e.stateNode;if(!s)throw Error(Mn(169));n?(e=KMe(e,t,Cj),s.__reactInternalMemoizedMergedChildContext=e,fl(fh),fl(ru),Yo(ru,e)):fl(fh),Yo(fh,n)}var kx=null,yne=!1,ole=!1;function ZMe(e){kx===null?kx=[e]:kx.push(e)}function GGe(e){yne=!0,ZMe(e)}function Y1(){if(!ole&&kx!==null){ole=!0;var e=0,t=No;try{var n=kx;for(No=1;e>=l,i-=l,Ex=1<<32-lm(t)+i|n<K?(Z=H,H=null):Z=H.sibling;var re=w(E,H,O[K],z);if(re===null){H===null&&(H=Z);break}e&&H&&re.alternate===null&&t(E,H),T=o(re,T,K),q===null?F=re:q.sibling=re,q=re,H=Z}if(K===O.length)return n(E,H),wl&&c_(E,K),F;if(H===null){for(;KK?(Z=H,H=null):Z=H.sibling;var ue=w(E,H,re.value,z);if(ue===null){H===null&&(H=Z);break}e&&H&&ue.alternate===null&&t(E,H),T=o(ue,T,K),q===null?F=ue:q.sibling=ue,q=ue,H=Z}if(re.done)return n(E,H),wl&&c_(E,K),F;if(H===null){for(;!re.done;K++,re=O.next())re=y(E,re.value,z),re!==null&&(T=o(re,T,K),q===null?F=re:q.sibling=re,q=re);return wl&&c_(E,K),F}for(H=s(E,H);!re.done;K++,re=O.next())re=j(H,E,K,re.value,z),re!==null&&(e&&re.alternate!==null&&H.delete(re.key===null?K:re.key),T=o(re,T,K),q===null?F=re:q.sibling=re,q=re);return e&&H.forEach(function(he){return t(E,he)}),wl&&c_(E,K),F}function A(E,T,O,z){if(typeof O=="object"&&O!==null&&O.type===j4&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case z6:e:{for(var F=O.key,q=T;q!==null;){if(q.key===F){if(F=O.type,F===j4){if(q.tag===7){n(E,q.sibling),T=i(q,O.props.children),T.return=E,E=T;break e}}else if(q.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===d0&&xbe(F)===q.type){n(E,q.sibling),T=i(q,O.props),T.ref=CM(E,q,O),T.return=E,E=T;break e}n(E,q);break}else t(E,q);q=q.sibling}O.type===j4?(T=ij(O.props.children,E.mode,z,O.key),T.return=E,E=T):(z=h8(O.type,O.key,O.props,null,E.mode,z),z.ref=CM(E,T,O),z.return=E,E=z)}return l(E);case w4:e:{for(q=O.key;T!==null;){if(T.key===q)if(T.tag===4&&T.stateNode.containerInfo===O.containerInfo&&T.stateNode.implementation===O.implementation){n(E,T.sibling),T=i(T,O.children||[]),T.return=E,E=T;break e}else{n(E,T);break}else t(E,T);T=T.sibling}T=mle(O,E.mode,z),T.return=E,E=T}return l(E);case d0:return q=O._init,A(E,T,q(O._payload),z)}if(nT(O))return S(E,T,O,z);if(wM(O))return C(E,T,O,z);Y6(E,O)}return typeof O=="string"&&O!==""||typeof O=="number"?(O=""+O,T!==null&&T.tag===6?(n(E,T.sibling),T=i(T,O),T.return=E,E=T):(n(E,T),T=ple(O,E.mode,z),T.return=E,E=T),l(E)):n(E,T)}return A}var QS=JMe(!0),eTe=JMe(!1),Aee=Z1(null),Eee=null,E4=null,mme=null;function gme(){mme=E4=Eee=null}function xme(e){var t=Aee.current;fl(Aee),e._currentValue=t}function Vde(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function W4(e,t){Eee=e,mme=E4=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ch=!0),e.firstContext=null)}function Jf(e){var t=e._currentValue;if(mme!==e)if(e={context:e,memoizedValue:t,next:null},E4===null){if(Eee===null)throw Error(Mn(308));E4=e,Eee.dependencies={lanes:0,firstContext:e}}else E4=E4.next=e;return t}var Ow=null;function yme(e){Ow===null?Ow=[e]:Ow.push(e)}function tTe(e,t,n,s){var i=t.interleaved;return i===null?(n.next=n,yme(t)):(n.next=i.next,i.next=n),t.interleaved=n,ty(e,s)}function ty(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var u0=!1;function vme(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rTe(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Fx(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function J0(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,Ya&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,ty(e,n)}return i=s.interleaved,i===null?(t.next=t,yme(s)):(t.next=i.next,i.next=t),s.interleaved=t,ty(e,n)}function a8(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,sme(e,n)}}function ybe(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Iee(e,t,n,s){var i=e.updateQueue;u0=!1;var o=i.firstBaseUpdate,l=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var h=a,p=h.next;h.next=null,l===null?o=p:l.next=p,l=h;var x=e.alternate;x!==null&&(x=x.updateQueue,a=x.lastBaseUpdate,a!==l&&(a===null?x.firstBaseUpdate=p:a.next=p,x.lastBaseUpdate=h))}if(o!==null){var y=i.baseState;l=0,x=p=h=null,a=o;do{var w=a.lane,j=a.eventTime;if((s&w)===w){x!==null&&(x=x.next={eventTime:j,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var S=e,C=a;switch(w=t,j=n,C.tag){case 1:if(S=C.payload,typeof S=="function"){y=S.call(j,y,w);break e}y=S;break e;case 3:S.flags=S.flags&-65537|128;case 0:if(S=C.payload,w=typeof S=="function"?S.call(j,y,w):S,w==null)break e;y=Dl({},y,w);break e;case 2:u0=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,w=i.effects,w===null?i.effects=[a]:w.push(a))}else j={eventTime:j,lane:w,tag:a.tag,payload:a.payload,callback:a.callback,next:null},x===null?(p=x=j,h=y):x=x.next=j,l|=w;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;w=a,a=w.next,w.next=null,i.lastBaseUpdate=w,i.shared.pending=null}}while(!0);if(x===null&&(h=y),i.baseState=h,i.firstBaseUpdate=p,i.lastBaseUpdate=x,t=i.shared.interleaved,t!==null){i=t;do l|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);Aj|=l,e.lanes=l,e.memoizedState=y}}function vbe(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var s=cle.transition;cle.transition={};try{e(!1),t()}finally{No=n,cle.transition=s}}function vTe(){return ep().memoizedState}function XGe(e,t,n){var s=t1(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},_Te(e))bTe(t,n);else if(n=tTe(e,t,n,s),n!==null){var i=Eu();cm(n,e,s,i),wTe(n,t,s)}}function QGe(e,t,n){var s=t1(e),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(_Te(e))bTe(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,a=o(l,n);if(i.hasEagerState=!0,i.eagerState=a,_m(a,l)){var h=t.interleaved;h===null?(i.next=i,yme(t)):(i.next=h.next,h.next=i),t.interleaved=i;return}}catch{}finally{}n=tTe(e,t,i,s),n!==null&&(i=Eu(),cm(n,e,s,i),wTe(n,t,s))}}function _Te(e){var t=e.alternate;return e===Ll||t!==null&&t===Ll}function bTe(e,t){bT=Lee=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wTe(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,sme(e,n)}}var Oee={readContext:Jf,useCallback:Vd,useContext:Vd,useEffect:Vd,useImperativeHandle:Vd,useInsertionEffect:Vd,useLayoutEffect:Vd,useMemo:Vd,useReducer:Vd,useRef:Vd,useState:Vd,useDebugValue:Vd,useDeferredValue:Vd,useTransition:Vd,useMutableSource:Vd,useSyncExternalStore:Vd,useId:Vd,unstable_isNewReconciler:!1},JGe={readContext:Jf,useCallback:function(e,t){return Jm().memoizedState=[e,t===void 0?null:t],e},useContext:Jf,useEffect:bbe,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,l8(4194308,4,pTe.bind(null,t,e),n)},useLayoutEffect:function(e,t){return l8(4194308,4,e,t)},useInsertionEffect:function(e,t){return l8(4,2,e,t)},useMemo:function(e,t){var n=Jm();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=Jm();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=XGe.bind(null,Ll,e),[s.memoizedState,e]},useRef:function(e){var t=Jm();return e={current:e},t.memoizedState=e},useState:_be,useDebugValue:Cme,useDeferredValue:function(e){return Jm().memoizedState=e},useTransition:function(){var e=_be(!1),t=e[0];return e=YGe.bind(null,e[1]),Jm().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=Ll,i=Jm();if(wl){if(n===void 0)throw Error(Mn(407));n=n()}else{if(n=t(),dd===null)throw Error(Mn(349));Tj&30||aTe(s,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,bbe(lTe.bind(null,s,o,e),[e]),s.flags|=2048,BA(9,oTe.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=Jm(),t=dd.identifierPrefix;if(wl){var n=Ix,s=Ex;n=(s&~(1<<32-lm(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=FA++,0<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=l.createElement(n,{is:s.is}):(e=l.createElement(n),n==="select"&&(l=e,s.multiple?l.multiple=!0:s.size&&(l.size=s.size))):e=l.createElementNS(e,n),e[lg]=t,e[OA]=s,ITe(e,t,!1,!1),t.stateNode=e;e:{switch(l=Sde(n,s),n){case"dialog":cl("cancel",e),cl("close",e),i=s;break;case"iframe":case"object":case"embed":cl("load",e),i=s;break;case"video":case"audio":for(i=0;itC&&(t.flags|=128,s=!0,MM(o,!1),t.lanes=4194304)}else{if(!s)if(e=Pee(l),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),MM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!wl)return Hd(t),null}else 2*ic()-o.renderingStartTime>tC&&n!==1073741824&&(t.flags|=128,s=!0,MM(o,!1),t.lanes=4194304);o.isBackwards?(l.sibling=t.child,t.child=l):(n=o.last,n!==null?n.sibling=l:t.child=l,o.last=l)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ic(),t.sibling=null,n=Al.current,Yo(Al,s?n&1|2:n&1),t):(Hd(t),null);case 22:case 23:return Pme(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?Dh&1073741824&&(Hd(t),t.subtreeFlags&6&&(t.flags|=8192)):Hd(t),null;case 24:return null;case 25:return null}throw Error(Mn(156,t.tag))}function oKe(e,t){switch(fme(t),t.tag){case 1:return ph(t.type)&&See(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return JS(),fl(fh),fl(ru),wme(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bme(t),null;case 13:if(fl(Al),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Mn(340));XS()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fl(Al),null;case 4:return JS(),null;case 10:return xme(t.type._context),null;case 22:case 23:return Pme(),null;case 24:return null;default:return null}}var Q6=!1,Zd=!1,lKe=typeof WeakSet=="function"?WeakSet:Set,ys=null;function I4(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Ul(e,t,s)}else n.current=null}function Jde(e,t,n){try{n()}catch(s){Ul(e,t,s)}}var Ibe=!1;function cKe(e,t){if(Dde=wee,e=zMe(),ume(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,a=-1,h=-1,p=0,x=0,y=e,w=null;t:for(;;){for(var j;y!==n||i!==0&&y.nodeType!==3||(a=l+i),y!==o||s!==0&&y.nodeType!==3||(h=l+s),y.nodeType===3&&(l+=y.nodeValue.length),(j=y.firstChild)!==null;)w=y,y=j;for(;;){if(y===e)break t;if(w===n&&++p===i&&(a=l),w===o&&++x===s&&(h=l),(j=y.nextSibling)!==null)break;y=w,w=y.parentNode}y=j}n=a===-1||h===-1?null:{start:a,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rde={focusedElem:e,selectionRange:n},wee=!1,ys=t;ys!==null;)if(t=ys,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ys=e;else for(;ys!==null;){t=ys;try{var S=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var C=S.memoizedProps,A=S.memoizedState,E=t.stateNode,T=E.getSnapshotBeforeUpdate(t.elementType===t.type?C:Wp(t.type,C),A);E.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var O=t.stateNode.containerInfo;O.nodeType===1?O.textContent="":O.nodeType===9&&O.documentElement&&O.removeChild(O.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Mn(163))}}catch(z){Ul(t,t.return,z)}if(e=t.sibling,e!==null){e.return=t.return,ys=e;break}ys=t.return}return S=Ibe,Ibe=!1,S}function wT(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&Jde(t,n,o)}i=i.next}while(i!==s)}}function bne(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function eue(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function OTe(e){var t=e.alternate;t!==null&&(e.alternate=null,OTe(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[lg],delete t[OA],delete t[Bde],delete t[HGe],delete t[WGe])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function DTe(e){return e.tag===5||e.tag===3||e.tag===4}function Pbe(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||DTe(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tue(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Nee));else if(s!==4&&(e=e.child,e!==null))for(tue(e,t,n),e=e.sibling;e!==null;)tue(e,t,n),e=e.sibling}function rue(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(rue(e,t,n),e=e.sibling;e!==null;)rue(e,t,n),e=e.sibling}var Sd=null,Yp=!1;function e0(e,t,n){for(n=n.child;n!==null;)RTe(e,t,n),n=n.sibling}function RTe(e,t,n){if(mg&&typeof mg.onCommitFiberUnmount=="function")try{mg.onCommitFiberUnmount(fne,n)}catch{}switch(n.tag){case 5:Zd||I4(n,t);case 6:var s=Sd,i=Yp;Sd=null,e0(e,t,n),Sd=s,Yp=i,Sd!==null&&(Yp?(e=Sd,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Sd.removeChild(n.stateNode));break;case 18:Sd!==null&&(Yp?(e=Sd,n=n.stateNode,e.nodeType===8?ale(e.parentNode,n):e.nodeType===1&&ale(e,n),AA(e)):ale(Sd,n.stateNode));break;case 4:s=Sd,i=Yp,Sd=n.stateNode.containerInfo,Yp=!0,e0(e,t,n),Sd=s,Yp=i;break;case 0:case 11:case 14:case 15:if(!Zd&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){i=s=s.next;do{var o=i,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&Jde(n,t,l),i=i.next}while(i!==s)}e0(e,t,n);break;case 1:if(!Zd&&(I4(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){Ul(n,t,a)}e0(e,t,n);break;case 21:e0(e,t,n);break;case 22:n.mode&1?(Zd=(s=Zd)||n.memoizedState!==null,e0(e,t,n),Zd=s):e0(e,t,n);break;default:e0(e,t,n)}}function Lbe(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new lKe),t.forEach(function(s){var i=yKe.bind(null,e,s);n.has(s)||(n.add(s),s.then(i,i))})}}function zp(e,t){var n=t.deletions;if(n!==null)for(var s=0;si&&(i=l),s&=~o}if(s=i,s=ic()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*uKe(s/1960))-s,10e?16:e,B0===null)var s=!1;else{if(e=B0,B0=null,Fee=0,Ya&6)throw Error(Mn(331));var i=Ya;for(Ya|=4,ys=e.current;ys!==null;){var o=ys,l=o.child;if(ys.flags&16){var a=o.deletions;if(a!==null){for(var h=0;hic()-Eme?sj(e,0):Ame|=n),mh(e,t)}function HTe(e,t){t===0&&(e.mode&1?(t=q6,q6<<=1,!(q6&130023424)&&(q6=4194304)):t=1);var n=Eu();e=ty(e,t),e!==null&&(rI(e,t,n),mh(e,n))}function xKe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),HTe(e,n)}function yKe(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(Mn(314))}s!==null&&s.delete(t),HTe(e,n)}var WTe;WTe=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||fh.current)ch=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ch=!1,iKe(e,t,n);ch=!!(e.flags&131072)}else ch=!1,wl&&t.flags&1048576&&YMe(t,Tee,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;c8(e,t),e=t.pendingProps;var i=YS(t,ru.current);W4(t,n),i=kme(null,t,s,e,i,n);var o=Nme();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ph(s)?(o=!0,Cee(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,vme(t),i.updater=_ne,t.stateNode=i,i._reactInternals=t,Wde(t,s,e,n),t=Zde(null,t,s,!0,o,n)):(t.tag=0,wl&&o&&hme(t),yu(null,t,i,n),t=t.child),t;case 16:s=t.elementType;e:{switch(c8(e,t),e=t.pendingProps,i=s._init,s=i(s._payload),t.type=s,i=t.tag=_Ke(s),e=Wp(s,e),i){case 0:t=Kde(null,t,s,e,n);break e;case 1:t=Tbe(null,t,s,e,n);break e;case 11:t=Cbe(null,t,s,e,n);break e;case 14:t=Mbe(null,t,s,Wp(s.type,e),n);break e}throw Error(Mn(306,s,""))}return t;case 0:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),Kde(e,t,s,i,n);case 1:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),Tbe(e,t,s,i,n);case 3:e:{if(TTe(t),e===null)throw Error(Mn(387));s=t.pendingProps,o=t.memoizedState,i=o.element,rTe(e,t),Iee(t,s,null,n);var l=t.memoizedState;if(s=l.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=eC(Error(Mn(423)),t),t=Abe(e,t,s,n,i);break e}else if(s!==i){i=eC(Error(Mn(424)),t),t=Abe(e,t,s,n,i);break e}else for(Hh=Q0(t.stateNode.containerInfo.firstChild),Wh=t,wl=!0,em=null,n=eTe(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(XS(),s===i){t=ry(e,t,n);break e}yu(e,t,s,n)}t=t.child}return t;case 5:return nTe(t),e===null&&qde(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,l=i.children,Fde(s,i)?l=null:o!==null&&Fde(s,o)&&(t.flags|=32),MTe(e,t),yu(e,t,l,n),t.child;case 6:return e===null&&qde(t),null;case 13:return ATe(e,t,n);case 4:return _me(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=QS(t,null,s,n):yu(e,t,s,n),t.child;case 11:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),Cbe(e,t,s,i,n);case 7:return yu(e,t,t.pendingProps,n),t.child;case 8:return yu(e,t,t.pendingProps.children,n),t.child;case 12:return yu(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,i=t.pendingProps,o=t.memoizedProps,l=i.value,Yo(Aee,s._currentValue),s._currentValue=l,o!==null)if(_m(o.value,l)){if(o.children===i.children&&!fh.current){t=ry(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){l=o.child;for(var h=a.firstContext;h!==null;){if(h.context===s){if(o.tag===1){h=Fx(-1,n&-n),h.tag=2;var p=o.updateQueue;if(p!==null){p=p.shared;var x=p.pending;x===null?h.next=h:(h.next=x.next,x.next=h),p.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Vde(o.return,n,t),a.lanes|=n;break}h=h.next}}else if(o.tag===10)l=o.type===t.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(Mn(341));l.lanes|=n,a=l.alternate,a!==null&&(a.lanes|=n),Vde(l,n,t),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===t){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}yu(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,s=t.pendingProps.children,W4(t,n),i=Jf(i),s=s(i),t.flags|=1,yu(e,t,s,n),t.child;case 14:return s=t.type,i=Wp(s,t.pendingProps),i=Wp(s.type,i),Mbe(e,t,s,i,n);case 15:return STe(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),c8(e,t),t.tag=1,ph(s)?(e=!0,Cee(t)):e=!1,W4(t,n),jTe(t,s,i),Wde(t,s,i,n),Zde(null,t,s,!0,e,n);case 19:return ETe(e,t,n);case 22:return CTe(e,t,n)}throw Error(Mn(156,t.tag))};function GTe(e,t){return _Me(e,t)}function vKe(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zf(e,t,n,s){return new vKe(e,t,n,s)}function Ome(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _Ke(e){if(typeof e=="function")return Ome(e)?1:0;if(e!=null){if(e=e.$$typeof,e===eme)return 11;if(e===tme)return 14}return 2}function r1(e,t){var n=e.alternate;return n===null?(n=zf(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function h8(e,t,n,s,i,o){var l=2;if(s=e,typeof e=="function")Ome(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case j4:return ij(n.children,i,o,t);case Jpe:l=8,i|=8;break;case gde:return e=zf(12,n,t,i|2),e.elementType=gde,e.lanes=o,e;case xde:return e=zf(13,n,t,i),e.elementType=xde,e.lanes=o,e;case yde:return e=zf(19,n,t,i),e.elementType=yde,e.lanes=o,e;case nMe:return jne(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case tMe:l=10;break e;case rMe:l=9;break e;case eme:l=11;break e;case tme:l=14;break e;case d0:l=16,s=null;break e}throw Error(Mn(130,e==null?e:typeof e,""))}return t=zf(l,n,t,i),t.elementType=e,t.type=s,t.lanes=o,t}function ij(e,t,n,s){return e=zf(7,e,s,t),e.lanes=n,e}function jne(e,t,n,s){return e=zf(22,e,s,t),e.elementType=nMe,e.lanes=n,e.stateNode={isHidden:!1},e}function ple(e,t,n){return e=zf(6,e,null,t),e.lanes=n,e}function mle(e,t,n){return t=zf(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bKe(e,t,n,s,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zoe(0),this.expirationTimes=Zoe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zoe(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Dme(e,t,n,s,i,o,l,a,h){return e=new bKe(e,t,n,a,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=zf(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vme(o),e}function wKe(e,t,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(XTe)}catch(e){console.error(e)}}XTe(),X5e.exports=of;var hy=X5e.exports;const Bme=za(hy);var QTe,Ube=hy;QTe=Ube.createRoot,Ube.hydrateRoot;const CKe=1,MKe=1e6;let gle=0;function TKe(){return gle=(gle+1)%Number.MAX_SAFE_INTEGER,gle.toString()}const xle=new Map,qbe=e=>{if(xle.has(e))return;const t=setTimeout(()=>{xle.delete(e),NT({type:"REMOVE_TOAST",toastId:e})},MKe);xle.set(e,t)},AKe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,CKe)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?qbe(n):e.toasts.forEach(s=>{qbe(s.id)}),{...e,toasts:e.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},f8=[];let p8={toasts:[]};function NT(e){p8=AKe(p8,e),f8.forEach(t=>{t(p8)})}function $i({...e}){const t=TKe(),n=i=>NT({type:"UPDATE_TOAST",toast:{...i,id:t}}),s=()=>NT({type:"DISMISS_TOAST",toastId:t});return NT({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||s()}}}),{id:t,dismiss:s,update:n}}function pa(){const[e,t]=P.useState(p8);return P.useEffect(()=>(f8.push(t),()=>{const n=f8.indexOf(t);n>-1&&f8.splice(n,1)}),[e]),{...e,toast:$i,dismiss:n=>NT({type:"DISMISS_TOAST",toastId:n})}}function cn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Vbe(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ny(...e){return t=>{let n=!1;const s=e.map(i=>{const o=Vbe(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:l,...a}=o,h=P.useMemo(()=>a,Object.values(a));return r.jsx(n.Provider,{value:h,children:l})};s.displayName=e+"Provider";function i(o){const l=P.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[s,i]}function Ql(e,t=[]){let n=[];function s(o,l){const a=P.createContext(l),h=n.length;n=[...n,l];const p=y=>{var E;const{scope:w,children:j,...S}=y,C=((E=w==null?void 0:w[e])==null?void 0:E[h])||a,A=P.useMemo(()=>S,Object.values(S));return r.jsx(C.Provider,{value:A,children:j})};p.displayName=o+"Provider";function x(y,w){var C;const j=((C=w==null?void 0:w[e])==null?void 0:C[h])||a,S=P.useContext(j);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${o}\``)}return[p,x]}const i=()=>{const o=n.map(l=>P.createContext(l));return function(a){const h=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return i.scopeName=e,[s,IKe(i,...t)]}function IKe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const l=s.reduce((a,{useScope:h,scopeName:p})=>{const y=h(o)[`__scope${p}`];return{...a,...y}},{});return P.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function L1(e){const t=PKe(e),n=P.forwardRef((s,i)=>{const{children:o,...l}=s,a=P.Children.toArray(o),h=a.find(LKe);if(h){const p=h.props.children,x=a.map(y=>y===h?P.Children.count(p)>1?P.Children.only(null):P.isValidElement(p)?p.props.children:null:y);return r.jsx(t,{...l,ref:i,children:P.isValidElement(p)?P.cloneElement(p,void 0,x):null})}return r.jsx(t,{...l,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var $me=L1("Slot");function PKe(e){const t=P.forwardRef((n,s)=>{const{children:i,...o}=n;if(P.isValidElement(i)){const l=DKe(i),a=OKe(o,i.props);return i.type!==P.Fragment&&(a.ref=s?ny(s,l):l),P.cloneElement(i,a)}return P.Children.count(i)>1?P.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JTe=Symbol("radix.slottable");function eAe(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=JTe,t}function LKe(e){return P.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JTe}function OKe(e,t){const n={...t};for(const s in t){const i=e[s],o=t[s];/^on[A-Z]/.test(s)?i&&o?n[s]=(...a)=>{const h=o(...a);return i(...a),h}:i&&(n[s]=i):s==="style"?n[s]={...i,...o}:s==="className"&&(n[s]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function DKe(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function aI(e){const t=e+"CollectionProvider",[n,s]=Ql(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=C=>{const{scope:A,children:E}=C,T=rt.useRef(null),O=rt.useRef(new Map).current;return r.jsx(i,{scope:A,itemMap:O,collectionRef:T,children:E})};l.displayName=t;const a=e+"CollectionSlot",h=L1(a),p=rt.forwardRef((C,A)=>{const{scope:E,children:T}=C,O=o(a,E),z=ei(A,O.collectionRef);return r.jsx(h,{ref:z,children:T})});p.displayName=a;const x=e+"CollectionItemSlot",y="data-radix-collection-item",w=L1(x),j=rt.forwardRef((C,A)=>{const{scope:E,children:T,...O}=C,z=rt.useRef(null),F=ei(A,z),q=o(x,E);return rt.useEffect(()=>(q.itemMap.set(z,{ref:z,...O}),()=>void q.itemMap.delete(z))),r.jsx(w,{[y]:"",ref:F,children:T})});j.displayName=x;function S(C){const A=o(e+"CollectionConsumer",C);return rt.useCallback(()=>{const T=A.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${y}]`));return Array.from(A.itemMap.values()).sort((q,H)=>O.indexOf(q.ref.current)-O.indexOf(H.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:l,Slot:p,ItemSlot:j},S,s]}var RKe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=RKe.reduce((e,t)=>{const n=L1(`Primitive.${t}`),s=P.forwardRef((i,o)=>{const{asChild:l,...a}=i,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(h,{...a,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Ume(e,t){e&&hy.flushSync(()=>e.dispatchEvent(t))}function Gl(e){const t=P.useRef(e);return P.useEffect(()=>{t.current=e}),P.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function FKe(e,t=globalThis==null?void 0:globalThis.document){const n=Gl(e);P.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var zKe="DismissableLayer",oue="dismissableLayer.update",BKe="dismissableLayer.pointerDownOutside",$Ke="dismissableLayer.focusOutside",Hbe,tAe=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),X1=P.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:a,...h}=e,p=P.useContext(tAe),[x,y]=P.useState(null),w=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,j]=P.useState({}),S=ei(t,H=>y(H)),C=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),E=C.indexOf(A),T=x?C.indexOf(x):-1,O=p.layersWithOutsidePointerEventsDisabled.size>0,z=T>=E,F=qKe(H=>{const K=H.target,Z=[...p.branches].some(re=>re.contains(K));!z||Z||(i==null||i(H),l==null||l(H),H.defaultPrevented||a==null||a())},w),q=VKe(H=>{const K=H.target;[...p.branches].some(re=>re.contains(K))||(o==null||o(H),l==null||l(H),H.defaultPrevented||a==null||a())},w);return FKe(H=>{T===p.layers.size-1&&(s==null||s(H),!H.defaultPrevented&&a&&(H.preventDefault(),a()))},w),P.useEffect(()=>{if(x)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Hbe=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(x)),p.layers.add(x),Wbe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Hbe)}},[x,w,n,p]),P.useEffect(()=>()=>{x&&(p.layers.delete(x),p.layersWithOutsidePointerEventsDisabled.delete(x),Wbe())},[x,p]),P.useEffect(()=>{const H=()=>j({});return document.addEventListener(oue,H),()=>document.removeEventListener(oue,H)},[]),r.jsx(Rn.div,{...h,ref:S,style:{pointerEvents:O?z?"auto":"none":void 0,...e.style},onFocusCapture:cn(e.onFocusCapture,q.onFocusCapture),onBlurCapture:cn(e.onBlurCapture,q.onBlurCapture),onPointerDownCapture:cn(e.onPointerDownCapture,F.onPointerDownCapture)})});X1.displayName=zKe;var UKe="DismissableLayerBranch",rAe=P.forwardRef((e,t)=>{const n=P.useContext(tAe),s=P.useRef(null),i=ei(t,s);return P.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Rn.div,{...e,ref:i})});rAe.displayName=UKe;function qKe(e,t=globalThis==null?void 0:globalThis.document){const n=Gl(e),s=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{const o=a=>{if(a.target&&!s.current){let h=function(){nAe(BKe,n,p,{discrete:!0})};const p={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function VKe(e,t=globalThis==null?void 0:globalThis.document){const n=Gl(e),s=P.useRef(!1);return P.useEffect(()=>{const i=o=>{o.target&&!s.current&&nAe($Ke,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Wbe(){const e=new CustomEvent(oue);document.dispatchEvent(e)}function nAe(e,t,n,{discrete:s}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?Ume(i,o):i.dispatchEvent(o)}var HKe=X1,WKe=rAe,Yl=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},GKe="Portal",ZC=P.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[i,o]=P.useState(!1);Yl(()=>o(!0),[]);const l=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?Bme.createPortal(r.jsx(Rn.div,{...s,ref:t}),l):null});ZC.displayName=GKe;function KKe(e,t){return P.useReducer((n,s)=>t[n][s]??n,e)}var fc=e=>{const{present:t,children:n}=e,s=ZKe(t),i=typeof n=="function"?n({present:s.isPresent}):P.Children.only(n),o=ei(s.ref,YKe(i));return typeof n=="function"||s.isPresent?P.cloneElement(i,{ref:o}):null};fc.displayName="Presence";function ZKe(e){const[t,n]=P.useState(),s=P.useRef(null),i=P.useRef(e),o=P.useRef("none"),l=e?"mounted":"unmounted",[a,h]=KKe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const p=tL(s.current);o.current=a==="mounted"?p:"none"},[a]),Yl(()=>{const p=s.current,x=i.current;if(x!==e){const w=o.current,j=tL(p);e?h("MOUNT"):j==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(x&&w!==j?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Yl(()=>{if(t){let p;const x=t.ownerDocument.defaultView??window,y=j=>{const C=tL(s.current).includes(j.animationName);if(j.target===t&&C&&(h("ANIMATION_END"),!i.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",p=x.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},w=j=>{j.target===t&&(o.current=tL(s.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{x.clearTimeout(p),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:P.useCallback(p=>{s.current=p?getComputedStyle(p):null,n(p)},[])}}function tL(e){return(e==null?void 0:e.animationName)||"none"}function YKe(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var XKe=Zpe[" useInsertionEffect ".trim().toString()]||Yl;function Lu({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,o,l]=QKe({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:i;{const x=P.useRef(e!==void 0);P.useEffect(()=>{const y=x.current;y!==a&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${a?"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.`),x.current=a},[a,s])}const p=P.useCallback(x=>{var y;if(a){const w=JKe(x)?x(e):x;w!==e&&((y=l.current)==null||y.call(l,w))}else o(x)},[a,e,o,l]);return[h,p]}function QKe({defaultProp:e,onChange:t}){const[n,s]=P.useState(e),i=P.useRef(n),o=P.useRef(t);return XKe(()=>{o.current=t},[t]),P.useEffect(()=>{var l;i.current!==n&&((l=o.current)==null||l.call(o,n),i.current=n)},[n,i]),[n,s,o]}function JKe(e){return typeof e=="function"}var sAe=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"}),eZe="VisuallyHidden",Mne=P.forwardRef((e,t)=>r.jsx(Rn.span,{...e,ref:t,style:{...sAe,...e.style}}));Mne.displayName=eZe;var tZe=Mne,qme="ToastProvider",[Vme,rZe,nZe]=aI("Toast"),[iAe]=Ql("Toast",[nZe]),[sZe,Tne]=iAe(qme),aAe=e=>{const{__scopeToast:t,label:n="Notification",duration:s=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:l}=e,[a,h]=P.useState(null),[p,x]=P.useState(0),y=P.useRef(!1),w=P.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${qme}\`. Expected non-empty \`string\`.`),r.jsx(Vme.Provider,{scope:t,children:r.jsx(sZe,{scope:t,label:n,duration:s,swipeDirection:i,swipeThreshold:o,toastCount:p,viewport:a,onViewportChange:h,onToastAdd:P.useCallback(()=>x(j=>j+1),[]),onToastRemove:P.useCallback(()=>x(j=>j-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:w,children:l})})};aAe.displayName=qme;var oAe="ToastViewport",iZe=["F8"],lue="toast.viewportPause",cue="toast.viewportResume",lAe=P.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:s=iZe,label:i="Notifications ({hotkey})",...o}=e,l=Tne(oAe,n),a=rZe(n),h=P.useRef(null),p=P.useRef(null),x=P.useRef(null),y=P.useRef(null),w=ei(t,y,l.onViewportChange),j=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),S=l.toastCount>0;P.useEffect(()=>{const A=E=>{var O;s.length!==0&&s.every(z=>E[z]||E.code===z)&&((O=y.current)==null||O.focus())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[s]),P.useEffect(()=>{const A=h.current,E=y.current;if(S&&A&&E){const T=()=>{if(!l.isClosePausedRef.current){const q=new CustomEvent(lue);E.dispatchEvent(q),l.isClosePausedRef.current=!0}},O=()=>{if(l.isClosePausedRef.current){const q=new CustomEvent(cue);E.dispatchEvent(q),l.isClosePausedRef.current=!1}},z=q=>{!A.contains(q.relatedTarget)&&O()},F=()=>{A.contains(document.activeElement)||O()};return A.addEventListener("focusin",T),A.addEventListener("focusout",z),A.addEventListener("pointermove",T),A.addEventListener("pointerleave",F),window.addEventListener("blur",T),window.addEventListener("focus",O),()=>{A.removeEventListener("focusin",T),A.removeEventListener("focusout",z),A.removeEventListener("pointermove",T),A.removeEventListener("pointerleave",F),window.removeEventListener("blur",T),window.removeEventListener("focus",O)}}},[S,l.isClosePausedRef]);const C=P.useCallback(({tabbingDirection:A})=>{const T=a().map(O=>{const z=O.ref.current,F=[z,...yZe(z)];return A==="forwards"?F:F.reverse()});return(A==="forwards"?T.reverse():T).flat()},[a]);return P.useEffect(()=>{const A=y.current;if(A){const E=T=>{var F,q,H;const O=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!O){const K=document.activeElement,Z=T.shiftKey;if(T.target===A&&Z){(F=p.current)==null||F.focus();return}const he=C({tabbingDirection:Z?"backwards":"forwards"}),be=he.findIndex(ne=>ne===K);yle(he.slice(be+1))?T.preventDefault():Z?(q=p.current)==null||q.focus():(H=x.current)==null||H.focus()}};return A.addEventListener("keydown",E),()=>A.removeEventListener("keydown",E)}},[a,C]),r.jsxs(WKe,{ref:h,role:"region","aria-label":i.replace("{hotkey}",j),tabIndex:-1,style:{pointerEvents:S?void 0:"none"},children:[S&&r.jsx(due,{ref:p,onFocusFromOutsideViewport:()=>{const A=C({tabbingDirection:"forwards"});yle(A)}}),r.jsx(Vme.Slot,{scope:n,children:r.jsx(Rn.ol,{tabIndex:-1,...o,ref:w})}),S&&r.jsx(due,{ref:x,onFocusFromOutsideViewport:()=>{const A=C({tabbingDirection:"backwards"});yle(A)}})]})});lAe.displayName=oAe;var cAe="ToastFocusProxy",due=P.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...i}=e,o=Tne(cAe,n);return r.jsx(Mne,{"aria-hidden":!0,tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:l=>{var p;const a=l.relatedTarget;!((p=o.viewport)!=null&&p.contains(a))&&s()}})});due.displayName=cAe;var oI="Toast",aZe="toast.swipeStart",oZe="toast.swipeMove",lZe="toast.swipeCancel",cZe="toast.swipeEnd",dAe=P.forwardRef((e,t)=>{const{forceMount:n,open:s,defaultOpen:i,onOpenChange:o,...l}=e,[a,h]=Lu({prop:s,defaultProp:i??!0,onChange:o,caller:oI});return r.jsx(fc,{present:n||a,children:r.jsx(hZe,{open:a,...l,ref:t,onClose:()=>h(!1),onPause:Gl(e.onPause),onResume:Gl(e.onResume),onSwipeStart:cn(e.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:cn(e.onSwipeMove,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","move"),p.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:cn(e.onSwipeCancel,p=>{p.currentTarget.setAttribute("data-swipe","cancel"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:cn(e.onSwipeEnd,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),h(!1)})})})});dAe.displayName=oI;var[dZe,uZe]=iAe(oI,{onClose(){}}),hZe=P.forwardRef((e,t)=>{const{__scopeToast:n,type:s="foreground",duration:i,open:o,onClose:l,onEscapeKeyDown:a,onPause:h,onResume:p,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:w,onSwipeEnd:j,...S}=e,C=Tne(oI,n),[A,E]=P.useState(null),T=ei(t,ne=>E(ne)),O=P.useRef(null),z=P.useRef(null),F=i||C.duration,q=P.useRef(0),H=P.useRef(F),K=P.useRef(0),{onToastAdd:Z,onToastRemove:re}=C,ue=Gl(()=>{var ye;(A==null?void 0:A.contains(document.activeElement))&&((ye=C.viewport)==null||ye.focus()),l()}),he=P.useCallback(ne=>{!ne||ne===1/0||(window.clearTimeout(K.current),q.current=new Date().getTime(),K.current=window.setTimeout(ue,ne))},[ue]);P.useEffect(()=>{const ne=C.viewport;if(ne){const ye=()=>{he(H.current),p==null||p()},ie=()=>{const fe=new Date().getTime()-q.current;H.current=H.current-fe,window.clearTimeout(K.current),h==null||h()};return ne.addEventListener(lue,ie),ne.addEventListener(cue,ye),()=>{ne.removeEventListener(lue,ie),ne.removeEventListener(cue,ye)}}},[C.viewport,F,h,p,he]),P.useEffect(()=>{o&&!C.isClosePausedRef.current&&he(F)},[o,F,C.isClosePausedRef,he]),P.useEffect(()=>(Z(),()=>re()),[Z,re]);const be=P.useMemo(()=>A?xAe(A):null,[A]);return C.viewport?r.jsxs(r.Fragment,{children:[be&&r.jsx(fZe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:be}),r.jsx(dZe,{scope:n,onClose:ue,children:hy.createPortal(r.jsx(Vme.ItemSlot,{scope:n,children:r.jsx(HKe,{asChild:!0,onEscapeKeyDown:cn(a,()=>{C.isFocusedToastEscapeKeyDownRef.current||ue(),C.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Rn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":C.swipeDirection,...S,ref:T,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:cn(e.onKeyDown,ne=>{ne.key==="Escape"&&(a==null||a(ne.nativeEvent),ne.nativeEvent.defaultPrevented||(C.isFocusedToastEscapeKeyDownRef.current=!0,ue()))}),onPointerDown:cn(e.onPointerDown,ne=>{ne.button===0&&(O.current={x:ne.clientX,y:ne.clientY})}),onPointerMove:cn(e.onPointerMove,ne=>{if(!O.current)return;const ye=ne.clientX-O.current.x,ie=ne.clientY-O.current.y,fe=!!z.current,de=["left","right"].includes(C.swipeDirection),_e=["left","up"].includes(C.swipeDirection)?Math.min:Math.max,Ee=de?_e(0,ye):0,ke=de?0:_e(0,ie),pe=ne.pointerType==="touch"?10:2,ae={x:Ee,y:ke},ge={originalEvent:ne,delta:ae};fe?(z.current=ae,rL(oZe,y,ge,{discrete:!1})):Gbe(ae,C.swipeDirection,pe)?(z.current=ae,rL(aZe,x,ge,{discrete:!1}),ne.target.setPointerCapture(ne.pointerId)):(Math.abs(ye)>pe||Math.abs(ie)>pe)&&(O.current=null)}),onPointerUp:cn(e.onPointerUp,ne=>{const ye=z.current,ie=ne.target;if(ie.hasPointerCapture(ne.pointerId)&&ie.releasePointerCapture(ne.pointerId),z.current=null,O.current=null,ye){const fe=ne.currentTarget,de={originalEvent:ne,delta:ye};Gbe(ye,C.swipeDirection,C.swipeThreshold)?rL(cZe,j,de,{discrete:!0}):rL(lZe,w,de,{discrete:!0}),fe.addEventListener("click",_e=>_e.preventDefault(),{once:!0})}})})})}),C.viewport)})]}):null}),fZe=e=>{const{__scopeToast:t,children:n,...s}=e,i=Tne(oI,t),[o,l]=P.useState(!1),[a,h]=P.useState(!1);return gZe(()=>l(!0)),P.useEffect(()=>{const p=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(p)},[]),a?null:r.jsx(ZC,{asChild:!0,children:r.jsx(Mne,{...s,children:o&&r.jsxs(r.Fragment,{children:[i.label," ",n]})})})},pZe="ToastTitle",uAe=P.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Rn.div,{...s,ref:t})});uAe.displayName=pZe;var mZe="ToastDescription",hAe=P.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Rn.div,{...s,ref:t})});hAe.displayName=mZe;var fAe="ToastAction",pAe=P.forwardRef((e,t)=>{const{altText:n,...s}=e;return n.trim()?r.jsx(gAe,{altText:n,asChild:!0,children:r.jsx(Hme,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${fAe}\`. Expected non-empty \`string\`.`),null)});pAe.displayName=fAe;var mAe="ToastClose",Hme=P.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e,i=uZe(mAe,n);return r.jsx(gAe,{asChild:!0,children:r.jsx(Rn.button,{type:"button",...s,ref:t,onClick:cn(e.onClick,i.onClose)})})});Hme.displayName=mAe;var gAe=P.forwardRef((e,t)=>{const{__scopeToast:n,altText:s,...i}=e;return r.jsx(Rn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...i,ref:t})});function xAe(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),xZe(s)){const i=s.ariaHidden||s.hidden||s.style.display==="none",o=s.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const l=s.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...xAe(s))}}),t}function rL(e,t,n,{discrete:s}){const i=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?Ume(i,o):i.dispatchEvent(o)}var Gbe=(e,t,n=0)=>{const s=Math.abs(e.x),i=Math.abs(e.y),o=s>i;return t==="left"||t==="right"?o&&s>n:!o&&i>n};function gZe(e=()=>{}){const t=Gl(e);Yl(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[t])}function xZe(e){return e.nodeType===e.ELEMENT_NODE}function yZe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yle(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var vZe=aAe,yAe=lAe,vAe=dAe,_Ae=uAe,bAe=hAe,wAe=pAe,jAe=Hme;function kAe(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,Zbe=ra,YC=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return Zbe(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(p=>{const x=n==null?void 0:n[p],y=o==null?void 0:o[p];if(x===null)return null;const w=Kbe(x)||Kbe(y);return i[p][w]}),a=n&&Object.entries(n).reduce((p,x)=>{let[y,w]=x;return w===void 0||(p[y]=w),p},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((p,x)=>{let{class:y,className:w,...j}=x;return Object.entries(j).every(S=>{let[C,A]=S;return Array.isArray(A)?A.includes({...o,...a}[C]):{...o,...a}[C]===A})?[...p,y,w]:p},[]);return Zbe(e,l,h,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Ze=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),NAe=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var bZe={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"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SAe=P.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:o,iconNode:l,...a},h)=>P.createElement("svg",{ref:h,...bZe,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:NAe("lucide",i),...a},[...l.map(([p,x])=>P.createElement(p,x)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U=(e,t)=>{const n=P.forwardRef(({className:s,...i},o)=>P.createElement(SAe,{ref:o,iconNode:t,className:NAe(`lucide-${_Ze(e)}`,s),...i}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m8=U("AArrowDown",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 7v9",key:"pknjwm"}],["path",{d:"m14 12 4 4 4-4",key:"buelq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g8=U("AArrowUp",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 16V7",key:"ty0viw"}],["path",{d:"m14 11 4-4 4 4",key:"1pu57t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x8=U("ALargeSmall",[["path",{d:"M21 14h-5",key:"1vh23k"}],["path",{d:"M16 16v-3.5a2.5 2.5 0 0 1 5 0V16",key:"1wh10o"}],["path",{d:"M4.5 13h6",key:"dfilno"}],["path",{d:"m3 16 4.5-9 4.5 9",key:"2dxa0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y8=U("Accessibility",[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xg=U("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v8=U("AirVent",[["path",{d:"M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"larmp2"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12",key:"1bo8pg"}],["path",{d:"M6.6 15.6A2 2 0 1 0 10 17v-5",key:"t9h90c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _8=U("Airplay",[["path",{d:"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1",key:"ns4c3b"}],["path",{d:"m12 15 5 6H7Z",key:"14qnn2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u_=U("AlarmClockCheck",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h_=U("AlarmClockMinus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b8=U("AlarmClockOff",[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f_=U("AlarmClockPlus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w8=U("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j8=U("AlarmSmoke",[["path",{d:"M11 21c0-2.5 2-2.5 2-5",key:"1sicvv"}],["path",{d:"M16 21c0-2.5 2-2.5 2-5",key:"1o3eny"}],["path",{d:"m19 8-.8 3a1.25 1.25 0 0 1-1.2 1H7a1.25 1.25 0 0 1-1.2-1L5 8",key:"1bvca4"}],["path",{d:"M21 3a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a1 1 0 0 1 1-1z",key:"x3qr1j"}],["path",{d:"M6 21c0-2.5 2-2.5 2-5",key:"i3w1gp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k8=U("Album",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["polyline",{points:"11 3 11 11 14 8 17 11 17 3",key:"1wcwz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N8=U("AlignCenterHorizontal",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",key:"11f1s0"}],["path",{d:"M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",key:"t14dx9"}],["path",{d:"M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",key:"1w07xs"}],["path",{d:"M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",key:"1apec2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S8=U("AlignCenterVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",key:"14d6g8"}],["path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",key:"1e2lrw"}],["path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",key:"1fkdwx"}],["path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",key:"1euafb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K4=U("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C8=U("AlignEndHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M8=U("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T8=U("AlignHorizontalDistributeCenter",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A8=U("AlignHorizontalDistributeEnd",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M10 2v20",key:"uyc634"}],["path",{d:"M20 2v20",key:"1tx262"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E8=U("AlignHorizontalDistributeStart",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M4 2v20",key:"gtpd5x"}],["path",{d:"M14 2v20",key:"tg6bpw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I8=U("AlignHorizontalJustifyCenter",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P8=U("AlignHorizontalJustifyEnd",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"12",y:"7",rx:"2",key:"1ht384"}],["path",{d:"M22 2v20",key:"40qfg1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L8=U("AlignHorizontalJustifyStart",[["rect",{width:"6",height:"14",x:"6",y:"5",rx:"2",key:"hsirpf"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O8=U("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D8=U("AlignHorizontalSpaceBetween",[["rect",{width:"6",height:"14",x:"3",y:"5",rx:"2",key:"j77dae"}],["rect",{width:"6",height:"10",x:"15",y:"7",rx:"2",key:"bq30hj"}],["path",{d:"M3 2v20",key:"1d2pfg"}],["path",{d:"M21 2v20",key:"p059bm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R8=U("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z4=U("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y4=U("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F8=U("AlignStartHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z8=U("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B8=U("AlignVerticalDistributeCenter",[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $8=U("AlignVerticalDistributeEnd",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U8=U("AlignVerticalDistributeStart",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q8=U("AlignVerticalJustifyCenter",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V8=U("AlignVerticalJustifyEnd",[["rect",{width:"14",height:"6",x:"5",y:"12",rx:"2",key:"4l4tp2"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 22h20",key:"272qi7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H8=U("AlignVerticalJustifyStart",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"6",rx:"2",key:"13squh"}],["path",{d:"M2 2h20",key:"1ennik"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W8=U("AlignVerticalSpaceAround",[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G8=U("AlignVerticalSpaceBetween",[["rect",{width:"14",height:"6",x:"5",y:"15",rx:"2",key:"1w91an"}],["rect",{width:"10",height:"6",x:"7",y:"3",rx:"2",key:"17wqzy"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M2 3h20",key:"91anmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K8=U("Ambulance",[["path",{d:"M10 10H6",key:"1bsnug"}],["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.28a1 1 0 0 0-.684-.948l-1.923-.641a1 1 0 0 1-.578-.502l-1.539-3.076A1 1 0 0 0 16.382 8H14",key:"lrkjwd"}],["path",{d:"M8 8v4",key:"1fwk8c"}],["path",{d:"M9 18h6",key:"x1upvd"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z8=U("Ampersand",[["path",{d:"M17.5 12c0 4.4-3.6 8-8 8A4.5 4.5 0 0 1 5 15.5c0-6 8-4 8-8.5a3 3 0 1 0-6 0c0 3 2.5 8.5 12 13",key:"1o9ehi"}],["path",{d:"M16 12h3",key:"4uvgyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y8=U("Ampersands",[["path",{d:"M10 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"12lh1k"}],["path",{d:"M22 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"173c68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X8=U("Amphora",[["path",{d:"M10 2v5.632c0 .424-.272.795-.653.982A6 6 0 0 0 6 14c.006 4 3 7 5 8",key:"1h8rid"}],["path",{d:"M10 5H8a2 2 0 0 0 0 4h.68",key:"3ezsi6"}],["path",{d:"M14 2v5.632c0 .424.272.795.652.982A6 6 0 0 1 18 14c0 4-3 7-5 8",key:"yt6q09"}],["path",{d:"M14 5h2a2 2 0 0 1 0 4h-.68",key:"8f95yk"}],["path",{d:"M18 22H6",key:"mg6kv4"}],["path",{d:"M9 2h6",key:"1jrp98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q8=U("Anchor",[["path",{d:"M12 22V8",key:"qkxhtm"}],["path",{d:"M5 12H2a10 10 0 0 0 20 0h-3",key:"1hv3nh"}],["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J8=U("Angry",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["path",{d:"M7.5 8 10 9",key:"olxxln"}],["path",{d:"m14 9 2.5-1",key:"1j6cij"}],["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eO=U("Annoyed",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M14 9h2",key:"116p9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tO=U("Antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rO=U("Anvil",[["path",{d:"M7 10H6a4 4 0 0 1-4-4 1 1 0 0 1 1-1h4",key:"1hjpb6"}],["path",{d:"M7 5a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1 7 7 0 0 1-7 7H8a1 1 0 0 1-1-1z",key:"1qn45f"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M5 20a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3 1 1 0 0 1-1 1H6a1 1 0 0 1-1-1",key:"1fi4x8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nO=U("Aperture",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sO=U("AppWindowMac",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M14 8h.01",key:"1primd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ST=U("AppWindow",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iO=U("Apple",[["path",{d:"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z",key:"3s7exb"}],["path",{d:"M10 2c1 .5 2 2 2 5",key:"fcco2y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aO=U("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oO=U("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lO=U("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cO=U("Armchair",[["path",{d:"M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3",key:"irtipd"}],["path",{d:"M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"1qyhux"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dO=U("ArrowBigDownDash",[["path",{d:"M15 5H9",key:"1tp3ed"}],["path",{d:"M15 9v3h4l-7 7-7-7h4V9z",key:"ncdc4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uO=U("ArrowBigDown",[["path",{d:"M15 6v6h4l-7 7-7-7h4V6h6z",key:"1thax2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hO=U("ArrowBigLeftDash",[["path",{d:"M19 15V9",key:"1hci5f"}],["path",{d:"M15 15h-3v4l-7-7 7-7v4h3v6z",key:"16tjna"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fO=U("ArrowBigLeft",[["path",{d:"M18 15h-6v4l-7-7 7-7v4h6v6z",key:"lbrdak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pO=U("ArrowBigRightDash",[["path",{d:"M5 9v6",key:"158jrl"}],["path",{d:"M9 9h3V5l7 7-7 7v-4H9V9z",key:"1sg2xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mO=U("ArrowBigRight",[["path",{d:"M6 9h6V5l7 7-7 7v-4H6V9z",key:"7fvt9c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gO=U("ArrowBigUpDash",[["path",{d:"M9 19h6",key:"456am0"}],["path",{d:"M9 15v-3H5l7-7 7 7h-4v3H9z",key:"1r2uve"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xO=U("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yO=U("ArrowDown01",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vO=U("ArrowDown10",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p_=U("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _O=U("ArrowDownFromLine",[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bO=U("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wO=U("ArrowDownNarrowWide",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h4",key:"6d7r33"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h10",key:"1438ji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jO=U("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kO=U("ArrowDownToDot",[["path",{d:"M12 2v14",key:"jyx4ut"}],["path",{d:"m19 9-7 7-7-7",key:"1oe3oy"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NO=U("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SO=U("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m_=U("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g_=U("ArrowDownZA",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n1=U("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CO=U("ArrowLeftFromLine",[["path",{d:"m9 6-6 6 6 6",key:"7v63n9"}],["path",{d:"M3 12h14",key:"13k4hi"}],["path",{d:"M21 19V5",key:"b4bplr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MO=U("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TO=U("ArrowLeftToLine",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qa=U("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AO=U("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EO=U("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IO=U("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ko=U("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PO=U("ArrowUp01",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LO=U("ArrowUp10",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x_=U("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zx=U("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OO=U("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DO=U("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RO=U("ArrowUpLeft",[["path",{d:"M7 17V7h10",key:"11bw93"}],["path",{d:"M17 17 7 7",key:"2786uv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y_=U("ArrowUpNarrowWide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FO=U("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zO=U("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BO=U("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v_=U("ArrowUpZA",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yg=U("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $O=U("ArrowsUpFromLine",[["path",{d:"m4 6 3-3 3 3",key:"9aidw8"}],["path",{d:"M7 17V3",key:"19qxw1"}],["path",{d:"m14 6 3-3 3 3",key:"6iy689"}],["path",{d:"M17 17V3",key:"o0fmgi"}],["path",{d:"M4 21h16",key:"1h09gz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UO=U("Asterisk",[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qO=U("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VO=U("Atom",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HO=U("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WO=U("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pl=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GO=U("Axe",[["path",{d:"m14 12-8.5 8.5a2.12 2.12 0 1 1-3-3L11 9",key:"csbz4o"}],["path",{d:"M15 13 9 7l4-4 6 6h3a8 8 0 0 1-7 7z",key:"113wfo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const __=U("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KO=U("Baby",[["path",{d:"M9 12h.01",key:"157uk2"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"5yv0yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZO=U("Backpack",[["path",{d:"M4 10a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",key:"1ol0lm"}],["path",{d:"M8 10h8",key:"c7uz4u"}],["path",{d:"M8 18h8",key:"1no2b1"}],["path",{d:"M8 22v-6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v6",key:"1fr6do"}],["path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2",key:"donm21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YO=U("BadgeAlert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XO=U("BadgeCent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M15.4 10a4 4 0 1 0 0 4",key:"2eqtx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b_=U("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QO=U("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JO=U("BadgeEuro",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M7 12h5",key:"gblrwe"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eD=U("BadgeHelp",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tD=U("BadgeIndianRupee",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 8h8",key:"1bis0t"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m13 17-5-1h1a4 4 0 0 0 0-8",key:"nu2bwa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rD=U("BadgeInfo",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"16",y2:"12",key:"1y1yb1"}],["line",{x1:"12",x2:"12.01",y1:"8",y2:"8",key:"110wyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nD=U("BadgeJapaneseYen",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 8 3 3v7",key:"17yadx"}],["path",{d:"m12 11 3-3",key:"p4cfq1"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M9 16h6",key:"8wimt3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sD=U("BadgeMinus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iD=U("BadgePercent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aD=U("BadgePlus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oD=U("BadgePoundSterling",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 12h4",key:"qz6y1c"}],["path",{d:"M10 16V9.5a2.5 2.5 0 0 1 5 0",key:"3mlbjk"}],["path",{d:"M8 16h7",key:"sbedsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lD=U("BadgeRussianRuble",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9 16h5",key:"1syiyw"}],["path",{d:"M9 12h5a2 2 0 1 0 0-4h-3v9",key:"1ge9c1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cD=U("BadgeSwissFranc",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M11 17V8h4",key:"1bfq6y"}],["path",{d:"M11 12h3",key:"2eqnfz"}],["path",{d:"M9 16h4",key:"1skf3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dD=U("BadgeX",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uD=U("Badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hD=U("BaggageClaim",[["path",{d:"M22 18H6a2 2 0 0 1-2-2V7a2 2 0 0 0-2-2",key:"4irg2o"}],["path",{d:"M17 14V4a2 2 0 0 0-2-2h-1a2 2 0 0 0-2 2v10",key:"14fcyx"}],["rect",{width:"13",height:"8",x:"8",y:"6",rx:"1",key:"o6oiis"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"9",cy:"20",r:"2",key:"e5v82j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fD=U("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pD=U("Banana",[["path",{d:"M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5",key:"1cscit"}],["path",{d:"M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z",key:"1y1nbv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mD=U("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gD=U("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xD=U("Barcode",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yD=U("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qf=U("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vD=U("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _D=U("BatteryFull",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"13",key:"c6fn6x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bD=U("BatteryLow",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wD=U("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jD=U("BatteryWarning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 7h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1x5o8m"}],["path",{d:"M22 11v2",key:"1wo06k"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"1mdjgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kD=U("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ND=U("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SD=U("BeanOff",[["path",{d:"M9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22a13.96 13.96 0 0 0 9.9-4.1",key:"bq3udt"}],["path",{d:"M10.75 5.093A6 6 0 0 1 22 8c0 2.411-.61 4.68-1.683 6.66",key:"17ccse"}],["path",{d:"M5.341 10.62a4 4 0 0 0 6.487 1.208M10.62 5.341a4.015 4.015 0 0 1 2.039 2.04",key:"18zqgq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CD=U("Bean",[["path",{d:"M10.165 6.598C9.954 7.478 9.64 8.36 9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22c7.732 0 14-6.268 14-14a6 6 0 0 0-11.835-1.402Z",key:"1tvzk7"}],["path",{d:"M5.341 10.62a4 4 0 1 0 5.279-5.28",key:"2cyri2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MD=U("BedDouble",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TD=U("BedSingle",[["path",{d:"M3 20v-8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8",key:"1wm6mi"}],["path",{d:"M5 10V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",key:"4k93s5"}],["path",{d:"M3 18h18",key:"1h113x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vf=U("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AD=U("Beef",[["circle",{cx:"12.5",cy:"8.5",r:"2.5",key:"9738u8"}],["path",{d:"M12.5 2a6.5 6.5 0 0 0-6.22 4.6c-1.1 3.13-.78 3.9-3.18 6.08A3 3 0 0 0 5 18c4 0 8.4-1.8 11.4-4.3A6.5 6.5 0 0 0 12.5 2Z",key:"o0f6za"}],["path",{d:"m18.5 6 2.19 4.5a6.48 6.48 0 0 1 .31 2 6.49 6.49 0 0 1-2.6 5.2C15.4 20.2 11 22 7 22a3 3 0 0 1-2.68-1.66L2.4 16.5",key:"k7p6i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ED=U("BeerOff",[["path",{d:"M13 13v5",key:"igwfh0"}],["path",{d:"M17 11.47V8",key:"16yw0g"}],["path",{d:"M17 11h1a3 3 0 0 1 2.745 4.211",key:"1xbt65"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-3",key:"c55o3e"}],["path",{d:"M7.536 7.535C6.766 7.649 6.154 8 5.5 8a2.5 2.5 0 0 1-1.768-4.268",key:"1ydug7"}],["path",{d:"M8.727 3.204C9.306 2.767 9.885 2 11 2c1.56 0 2 1.5 3 1.5s1.72-.5 2.5-.5a1 1 0 1 1 0 5c-.78 0-1.5-.5-2.5-.5a3.149 3.149 0 0 0-.842.12",key:"q81o7q"}],["path",{d:"M9 14.6V18",key:"20ek98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ID=U("Beer",[["path",{d:"M17 11h1a3 3 0 0 1 0 6h-1",key:"1yp76v"}],["path",{d:"M9 12v6",key:"1u1cab"}],["path",{d:"M13 12v6",key:"1sugkk"}],["path",{d:"M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z",key:"1510fo"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"19jb7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PD=U("BellDot",[["path",{d:"M19.4 14.9C20.2 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 .7 0 1.3.1 1.9.3",key:"xcehk"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LD=U("BellElectric",[["path",{d:"M18.8 4A6.3 8.7 0 0 1 20 9",key:"xve1fh"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["rect",{width:"10",height:"6",x:"4",y:"16",rx:"2",key:"17f3te"}],["path",{d:"M14 19c3 0 4.6-1.6 4.6-1.6",key:"n7odp6"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OD=U("BellMinus",[["path",{d:"M18.4 12c.8 3.8 2.6 5 2.6 5H3s3-2 3-9c0-3.3 2.7-6 6-6 1.8 0 3.4.8 4.5 2",key:"eck70s"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aj=U("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DD=U("BellPlus",[["path",{d:"M19.3 14.8C20.1 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 1 0 1.9.2 2.8.7",key:"guizqy"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}],["path",{d:"M18 5v6",key:"g5ayrv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RD=U("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vg=U("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w_=U("BetweenHorizontalEnd",[["rect",{width:"13",height:"7",x:"3",y:"3",rx:"1",key:"11xb64"}],["path",{d:"m22 15-3-3 3-3",key:"26chmm"}],["rect",{width:"13",height:"7",x:"3",y:"14",rx:"1",key:"k6ky7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j_=U("BetweenHorizontalStart",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FD=U("BetweenVerticalEnd",[["rect",{width:"7",height:"13",x:"3",y:"3",rx:"1",key:"1fdu0f"}],["path",{d:"m9 22 3-3 3 3",key:"17z65a"}],["rect",{width:"7",height:"13",x:"14",y:"3",rx:"1",key:"1squn4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zD=U("BetweenVerticalStart",[["rect",{width:"7",height:"13",x:"3",y:"8",rx:"1",key:"1fjrkv"}],["path",{d:"m15 2-3 3-3-3",key:"1uh6eb"}],["rect",{width:"7",height:"13",x:"14",y:"8",rx:"1",key:"w3fjg8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BD=U("BicepsFlexed",[["path",{d:"M12.409 13.017A5 5 0 0 1 22 15c0 3.866-4 7-9 7-4.077 0-8.153-.82-10.371-2.462-.426-.316-.631-.832-.62-1.362C2.118 12.723 2.627 2 10 2a3 3 0 0 1 3 3 2 2 0 0 1-2 2c-1.105 0-1.64-.444-2-1",key:"1pmlyh"}],["path",{d:"M15 14a5 5 0 0 0-7.584 2",key:"5rb254"}],["path",{d:"M9.964 6.825C8.019 7.977 9.5 13 8 15",key:"kbvsx9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $D=U("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UD=U("Binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qD=U("Binoculars",[["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M19 7V4a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3",key:"3apit1"}],["path",{d:"M20 21a2 2 0 0 0 2-2v-3.851c0-1.39-2-2.962-2-4.829V8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v11a2 2 0 0 0 2 2z",key:"rhpgnw"}],["path",{d:"M 22 16 L 2 16",key:"14lkq7"}],["path",{d:"M4 21a2 2 0 0 1-2-2v-3.851c0-1.39 2-2.962 2-4.829V8a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v11a2 2 0 0 1-2 2z",key:"104b3k"}],["path",{d:"M9 7V4a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v3",key:"14fczp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VD=U("Biohazard",[["circle",{cx:"12",cy:"11.9",r:"2",key:"e8h31w"}],["path",{d:"M6.7 3.4c-.9 2.5 0 5.2 2.2 6.7C6.5 9 3.7 9.6 2 11.6",key:"17bolr"}],["path",{d:"m8.9 10.1 1.4.8",key:"15ezny"}],["path",{d:"M17.3 3.4c.9 2.5 0 5.2-2.2 6.7 2.4-1.2 5.2-.6 6.9 1.5",key:"wtwa5u"}],["path",{d:"m15.1 10.1-1.4.8",key:"1r0b28"}],["path",{d:"M16.7 20.8c-2.6-.4-4.6-2.6-4.7-5.3-.2 2.6-2.1 4.8-4.7 5.2",key:"m7qszh"}],["path",{d:"M12 13.9v1.6",key:"zfyyim"}],["path",{d:"M13.5 5.4c-1-.2-2-.2-3 0",key:"1bi9q0"}],["path",{d:"M17 16.4c.7-.7 1.2-1.6 1.5-2.5",key:"1rhjqw"}],["path",{d:"M5.5 13.9c.3.9.8 1.8 1.5 2.5",key:"8gsud3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HD=U("Bird",[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WD=U("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GD=U("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KD=U("Blinds",[["path",{d:"M3 3h18",key:"o7r712"}],["path",{d:"M20 7H8",key:"gd2fo2"}],["path",{d:"M20 11H8",key:"1ynp89"}],["path",{d:"M10 19h10",key:"19hjk5"}],["path",{d:"M8 15h12",key:"1yqzne"}],["path",{d:"M4 3v14",key:"fggqzn"}],["circle",{cx:"4",cy:"19",r:"2",key:"p3m9r0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZD=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YD=U("BluetoothConnected",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["line",{x1:"18",x2:"21",y1:"12",y2:"12",key:"1rsjjs"}],["line",{x1:"3",x2:"6",y1:"12",y2:"12",key:"11yl8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XD=U("BluetoothOff",[["path",{d:"m17 17-5 5V12l-5 5",key:"v5aci6"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M14.5 9.5 17 7l-5-5v4.5",key:"1kddfz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QD=U("BluetoothSearching",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["path",{d:"M20.83 14.83a4 4 0 0 0 0-5.66",key:"k8tn1j"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JD=U("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X4=U("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eR=U("Bolt",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tR=U("Bomb",[["circle",{cx:"11",cy:"13",r:"9",key:"hd149"}],["path",{d:"M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",key:"jp4j1b"}],["path",{d:"m22 2-1.5 1.5",key:"ay92ug"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rR=U("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nR=U("BookA",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m8 13 4-7 4 7",key:"4rari8"}],["path",{d:"M9.1 11h5.7",key:"1gkovt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sR=U("BookAudio",[["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8v3",key:"gejaml"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 8v3",key:"1qzp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iR=U("BookCheck",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aR=U("BookCopy",[["path",{d:"M2 16V4a2 2 0 0 1 2-2h11",key:"spzkk5"}],["path",{d:"M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12",key:"1wz07i"}],["path",{d:"M5 14H4a2 2 0 1 0 0 4h1",key:"16gqf9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k_=U("BookDashed",[["path",{d:"M12 17h2",key:"13u4lk"}],["path",{d:"M12 22h2",key:"kn7ki6"}],["path",{d:"M12 2h2",key:"cvn524"}],["path",{d:"M18 22h1a1 1 0 0 0 1-1",key:"w6gbqz"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v1",key:"1vpra5"}],["path",{d:"M20 15v2h-2",key:"fph276"}],["path",{d:"M20 8v3",key:"deu0bs"}],["path",{d:"M4 11V9",key:"v3xsx8"}],["path",{d:"M4 19.5V15",key:"6gr39e"}],["path",{d:"M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8",key:"wywhs9"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oR=U("BookDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3 3 3-3",key:"zt5b4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lR=U("BookHeadphones",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 12v-2a4 4 0 0 1 8 0v2",key:"1vsqkj"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cR=U("BookHeart",[["path",{d:"M16 8.2A2.22 2.22 0 0 0 13.8 6c-.8 0-1.4.3-1.8.9-.4-.6-1-.9-1.8-.9A2.22 2.22 0 0 0 8 8.2c0 .6.3 1.2.7 1.6A226.652 226.652 0 0 0 12 13a404 404 0 0 0 3.3-3.1 2.413 2.413 0 0 0 .7-1.7",key:"1t75a8"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dR=U("BookImage",[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uR=U("BookKey",[["path",{d:"m19 3 1 1",key:"ze14oc"}],["path",{d:"m20 2-4.5 4.5",key:"1sppr8"}],["path",{d:"M20 8v13a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1ocbpn"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H14",key:"1gfsgw"}],["circle",{cx:"14",cy:"8",r:"2",key:"u49eql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hR=U("BookLock",[["path",{d:"M18 6V4a2 2 0 1 0-4 0v2",key:"1aquzs"}],["path",{d:"M20 15v6a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1rkj32"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H10",key:"18wgow"}],["rect",{x:"12",y:"6",width:"8",height:"5",rx:"1",key:"73l30o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fR=U("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pR=U("BookMinus",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mR=U("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gR=U("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CT=U("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xR=U("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yR=U("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vR=U("BookType",[["path",{d:"M10 13h4",key:"ytezjc"}],["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8V6H8v2",key:"x8j6u4"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _R=U("BookUp2",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"161d7n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2",key:"1lorq7"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bR=U("BookUp",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wR=U("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jR=U("BookX",[["path",{d:"m14.5 7-5 5",key:"dy991v"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9.5 7 5 5",key:"s45iea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kR=U("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NR=U("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SR=U("BookmarkMinus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CR=U("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MR=U("BookmarkX",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dm=U("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TR=U("BoomBox",[["path",{d:"M4 9V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"vvzvr1"}],["path",{d:"M8 8v1",key:"xcqmfk"}],["path",{d:"M12 8v1",key:"1rj8u4"}],["path",{d:"M16 8v1",key:"1q12zr"}],["rect",{width:"20",height:"12",x:"2",y:"9",rx:"2",key:"igpb89"}],["circle",{cx:"8",cy:"15",r:"2",key:"fa4a8s"}],["circle",{cx:"16",cy:"15",r:"2",key:"14c3ya"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AR=U("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ER=U("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q4=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IR=U("Box",[["path",{d:"M21 8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PR=U("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N_=U("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LR=U("Brackets",[["path",{d:"M16 3h3v18h-3",key:"1yor1f"}],["path",{d:"M8 21H5V3h3",key:"1qrfwo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OR=U("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DR=U("BrainCog",[["path",{d:"M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5",key:"1kgmhc"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m15.7 10.4-.9.4",key:"ayzo6p"}],["path",{d:"m9.2 13.2-.9.4",key:"1uzb3g"}],["path",{d:"m13.6 15.7-.4-.9",key:"11ifqf"}],["path",{d:"m10.8 9.2-.4-.9",key:"1pmk2v"}],["path",{d:"m15.7 13.5-.9-.4",key:"7ng02m"}],["path",{d:"m9.2 10.9-.9-.4",key:"1x66zd"}],["path",{d:"m10.5 15.7.4-.9",key:"3js94g"}],["path",{d:"m13.1 9.2.4-.9",key:"18n7mc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MT=U("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RR=U("BrickWall",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 9v6",key:"199k2o"}],["path",{d:"M16 15v6",key:"8rj2es"}],["path",{d:"M16 3v6",key:"1j6rpj"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 15v6",key:"1stoo3"}],["path",{d:"M8 3v6",key:"vlvjmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FR=U("BriefcaseBusiness",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zR=U("BriefcaseConveyorBelt",[["path",{d:"M10 20v2",key:"1n8e1g"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M18 20v2",key:"10uadw"}],["path",{d:"M21 20H3",key:"kdqkdp"}],["path",{d:"M6 20v2",key:"a9bc87"}],["path",{d:"M8 16V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v12",key:"17n9tx"}],["rect",{x:"4",y:"6",width:"16",height:"10",rx:"2",key:"1097i5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BR=U("BriefcaseMedical",[["path",{d:"M12 11v4",key:"a6ujw6"}],["path",{d:"M14 13h-4",key:"1pl8zg"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M18 6v14",key:"1mu4gy"}],["path",{d:"M6 6v14",key:"1s15cj"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gh=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $R=U("BringToFront",[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2",key:"yj20xf"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2",key:"1ltk23"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2",key:"1q24h9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UR=U("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qR=U("BugOff",[["path",{d:"M15 7.13V6a3 3 0 0 0-5.14-2.1L8 2",key:"vl8zik"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M22 13h-4v-2a4 4 0 0 0-4-4h-1.3",key:"1ou0bd"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7.7 7.7A4 4 0 0 0 6 11v3a6 6 0 0 0 11.13 3.13",key:"1njkjs"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VR=U("BugPlay",[["path",{d:"M12.765 21.522a.5.5 0 0 1-.765-.424v-8.196a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"17shqo"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5",key:"1tjixy"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HR=U("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const na=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oj=U("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WR=U("BusFront",[["path",{d:"M4 6 2 7",key:"1mqr15"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"m22 7-2-1",key:"1umjhc"}],["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 21v-2",key:"sqyl04"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GR=U("Bus",[["path",{d:"M8 6v6",key:"18i7km"}],["path",{d:"M15 6v6",key:"1sg6z9"}],["path",{d:"M2 12h19.6",key:"de5uta"}],["path",{d:"M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3",key:"1wwztk"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M9 18h5",key:"lrx6i"}],["circle",{cx:"16",cy:"18",r:"2",key:"1v4tcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KR=U("CableCar",[["path",{d:"M10 3h.01",key:"lbucoy"}],["path",{d:"M14 2h.01",key:"1k8aa1"}],["path",{d:"m2 9 20-5",key:"1kz0j5"}],["path",{d:"M12 12V6.5",key:"1vbrij"}],["rect",{width:"16",height:"10",x:"4",y:"12",rx:"3",key:"if91er"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZR=U("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YR=U("CakeSlice",[["circle",{cx:"9",cy:"7",r:"2",key:"1305pl"}],["path",{d:"M7.2 7.9 3 11v9c0 .6.4 1 1 1h16c.6 0 1-.4 1-1v-9c0-2-3-6-7-8l-3.6 2.6",key:"xle13f"}],["path",{d:"M16 13H3",key:"1wpj08"}],["path",{d:"M16 17H3",key:"3lvfcd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gh=U("Cake",[["path",{d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8",key:"1w3rig"}],["path",{d:"M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1",key:"n2jgmb"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M7 8v3",key:"1qtyvj"}],["path",{d:"M12 8v3",key:"hwp4zt"}],["path",{d:"M17 8v3",key:"1i6e5u"}],["path",{d:"M7 4h.01",key:"1bh4kh"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M17 4h.01",key:"1upcoc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XR=U("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QR=U("Calendar1",[["path",{d:"M11 14h1v4",key:"fy54vd"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JR=U("CalendarArrowDown",[["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 14v8",key:"irew45"}],["path",{d:"M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343",key:"bse4f3"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eF=U("CalendarArrowUp",[["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 22v-8",key:"su0gjh"}],["path",{d:"M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9",key:"1exg90"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tF=U("CalendarCheck2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rF=U("CalendarCheck",[["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"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nF=U("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sF=U("CalendarCog",[["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"M21 10.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"11kmuh"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const um=U("CalendarDays",[["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"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iF=U("CalendarFold",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 17V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11Z",key:"kg77oy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M15 22v-4a2 2 0 0 1 2-2h4",key:"1gnbqr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aF=U("CalendarHeart",[["path",{d:"M3 10h18V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7",key:"136lmk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21.29 14.7a2.43 2.43 0 0 0-2.65-.52c-.3.12-.57.3-.8.53l-.34.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L17.5 22l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1t7hil"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oF=U("CalendarMinus2",[["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"}],["path",{d:"M10 16h4",key:"17e571"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lF=U("CalendarMinus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 15V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1scpom"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cF=U("CalendarOff",[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dF=U("CalendarPlus2",[["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"}],["path",{d:"M10 16h4",key:"17e571"}],["path",{d:"M12 14v4",key:"1thi36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lj=U("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uF=U("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hF=U("CalendarSearch",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fF=U("CalendarSync",[["path",{d:"M11 10v4h4",key:"172dkj"}],["path",{d:"m11 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"vu0qm5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m21 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"1qgeyt"}],["path",{d:"M21 22v-4h-4",key:"hrummi"}],["path",{d:"M21 8.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4.3",key:"mctw84"}],["path",{d:"M3 10h4",key:"1el30a"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pF=U("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mF=U("CalendarX",[["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"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ys=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gF=U("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s1=U("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xF=U("CandyCane",[["path",{d:"M5.7 21a2 2 0 0 1-3.5-2l8.6-14a6 6 0 0 1 10.4 6 2 2 0 1 1-3.464-2 2 2 0 1 0-3.464-2Z",key:"isaq8g"}],["path",{d:"M17.75 7 15 2.1",key:"12x7e8"}],["path",{d:"M10.9 4.8 13 9",key:"100a87"}],["path",{d:"m7.9 9.7 2 4.4",key:"ntfhaj"}],["path",{d:"M4.9 14.7 7 18.9",key:"1x43jy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yF=U("CandyOff",[["path",{d:"m8.5 8.5-1 1a4.95 4.95 0 0 0 7 7l1-1",key:"1ff4ui"}],["path",{d:"M11.843 6.187A4.947 4.947 0 0 1 16.5 7.5a4.947 4.947 0 0 1 1.313 4.657",key:"1sbrv4"}],["path",{d:"M14 16.5V14",key:"1maf8j"}],["path",{d:"M14 6.5v1.843",key:"1a6u6t"}],["path",{d:"M10 10v7.5",key:"80pj65"}],["path",{d:"m16 7 1-5 1.367.683A3 3 0 0 0 19.708 3H21v1.292a3 3 0 0 0 .317 1.341L22 7l-5 1",key:"11a9mt"}],["path",{d:"m8 17-1 5-1.367-.683A3 3 0 0 0 4.292 21H3v-1.292a3 3 0 0 0-.317-1.341L2 17l5-1",key:"3mjmon"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vF=U("Candy",[["path",{d:"m9.5 7.5-2 2a4.95 4.95 0 1 0 7 7l2-2a4.95 4.95 0 1 0-7-7Z",key:"ue6khb"}],["path",{d:"M14 6.5v10",key:"5xnk7c"}],["path",{d:"M10 7.5v10",key:"1uew51"}],["path",{d:"m16 7 1-5 1.37.68A3 3 0 0 0 19.7 3H21v1.3c0 .46.1.92.32 1.33L22 7l-5 1",key:"b9cp6k"}],["path",{d:"m8 17-1 5-1.37-.68A3 3 0 0 0 4.3 21H3v-1.3a3 3 0 0 0-.32-1.33L2 17l5-1",key:"5lney8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _F=U("Cannabis",[["path",{d:"M12 22v-4",key:"1utk9m"}],["path",{d:"M7 12c-1.5 0-4.5 1.5-5 3 3.5 1.5 6 1 6 1-1.5 1.5-2 3.5-2 5 2.5 0 4.5-1.5 6-3 1.5 1.5 3.5 3 6 3 0-1.5-.5-3.5-2-5 0 0 2.5.5 6-1-.5-1.5-3.5-3-5-3 1.5-1 4-4 4-6-2.5 0-5.5 1.5-7 3 0-2.5-.5-5-2-7-1.5 2-2 4.5-2 7-1.5-1.5-4.5-3-7-3 0 2 2.5 5 4 6",key:"1mezod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bF=U("CaptionsOff",[["path",{d:"M10.5 5H19a2 2 0 0 1 2 2v8.5",key:"jqtk4d"}],["path",{d:"M17 11h-.5",key:"1961ue"}],["path",{d:"M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2",key:"1keqsi"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7 11h4",key:"1o1z6v"}],["path",{d:"M7 15h2.5",key:"1ina1g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S_=U("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wF=U("CarFront",[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jF=U("CarTaxiFront",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kF=U("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NF=U("Caravan",[["path",{d:"M18 19V9a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v8a2 2 0 0 0 2 2h2",key:"19jm3t"}],["path",{d:"M2 9h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2",key:"13hakp"}],["path",{d:"M22 17v1a1 1 0 0 1-1 1H10v-9a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v9",key:"1crci8"}],["circle",{cx:"8",cy:"19",r:"2",key:"t8fc5s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SF=U("Carrot",[["path",{d:"M2.27 21.7s9.87-3.5 12.73-6.36a4.5 4.5 0 0 0-6.36-6.37C5.77 11.84 2.27 21.7 2.27 21.7zM8.64 14l-2.05-2.04M15.34 15l-2.46-2.46",key:"rfqxbe"}],["path",{d:"M22 9s-1.33-2-3.5-2C16.86 7 15 9 15 9s1.33 2 3.5 2S22 9 22 9z",key:"6b25w4"}],["path",{d:"M15 2s-2 1.33-2 3.5S15 9 15 9s2-1.84 2-3.5C17 3.33 15 2 15 2z",key:"fn65lo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CF=U("CaseLower",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MF=U("CaseSensitive",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["circle",{cx:"18",cy:"12",r:"3",key:"1kchzo"}],["path",{d:"M21 9v6",key:"anns31"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TF=U("CaseUpper",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["path",{d:"M15 11h4.5a2 2 0 0 1 0 4H15V7h4a2 2 0 0 1 0 4",key:"1sqfas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AF=U("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EF=U("Cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IF=U("Castle",[["path",{d:"M22 20v-9H2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2Z",key:"109fe4"}],["path",{d:"M18 11V4H6v7",key:"mon5oj"}],["path",{d:"M15 22v-4a3 3 0 0 0-3-3a3 3 0 0 0-3 3v4",key:"1k4jtn"}],["path",{d:"M22 11V9",key:"3zbp94"}],["path",{d:"M2 11V9",key:"1x5rnq"}],["path",{d:"M6 4V2",key:"1rsq15"}],["path",{d:"M18 4V2",key:"1jsdo1"}],["path",{d:"M10 4V2",key:"75d9ly"}],["path",{d:"M14 4V2",key:"8nj3z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PF=U("Cat",[["path",{d:"M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z",key:"x6xyqk"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M11.25 16.25h1.5L12 17l-.75-.75Z",key:"12kq1m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LF=U("Cctv",[["path",{d:"M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97",key:"ir91b5"}],["path",{d:"M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z",key:"jlp8i1"}],["path",{d:"M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15",key:"19bib8"}],["path",{d:"M2 21v-4",key:"l40lih"}],["path",{d:"M7 9h.01",key:"19b3jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C_=U("ChartArea",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M_=U("ChartBarBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OF=U("ChartBarDecreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h3",key:"ur6vzw"}],["path",{d:"M7 6h12",key:"sz5b0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DF=U("ChartBarIncreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h12",key:"wsnu98"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RF=U("ChartBarStacked",[["path",{d:"M11 13v4",key:"vyy2rb"}],["path",{d:"M15 5v4",key:"1gx88a"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T_=U("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A_=U("ChartCandlestick",[["path",{d:"M9 5v4",key:"14uxtq"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1",key:"f4fvz0"}],["path",{d:"M9 15v2",key:"r5rk32"}],["path",{d:"M17 3v2",key:"1l2re6"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1",key:"z38je5"}],["path",{d:"M17 13v3",key:"5l0wba"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E_=U("ChartColumnBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FF=U("ChartColumnDecreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17v-3",key:"1sqioe"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17V5",key:"1wzmnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I_=U("ChartColumnIncreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zF=U("ChartColumnStacked",[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ac=U("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BF=U("ChartGantt",[["path",{d:"M10 6h8",key:"zvc2xc"}],["path",{d:"M12 16h6",key:"yi5mkt"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 11h7",key:"wz2hg0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P_=U("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $F=U("ChartNetwork",[["path",{d:"m13.11 7.664 1.78 2.672",key:"go2gg9"}],["path",{d:"m14.162 12.788-3.324 1.424",key:"11x848"}],["path",{d:"m20 4-6.06 1.515",key:"1wxxh7"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["circle",{cx:"12",cy:"6",r:"2",key:"1jj5th"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}],["circle",{cx:"9",cy:"15",r:"2",key:"lf2ghp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UF=U("ChartNoAxesColumnDecreasing",[["path",{d:"M12 20V10",key:"g8npz5"}],["path",{d:"M18 20v-4",key:"8uic4z"}],["path",{d:"M6 20V4",key:"1w1bmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L_=U("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O_=U("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qF=U("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D_=U("ChartNoAxesGantt",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R_=U("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F_=U("ChartScatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VF=U("ChartSpline",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HF=U("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ca=U("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WF=U("ChefHat",[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GF=U("Cherry",[["path",{d:"M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"cvxqlc"}],["path",{d:"M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"1ostrc"}],["path",{d:"M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12",key:"hqx58h"}],["path",{d:"M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z",key:"eykp1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iu=U("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KF=U("ChevronFirst",[["path",{d:"m17 18-6-6 6-6",key:"1yerx2"}],["path",{d:"M7 6v12",key:"1p53r6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZF=U("ChevronLast",[["path",{d:"m7 18 6-6-6-6",key:"lwmzdw"}],["path",{d:"M17 6v12",key:"1o0aio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qc=U("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ga=U("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i1=U("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YF=U("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XF=U("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QF=U("ChevronsLeftRightEllipsis",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JF=U("ChevronsLeftRight",[["path",{d:"m9 7-5 5 5 5",key:"j5w590"}],["path",{d:"m15 7 5 5-5 5",key:"1bl6da"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ez=U("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tz=U("ChevronsRightLeft",[["path",{d:"m20 17-5-5 5-5",key:"30x0n2"}],["path",{d:"m4 17 5-5-5-5",key:"16spf4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rz=U("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a1=U("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nz=U("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sz=U("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iz=U("Church",[["path",{d:"M10 9h4",key:"u4k05v"}],["path",{d:"M12 7v5",key:"ma6bk"}],["path",{d:"M14 22v-4a2 2 0 0 0-4 0v4",key:"1pdhuj"}],["path",{d:"M18 22V5.618a1 1 0 0 0-.553-.894l-4.553-2.277a2 2 0 0 0-1.788 0L6.553 4.724A1 1 0 0 0 6 5.618V22",key:"1rkokr"}],["path",{d:"m18 7 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.618a1 1 0 0 1 .553-.894L6 7",key:"1w6esw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const az=U("CigaretteOff",[["path",{d:"M12 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h13",key:"1gdiyg"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 12a1 1 0 0 1 1 1v2a1 1 0 0 1-.5.866",key:"166zjj"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oz=U("Cigarette",[["path",{d:"M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14",key:"1mb5g1"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"1yl5r7"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const El=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z_=U("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B_=U("CircleArrowLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $_=U("CircleArrowOutDownLeft",[["path",{d:"M2 12a10 10 0 1 1 10 10",key:"1yn6ov"}],["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"M8 22H2v-6",key:"sulq54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U_=U("CircleArrowOutDownRight",[["path",{d:"M12 22a10 10 0 1 1 10-10",key:"130bv5"}],["path",{d:"M22 22 12 12",key:"131aw7"}],["path",{d:"M22 16v6h-6",key:"1gvm70"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q_=U("CircleArrowOutUpLeft",[["path",{d:"M2 8V2h6",key:"hiwtdz"}],["path",{d:"m2 2 10 10",key:"1oh8rs"}],["path",{d:"M12 2A10 10 0 1 1 2 12",key:"rrk4fa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V_=U("CircleArrowOutUpRight",[["path",{d:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H_=U("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W_=U("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qa=U("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Za=U("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G_=U("CircleChevronDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K_=U("CircleChevronLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z_=U("CircleChevronRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y_=U("CircleChevronUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lz=U("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X_=U("CircleDivide",[["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cz=U("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dz=U("CircleDotDashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uz=U("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hz=U("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fz=U("CircleEqual",[["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pz=U("CircleFadingArrowUp",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mz=U("CircleFadingPlus",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q_=U("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nx=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J_=U("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gz=U("CircleOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=U("CircleParkingOff",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m5 5 14 14",key:"11anup"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.34",key:"a9qo08"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=U("CircleParking",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=U("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n2=U("CirclePercent",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Of=U("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s2=U("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=U("CirclePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a2=U("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xz=U("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=U("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=U("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=U("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zc=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pu=U("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yz=U("CircuitBoard",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vz=U("Citrus",[["path",{d:"M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z",key:"4ite01"}],["path",{d:"M19.65 15.66A8 8 0 0 1 8.35 4.34",key:"1gxipu"}],["path",{d:"m14 10-5.5 5.5",key:"92pfem"}],["path",{d:"M14 17.85V10H6.15",key:"xqmtsk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _z=U("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TT=U("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bz=U("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wz=U("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jz=U("ClipboardMinus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kz=U("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=U("ClipboardPenLine",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.5",key:"1but9f"}],["path",{d:"M16 4h2a2 2 0 0 1 1.73 1",key:"1p8n7l"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=U("ClipboardPen",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5",key:"cereej"}],["path",{d:"M4 13.5V6a2 2 0 0 1 2-2h2",key:"5ua5vh"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nz=U("ClipboardPlus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}],["path",{d:"M12 17v-6",key:"1y8rbf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sz=U("ClipboardType",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cz=U("ClipboardX",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m15 11-6 6",key:"1toa9n"}],["path",{d:"m9 11 6 6",key:"wlibny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mz=U("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tz=U("Clock1",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 8",key:"12zbmj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Az=U("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ez=U("Clock11",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 8",key:"l5bg6f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iz=U("Clock12",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12",key:"1fub01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pz=U("Clock2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 10",key:"1g230d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lz=U("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oz=U("Clock4",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dz=U("Clock5",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 16",key:"1pcbox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rz=U("Clock6",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 12 16.5",key:"hb2qv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fz=U("Clock7",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 16",key:"ka3394"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zz=U("Clock8",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 14",key:"tmc9b4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bz=U("Clock9",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 7.5 12",key:"1k60p0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $z=U("ClockAlert",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uz=U("ClockArrowDown",[["path",{d:"M12.338 21.994A10 10 0 1 1 21.925 13.227",key:"1i7shu"}],["path",{d:"M12 6v6l2 1",key:"19cm8n"}],["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M18 14v8",key:"irew45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qz=U("ClockArrowUp",[["path",{d:"M13.228 21.925A10 10 0 1 1 21.994 12.338",key:"1fzlyi"}],["path",{d:"M12 6v6l1.562.781",key:"1ujuk9"}],["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M18 22v-8",key:"su0gjh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ki=U("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vz=U("CloudAlert",[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hz=U("CloudCog",[["circle",{cx:"12",cy:"17",r:"3",key:"1spfwm"}],["path",{d:"M4.2 15.1A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"zaobp"}],["path",{d:"m15.7 18.4-.9-.3",key:"4qxpbn"}],["path",{d:"m9.2 15.9-.9-.3",key:"17q7o2"}],["path",{d:"m10.6 20.7.3-.9",key:"1pf4s2"}],["path",{d:"m13.1 14.2.3-.9",key:"1mnuqm"}],["path",{d:"m13.6 20.7-.4-1",key:"1jpd1m"}],["path",{d:"m10.8 14.3-.4-1",key:"17ugyy"}],["path",{d:"m8.3 18.6 1-.4",key:"s42vdx"}],["path",{d:"m14.7 15.8 1-.4",key:"2wizun"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=U("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wz=U("CloudDrizzle",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 19v1",key:"1dk2by"}],["path",{d:"M8 14v1",key:"84yxot"}],["path",{d:"M16 19v1",key:"v220m7"}],["path",{d:"M16 14v1",key:"g12gj6"}],["path",{d:"M12 21v1",key:"q8vafk"}],["path",{d:"M12 16v1",key:"1mx6rx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gz=U("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kz=U("CloudHail",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v2",key:"a1is7l"}],["path",{d:"M8 14v2",key:"1e9m6t"}],["path",{d:"M16 20h.01",key:"xwek51"}],["path",{d:"M8 20h.01",key:"1vjney"}],["path",{d:"M12 16v2",key:"z66u1j"}],["path",{d:"M12 22h.01",key:"1urd7a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zz=U("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yz=U("CloudMoonRain",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xz=U("CloudMoon",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qz=U("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jz=U("CloudRainWind",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m9.2 22 3-7",key:"sb5f6j"}],["path",{d:"m9 13-3 7",key:"500co5"}],["path",{d:"m17 13-3 7",key:"8t2fiy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e7=U("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t7=U("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r7=U("CloudSunRain",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n7=U("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f2=U("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s7=U("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i7=U("Cloudy",[["path",{d:"M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"gqqjvc"}],["path",{d:"M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5",key:"1p2s76"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Px=U("Clover",[["path",{d:"M16.17 7.83 2 22",key:"t58vo8"}],["path",{d:"M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12",key:"17k36q"}],["path",{d:"m7.83 7.83 8.34 8.34",key:"1d7sxk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a7=U("Club",[["path",{d:"M17.28 9.05a5.5 5.5 0 1 0-10.56 0A5.5 5.5 0 1 0 12 17.66a5.5 5.5 0 1 0 5.28-8.6Z",key:"27yuqz"}],["path",{d:"M12 17.66L12 22",key:"ogfahf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cj=U("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o7=U("Codepen",[["polygon",{points:"12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2",key:"srzb37"}],["line",{x1:"12",x2:"12",y1:"22",y2:"15.5",key:"1t73f2"}],["polyline",{points:"22 8.5 12 15.5 2 8.5",key:"ajlxae"}],["polyline",{points:"2 15.5 12 8.5 22 15.5",key:"susrui"}],["line",{x1:"12",x2:"12",y1:"2",y2:"8.5",key:"2cldga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l7=U("Codesandbox",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"7.5 4.21 12 6.81 16.5 4.21",key:"fabo96"}],["polyline",{points:"7.5 19.79 7.5 14.6 3 12",key:"z377f1"}],["polyline",{points:"21 12 16.5 14.6 16.5 19.79",key:"9nrev1"}],["polyline",{points:"3.27 6.96 12 12.01 20.73 6.96",key:"1180pa"}],["line",{x1:"12",x2:"12",y1:"22.08",y2:"12",key:"3z3uq6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dj=U("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c7=U("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d7=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m2=U("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=U("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u7=U("Columns4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h7=U("Combine",[["path",{d:"M10 18H5a3 3 0 0 1-3-3v-1",key:"ru65g8"}],["path",{d:"M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"e30een"}],["path",{d:"M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"2ahx8o"}],["path",{d:"m7 21 3-3-3-3",key:"127cv2"}],["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f7=U("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p7=U("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m7=U("Component",[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g7=U("Computer",[["rect",{width:"14",height:"8",x:"5",y:"2",rx:"2",key:"wc9tft"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h2",key:"rwmk9e"}],["path",{d:"M12 18h6",key:"aqd8w3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x7=U("ConciergeBell",[["path",{d:"M3 20a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Z",key:"1pvr1r"}],["path",{d:"M20 16a8 8 0 1 0-16 0",key:"1pa543"}],["path",{d:"M12 4v4",key:"1bq03y"}],["path",{d:"M10 4h4",key:"1xpv9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y7=U("Cone",[["path",{d:"m20.9 18.55-8-15.98a1 1 0 0 0-1.8 0l-8 15.98",key:"53pte7"}],["ellipse",{cx:"12",cy:"19",rx:"9",ry:"3",key:"1ji25f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v7=U("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x2=U("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _7=U("Contact",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b7=U("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w7=U("Contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j7=U("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k7=U("CookingPot",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M20 12v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"u0tga0"}],["path",{d:"m4 8 16-4",key:"16g0ng"}],["path",{d:"m8.86 6.78-.45-1.81a2 2 0 0 1 1.45-2.43l1.94-.48a2 2 0 0 1 2.43 1.46l.45 1.8",key:"12cejc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N7=U("CopyCheck",[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S7=U("CopyMinus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C7=U("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M7=U("CopySlash",[["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T7=U("CopyX",[["line",{x1:"12",x2:"18",y1:"12",y2:"18",key:"1rg63v"}],["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jl=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A7=U("Copyleft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.17 14.83a4 4 0 1 0 0-5.66",key:"1sveal"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E7=U("Copyright",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I7=U("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P7=U("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L7=U("CornerLeftDown",[["polyline",{points:"14 15 9 20 4 15",key:"nkc4i"}],["path",{d:"M20 4h-7a4 4 0 0 0-4 4v12",key:"nbpdq2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O7=U("CornerLeftUp",[["polyline",{points:"14 9 9 4 4 9",key:"m9oyvo"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D7=U("CornerRightDown",[["polyline",{points:"10 15 15 20 20 15",key:"axus6l"}],["path",{d:"M4 4h7a4 4 0 0 1 4 4v12",key:"wcbgct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R7=U("CornerRightUp",[["polyline",{points:"10 9 15 4 20 9",key:"1lr6px"}],["path",{d:"M4 20h7a4 4 0 0 0 4-4V4",key:"1plgdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F7=U("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z7=U("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B7=U("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $7=U("CreativeCommons",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M10 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1ss3eq"}],["path",{d:"M17 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1od56t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hm=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U7=U("Croissant",[["path",{d:"m4.6 13.11 5.79-3.21c1.89-1.05 4.79 1.78 3.71 3.71l-3.22 5.81C8.8 23.16.79 15.23 4.6 13.11Z",key:"1ozxlb"}],["path",{d:"m10.5 9.5-1-2.29C9.2 6.48 8.8 6 8 6H4.5C2.79 6 2 6.5 2 8.5a7.71 7.71 0 0 0 2 4.83",key:"ffuyb5"}],["path",{d:"M8 6c0-1.55.24-4-2-4-2 0-2.5 2.17-2.5 4",key:"osnpzi"}],["path",{d:"m14.5 13.5 2.29 1c.73.3 1.21.7 1.21 1.5v3.5c0 1.71-.5 2.5-2.5 2.5a7.71 7.71 0 0 1-4.83-2",key:"1vubaw"}],["path",{d:"M18 16c1.55 0 4-.24 4 2 0 2-2.17 2.5-4 2.5",key:"wxr772"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q7=U("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V7=U("Cross",[["path",{d:"M4 9a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h4a1 1 0 0 1 1 1v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a1 1 0 0 1 1-1h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-4a1 1 0 0 1-1-1V4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4a1 1 0 0 1-1 1z",key:"1xbrqy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H7=U("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o1=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W7=U("Cuboid",[["path",{d:"m21.12 6.4-6.05-4.06a2 2 0 0 0-2.17-.05L2.95 8.41a2 2 0 0 0-.95 1.7v5.82a2 2 0 0 0 .88 1.66l6.05 4.07a2 2 0 0 0 2.17.05l9.95-6.12a2 2 0 0 0 .95-1.7V8.06a2 2 0 0 0-.88-1.66Z",key:"1u2ovd"}],["path",{d:"M10 22v-8L2.25 9.15",key:"11pn4q"}],["path",{d:"m10 14 11.77-6.87",key:"1kt1wh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G7=U("CupSoda",[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K7=U("Currency",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["line",{x1:"3",x2:"6",y1:"3",y2:"6",key:"1jkytn"}],["line",{x1:"21",x2:"18",y1:"3",y2:"6",key:"14zfjt"}],["line",{x1:"3",x2:"6",y1:"21",y2:"18",key:"iusuec"}],["line",{x1:"21",x2:"18",y1:"21",y2:"18",key:"yj2dd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z7=U("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y7=U("Dam",[["path",{d:"M11 11.31c1.17.56 1.54 1.69 3.5 1.69 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"157kva"}],["path",{d:"M11.75 18c.35.5 1.45 1 2.75 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"d7q6m6"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M7 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1L10 4a1 1 0 0 0-1-1z",key:"pr6s65"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X7=U("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q7=U("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J7=U("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e9=U("Delete",[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t9=U("Dessert",[["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["path",{d:"M10.2 3.2C5.5 4 2 8.1 2 13a2 2 0 0 0 4 0v-1a2 2 0 0 1 4 0v4a2 2 0 0 0 4 0v-4a2 2 0 0 1 4 0v1a2 2 0 0 0 4 0c0-4.9-3.5-9-8.2-9.8",key:"lfo06j"}],["path",{d:"M3.2 14.8a9 9 0 0 0 17.6 0",key:"12xarc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r9=U("Diameter",[["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}],["path",{d:"M6.48 3.66a10 10 0 0 1 13.86 13.86",key:"xr8kdq"}],["path",{d:"m6.41 6.41 11.18 11.18",key:"uhpjw7"}],["path",{d:"M3.66 6.48a10 10 0 0 0 13.86 13.86",key:"cldpwv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n9=U("DiamondMinus",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y2=U("DiamondPercent",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0Z",key:"1tpxz2"}],["path",{d:"M9.2 9.2h.01",key:"1b7bvt"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"M14.7 14.8h.01",key:"17nsh4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s9=U("DiamondPlus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i9=U("Diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a9=U("Dice1",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o9=U("Dice2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l9=U("Dice3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c9=U("Dice4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d9=U("Dice5",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u9=U("Dice6",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h9=U("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f9=U("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p9=U("Disc2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m9=U("Disc3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g9=U("DiscAlbum",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"5",key:"nd82uf"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x9=U("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y9=U("Divide",[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v9=U("DnaOff",[["path",{d:"M15 2c-1.35 1.5-2.092 3-2.5 4.5L14 8",key:"1bivrr"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c3.333-3 6.667-3 10-3",key:"nxix30"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M22 9c-1.5 1.35-3 2.092-4.5 2.5l-1-1",key:"18cutr"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.35-1.5 2.092-3 2.5-4.5L10 16",key:"rlvei3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _9=U("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b9=U("Dock",[["path",{d:"M2 8h20",key:"d11cs7"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 16h12",key:"u522kt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w9=U("Dog",[["path",{d:"M11.25 16.25h1.5L12 17z",key:"w7jh35"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309",key:"u7s9ue"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5",key:"v8hric"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ud=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j9=U("Donut",[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3",key:"19sr3x"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k9=U("DoorClosed",[["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M14 12v.01",key:"xfcn54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l1=U("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N9=U("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xa=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S9=U("DraftingCompass",[["path",{d:"m12.99 6.74 1.93 3.44",key:"iwagvd"}],["path",{d:"M19.136 12a10 10 0 0 1-14.271 0",key:"ppmlo4"}],["path",{d:"m21 21-2.16-3.84",key:"vylbct"}],["path",{d:"m3 21 8.02-14.26",key:"1ssaw4"}],["circle",{cx:"12",cy:"5",r:"2",key:"f1ur92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C9=U("Drama",[["path",{d:"M10 11h.01",key:"d2at3l"}],["path",{d:"M14 6h.01",key:"k028ub"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6.5 13.1h.01",key:"1748ia"}],["path",{d:"M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3",key:"172yzv"}],["path",{d:"M17.4 9.9c-.8.8-2 .8-2.8 0",key:"1obv0w"}],["path",{d:"M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7",key:"rqjl8i"}],["path",{d:"M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4",key:"1mr6wy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M9=U("Dribbble",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M19.13 5.09C15.22 9.14 10 10.44 2.25 10.94",key:"hpej1"}],["path",{d:"M21.75 12.84c-6.62-1.41-12.14 1-16.38 6.32",key:"1tr44o"}],["path",{d:"M8.56 2.75c4.37 6 6 9.42 8 17.72",key:"kbh691"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T9=U("Drill",[["path",{d:"M10 18a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H5a3 3 0 0 1-3-3 1 1 0 0 1 1-1z",key:"ioqxb1"}],["path",{d:"M13 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1l-.81 3.242a1 1 0 0 1-.97.758H8",key:"1rs59n"}],["path",{d:"M14 4h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-3",key:"105ega"}],["path",{d:"M18 6h4",key:"66u95g"}],["path",{d:"m5 10-2 8",key:"xt2lic"}],["path",{d:"m7 18 2-8",key:"1bzku2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A9=U("Droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=U("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I9=U("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P9=U("Drumstick",[["path",{d:"M15.4 15.63a7.875 6 135 1 1 6.23-6.23 4.5 3.43 135 0 0-6.23 6.23",key:"1dtqwm"}],["path",{d:"m8.29 12.71-2.6 2.6a2.5 2.5 0 1 0-1.65 4.65A2.5 2.5 0 1 0 8.7 18.3l2.59-2.59",key:"1oq1fw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L9=U("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O9=U("EarOff",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D9=U("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R9=U("EarthLock",[["path",{d:"M7 3.34V5a3 3 0 0 0 3 3",key:"w732o8"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"f02343"}],["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M12 2a10 10 0 1 0 9.54 13",key:"zjsr6q"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F9=U("Eclipse",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a7 7 0 1 0 10 10",key:"1yuj32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z9=U("EggFried",[["circle",{cx:"11.5",cy:"12.5",r:"3.5",key:"1cl1mi"}],["path",{d:"M3 8c0-3.5 2.5-6 6.5-6 5 0 4.83 3 7.5 5s5 2 5 6c0 4.5-2.5 6.5-7 6.5-2.5 0-2.5 2.5-6 2.5s-7-2-7-5.5c0-3 1.5-3 1.5-5C3.5 10 3 9 3 8Z",key:"165ef9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B9=U("EggOff",[["path",{d:"M6.399 6.399C5.362 8.157 4.65 10.189 4.5 12c-.37 4.43 1.27 9.95 7.5 10 3.256-.026 5.259-1.547 6.375-3.625",key:"6et380"}],["path",{d:"M19.532 13.875A14.07 14.07 0 0 0 19.5 12c-.36-4.34-3.95-9.96-7.5-10-1.04.012-2.082.502-3.046 1.297",key:"gcdc3f"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J4=U("Egg",[["path",{d:"M12 22c6.23-.05 7.87-5.57 7.5-10-.36-4.34-3.95-9.96-7.5-10-3.55.04-7.14 5.66-7.5 10-.37 4.43 1.27 9.95 7.5 10z",key:"1c39pg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sx=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const og=U("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $9=U("EqualApproximately",[["path",{d:"M5 15a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"yrdkhy"}],["path",{d:"M5 9a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"gzkvyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U9=U("EqualNot",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}],["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q9=U("Equal",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V9=U("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H9=U("EthernetPort",[["path",{d:"m15 20 3-3h2a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h2l3 3z",key:"rbahqx"}],["path",{d:"M6 8v1",key:"1636ez"}],["path",{d:"M10 8v1",key:"1talb4"}],["path",{d:"M14 8v1",key:"1rsfgr"}],["path",{d:"M18 8v1",key:"gnkwox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W9=U("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G9=U("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ls=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K9=U("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c1=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qo=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pd=U("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z9=U("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y9=U("Fan",[["path",{d:"M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z",key:"484a7f"}],["path",{d:"M12 12v.01",key:"u5ubse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X9=U("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q9=U("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J9=U("Fence",[["path",{d:"M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"1n2rgs"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M6 18h4",key:"12yh4b"}],["path",{d:"m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"3ha7mj"}],["path",{d:"M14 8h4",key:"1r8wg2"}],["path",{d:"M14 18h4",key:"1t3kbu"}],["path",{d:"m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"dfd4e2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eB=U("FerrisWheel",[["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m6.8 15-3.5 2",key:"hjy98k"}],["path",{d:"m20.7 7-3.5 2",key:"f08gto"}],["path",{d:"M6.8 9 3.3 7",key:"1aevh4"}],["path",{d:"m20.7 17-3.5-2",key:"1liqo3"}],["path",{d:"m9 22 3-8 3 8",key:"wees03"}],["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M18 18.7a9 9 0 1 0-12 0",key:"dhzg4g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tB=U("Figma",[["path",{d:"M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z",key:"1340ok"}],["path",{d:"M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z",key:"1hz3m3"}],["path",{d:"M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z",key:"1oz8n2"}],["path",{d:"M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z",key:"1ff65i"}],["path",{d:"M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z",key:"pdip6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rB=U("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nB=U("FileAudio2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"3",cy:"17",r:"1",key:"vo6nti"}],["path",{d:"M2 17v-3a4 4 0 0 1 8 0v3",key:"1ggdre"}],["circle",{cx:"9",cy:"17",r:"1",key:"bc1fq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sB=U("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _2=U("FileAxis3d",[["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:"m8 18 4-4",key:"12zab0"}],["path",{d:"M8 10v8h8",key:"tlaukw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iB=U("FileBadge2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14 12.5 1 5.5-3-1-3 1 1-5.5",key:"14xlky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aB=U("FileBadge",[["path",{d:"M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"12ixgl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M5 17a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"u0c8gj"}],["path",{d:"M7 16.5 8 22l-3-1-3 1 1-5.5",key:"5gm2nr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oB=U("FileBox",[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=U("FileChartColumnIncreasing",[["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:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w2=U("FileChartColumn",[["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:"M8 18v-1",key:"zg0ygc"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"M16 18v-3",key:"j5jt4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j2=U("FileChartLine",[["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:"m16 13-3.5 3.5-2-2L8 17",key:"zz7yod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k2=U("FileChartPie",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3.5",key:"13ddob"}],["path",{d:"M4.017 11.512a6 6 0 1 0 8.466 8.475",key:"s6vs5t"}],["path",{d:"M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",key:"1dl6s6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lB=U("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cB=U("FileCheck",[["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:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dB=U("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uB=U("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hB=U("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N2=U("FileCog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fB=U("FileDiff",[["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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pB=U("FileDigit",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"4",height:"6",x:"2",y:"12",rx:"2",key:"jm304g"}],["path",{d:"M10 12h2v6",key:"12zw74"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mB=U("FileDown",[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gB=U("FileHeart",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10.29 10.7a2.43 2.43 0 0 0-2.66-.52c-.29.12-.56.3-.78.53l-.35.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L6.5 18l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1c1fso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d1=U("FileImage",[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xB=U("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yB=U("FileJson2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"fq0c9t"}],["path",{d:"M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"4gibmv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vB=U("FileJson",[["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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _B=U("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bB=U("FileKey",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"10",cy:"16",r:"2",key:"4ckbqe"}],["path",{d:"m16 10-4.5 4.5",key:"7p3ebg"}],["path",{d:"m15 11 1 1",key:"1bsyx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wB=U("FileLock2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jB=U("FileLock",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["rect",{width:"8",height:"6",x:"8",y:"12",rx:"1",key:"3yr8at"}],["path",{d:"M10 12v-2a2 2 0 1 1 4 0v2",key:"j4i8d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kB=U("FileMinus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NB=U("FileMinus",[["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:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SB=U("FileMusic",[["path",{d:"M10.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v8.4",key:"1d3kfm"}],["path",{d:"M8 18v-7.7L16 9v7",key:"1oie6o"}],["circle",{cx:"14",cy:"16",r:"2",key:"1bzzi3"}],["circle",{cx:"6",cy:"18",r:"2",key:"1fncim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CB=U("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S2=U("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C2=U("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MB=U("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TB=U("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AB=U("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EB=U("FileScan",[["path",{d:"M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4",key:"1rdf37"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 14a2 2 0 0 0-2 2",key:"ceaadl"}],["path",{d:"M20 14a2 2 0 0 1 2 2",key:"1ny6zw"}],["path",{d:"M20 22a2 2 0 0 0 2-2",key:"1l9q4k"}],["path",{d:"M16 22a2 2 0 0 1-2-2",key:"1wqh5n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IB=U("FileSearch2",[["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"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PB=U("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LB=U("FileSliders",[["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:"M8 12h8",key:"1wcyev"}],["path",{d:"M10 11v2",key:"1s651w"}],["path",{d:"M8 17h8",key:"wh5c61"}],["path",{d:"M14 16v2",key:"12fp5e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u1=U("FileSpreadsheet",[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OB=U("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DB=U("FileSymlink",[["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"50q2rw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RB=U("FileTerminal",[["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:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ai=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FB=U("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zB=U("FileType",[["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:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BB=U("FileUp",[["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:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $B=U("FileUser",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 18a3 3 0 1 0-6 0",key:"16awa0"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UB=U("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qB=U("FileVideo",[["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 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VB=U("FileVolume2",[["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:"M8 15h.01",key:"a7atzg"}],["path",{d:"M11.5 13.5a2.5 2.5 0 0 1 0 3",key:"1fccat"}],["path",{d:"M15 12a5 5 0 0 1 0 6",key:"ps46cm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HB=U("FileVolume",[["path",{d:"M11 11a5 5 0 0 1 0 6",key:"193qb2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 6.765V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-.93-.23",key:"ifyjnl"}],["path",{d:"M7 10.51a.5.5 0 0 0-.826-.38l-1.893 1.628A1 1 0 0 1 3.63 12H2.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h1.129a1 1 0 0 1 .652.242l1.893 1.63a.5.5 0 0 0 .826-.38z",key:"mk8rxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WB=U("FileWarning",[["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:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GB=U("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KB=U("FileX",[["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:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZB=U("File",[["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YB=U("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Md=U("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XB=U("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uj=U("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QB=U("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JB=U("FireExtinguisher",[["path",{d:"M15 6.5V3a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3.5",key:"sqyvz"}],["path",{d:"M9 18h8",key:"i7pszb"}],["path",{d:"M18 3h-3",key:"7idoqj"}],["path",{d:"M11 3a6 6 0 0 0-6 6v11",key:"1v5je3"}],["path",{d:"M5 13h4",key:"svpcxo"}],["path",{d:"M17 10a4 4 0 0 0-8 0v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2Z",key:"vsjego"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e$=U("FishOff",[["path",{d:"M18 12.47v.03m0-.5v.47m-.475 5.056A6.744 6.744 0 0 1 15 18c-3.56 0-7.56-2.53-8.5-6 .348-1.28 1.114-2.433 2.121-3.38m3.444-2.088A8.802 8.802 0 0 1 15 6c3.56 0 6.06 2.54 7 6-.309 1.14-.786 2.177-1.413 3.058",key:"1j1hse"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33m7.48-4.372A9.77 9.77 0 0 1 16 6.07m0 11.86a9.77 9.77 0 0 1-1.728-3.618",key:"1q46z8"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98M8.53 3h5.27a2 2 0 0 1 1.98 1.67l.23 1.4M2 2l20 20",key:"1407gh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t$=U("FishSymbol",[["path",{d:"M2 16s9-15 20-4C11 23 2 8 2 8",key:"h4oh4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r$=U("Fish",[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n$=U("FlagOff",[["path",{d:"M8 2c3 0 5 2 8 2s4-1 4-1v11",key:"9rwyz9"}],["path",{d:"M4 22V4",key:"1plyxx"}],["path",{d:"M4 15s1-1 4-1 5 2 8 2",key:"1myooe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s$=U("FlagTriangleLeft",[["path",{d:"M17 22V2L7 7l10 5",key:"1rmf0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i$=U("FlagTriangleRight",[["path",{d:"M7 22V2l10 5-10 5",key:"17n18y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bx=U("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a$=U("FlameKindling",[["path",{d:"M12 2c1 3 2.5 3.5 3.5 4.5A5 5 0 0 1 17 10a5 5 0 1 1-10 0c0-.3 0-.6.1-.9a2 2 0 1 0 3.3-2C8 4.5 11 2 12 2Z",key:"1ir223"}],["path",{d:"m5 22 14-4",key:"1brv4h"}],["path",{d:"m5 18 14 4",key:"lgyyje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kh=U("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o$=U("FlashlightOff",[["path",{d:"M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4",key:"1r120k"}],["path",{d:"M7 2h11v4c0 2-2 2-2 4v1",key:"dz1920"}],["line",{x1:"11",x2:"18",y1:"6",y2:"6",key:"bi1vpe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l$=U("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c$=U("FlaskConicalOff",[["path",{d:"M10 10 4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-1.272-2.542",key:"59ek9y"}],["path",{d:"M10 2v2.343",key:"15t272"}],["path",{d:"M14 2v6.343",key:"sxr80q"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h9",key:"t5njau"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hj=U("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d$=U("FlaskRound",[["path",{d:"M10 2v7.31",key:"5d1hyh"}],["path",{d:"M14 9.3V1.99",key:"14k4l0"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14 9.3a6.5 6.5 0 1 1-4 0",key:"1r8fvy"}],["path",{d:"M5.52 16h12.96",key:"46hh1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u$=U("FlipHorizontal2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h$=U("FlipHorizontal",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f$=U("FlipVertical2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p$=U("FlipVertical",[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const im=U("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m$=U("Flower",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g$=U("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x$=U("FoldHorizontal",[["path",{d:"M2 12h6",key:"1wqiqv"}],["path",{d:"M22 12h-6",key:"1eg9hc"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 9-3 3 3 3",key:"12ol22"}],["path",{d:"m5 15 3-3-3-3",key:"1kdhjc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y$=U("FoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v$=U("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _$=U("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b$=U("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w$=U("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j$=U("FolderCode",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M2=U("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k$=U("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N$=U("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S$=U("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C$=U("FolderGit",[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M$=U("FolderHeart",[["path",{d:"M11 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1.5",key:"6hud8k"}],["path",{d:"M13.9 17.45c-1.2-1.2-1.14-2.8-.2-3.73a2.43 2.43 0 0 1 3.44 0l.36.34.34-.34a2.43 2.43 0 0 1 3.45-.01c.95.95 1 2.53-.2 3.74L17.5 21Z",key:"wpff58"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T$=U("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A$=U("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E$=U("FolderKey",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I$=U("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P$=U("FolderMinus",[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L$=U("FolderOpenDot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $x=U("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O$=U("FolderOutput",[["path",{d:"M2 7.5V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-1.5",key:"1yk7aj"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m5 10-3 3 3 3",key:"1r8ie0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T2=U("FolderPen",[["path",{d:"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5",key:"a8xqs0"}],["path",{d:"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1saktj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D$=U("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R$=U("FolderRoot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M12 15v5",key:"11xva1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F$=U("FolderSearch2",[["circle",{cx:"11.5",cy:"12.5",r:"2.5",key:"1ea5ju"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M13.3 14.3 15 16",key:"1y4v1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z$=U("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B$=U("FolderSymlink",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"x1c07l"}],["path",{d:"m8 16 3-3-3-3",key:"rlqrt1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $$=U("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U$=U("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q$=U("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V$=U("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H$=U("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W$=U("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G$=U("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K$=U("Forklift",[["path",{d:"M12 12H5a2 2 0 0 0-2 2v5",key:"7zsz91"}],["circle",{cx:"13",cy:"19",r:"2",key:"wjnkru"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M8 19h3m5-17v17h6M6 12V7c0-1.1.9-2 2-2h3l5 5",key:"13bk1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z$=U("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y$=U("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X$=U("Framer",[["path",{d:"M5 16V9h14V2H5l14 14h-7m-7 0 7 7v-7m-7 0h7",key:"1a2nng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q$=U("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J$=U("Fuel",[["line",{x1:"3",x2:"15",y1:"22",y2:"22",key:"xegly4"}],["line",{x1:"4",x2:"14",y1:"9",y2:"9",key:"xcnuvu"}],["path",{d:"M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18",key:"16j0yd"}],["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 2 2a2 2 0 0 0 2-2V9.83a2 2 0 0 0-.59-1.42L18 5",key:"7cu91f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eU=U("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tU=U("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rU=U("GalleryHorizontal",[["path",{d:"M2 3v18",key:"pzttux"}],["rect",{width:"12",height:"18",x:"6",y:"3",rx:"2",key:"btr8bg"}],["path",{d:"M22 3v18",key:"6jf3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nU=U("GalleryThumbnails",[["rect",{width:"18",height:"14",x:"3",y:"3",rx:"2",key:"74y24f"}],["path",{d:"M4 21h1",key:"16zlid"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M19 21h1",key:"edywat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sU=U("GalleryVerticalEnd",[["path",{d:"M7 2h10",key:"nczekb"}],["path",{d:"M5 6h14",key:"u2x4p"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iU=U("GalleryVertical",[["path",{d:"M3 2h18",key:"15qxfx"}],["rect",{width:"18",height:"12",x:"3",y:"6",rx:"2",key:"1439r6"}],["path",{d:"M3 22h18",key:"8prr45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aU=U("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oU=U("Gamepad",[["line",{x1:"6",x2:"10",y1:"12",y2:"12",key:"161bw2"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"15",x2:"15.01",y1:"13",y2:"13",key:"dqpgro"}],["line",{x1:"18",x2:"18.01",y1:"11",y2:"11",key:"meh2c"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lU=U("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cU=U("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dU=U("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fj=U("Ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Va=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uU=U("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hU=U("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A2=U("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fU=U("GitCommitVertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pU=U("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mU=U("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gU=U("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xU=U("GitGraph",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yU=U("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vU=U("GitPullRequestArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _U=U("GitPullRequestClosed",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bU=U("GitPullRequestCreateArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v3",key:"1rbwk6"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M22 18h-6",key:"1d5gi5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wU=U("GitPullRequestCreate",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jU=U("GitPullRequestDraft",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kU=U("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NU=U("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SU=U("Gitlab",[["path",{d:"m22 13.29-3.33-10a.42.42 0 0 0-.14-.18.38.38 0 0 0-.22-.11.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18l-2.26 6.67H8.32L6.1 3.26a.42.42 0 0 0-.1-.18.38.38 0 0 0-.26-.08.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18L2 13.29a.74.74 0 0 0 .27.83L12 21l9.69-6.88a.71.71 0 0 0 .31-.83Z",key:"148pdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CU=U("GlassWater",[["path",{d:"M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79z",key:"p55z4y"}],["path",{d:"M6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0",key:"mjntcy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MU=U("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TU=U("GlobeLock",[["path",{d:"M15.686 15A14.5 14.5 0 0 1 12 22a14.5 14.5 0 0 1 0-20 10 10 0 1 0 9.542 13",key:"qkt0x6"}],["path",{d:"M2 12h8.5",key:"ovaggd"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ux=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AU=U("Goal",[["path",{d:"M12 13V2l8 4-8 4",key:"5wlwwj"}],["path",{d:"M20.561 10.222a9 9 0 1 1-12.55-5.29",key:"1c0wjv"}],["path",{d:"M8.002 9.997a5 5 0 1 0 8.9 2.02",key:"gb1g7m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EU=U("Grab",[["path",{d:"M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"edstyy"}],["path",{d:"M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"19wdwo"}],["path",{d:"M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"1lugqo"}],["path",{d:"M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1hbeus"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0",key:"1etffm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h1=U("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IU=U("Grape",[["path",{d:"M22 5V2l-5.89 5.89",key:"1eenpo"}],["circle",{cx:"16.6",cy:"15.89",r:"3",key:"xjtalx"}],["circle",{cx:"8.11",cy:"7.4",r:"3",key:"u2fv6i"}],["circle",{cx:"12.35",cy:"11.65",r:"3",key:"i6i8g7"}],["circle",{cx:"13.91",cy:"5.85",r:"3",key:"6ye0dv"}],["circle",{cx:"18.15",cy:"10.09",r:"3",key:"snx9no"}],["circle",{cx:"6.56",cy:"13.2",r:"3",key:"17x4xg"}],["circle",{cx:"10.8",cy:"17.44",r:"3",key:"1hogw9"}],["circle",{cx:"5",cy:"19",r:"3",key:"1sn6vo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PU=U("Grid2x2Check",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E2=U("Grid2x2Plus",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 22v-6",key:"qhmiwi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LU=U("Grid2x2X",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I2=U("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oh=U("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OU=U("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pj=U("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DU=U("Grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RU=U("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FU=U("Guitar",[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-.8 2.3-1.9 2.8l-.9.4A2 2 0 0 0 12 18a4 4 0 0 1-4 4c-3.3 0-6-2.7-6-6a4 4 0 0 1 4-4 2 2 0 0 0 1.8-1.2z",key:"1u8q3z"}],["circle",{cx:"11.5",cy:"12.5",r:".5",fill:"currentColor",key:"16onso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zU=U("Ham",[["path",{d:"M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856",key:"1k1t7q"}],["path",{d:"M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288",key:"153t1g"}],["path",{d:"M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025",key:"gzrt0n"}],["path",{d:"m8.5 16.5-1-1",key:"otr954"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BU=U("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $U=U("HandCoins",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UU=U("HandHeart",[["path",{d:"M11 14h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16",key:"1ifwr1"}],["path",{d:"m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"17abbs"}],["path",{d:"m2 15 6 6",key:"10dquu"}],["path",{d:"M19.5 8.5c.7-.7 1.5-1.6 1.5-2.7A2.73 2.73 0 0 0 16 4a2.78 2.78 0 0 0-5 1.8c0 1.2.8 2 1.5 2.8L16 12Z",key:"1h3036"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P2=U("HandHelping",[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qU=U("HandMetal",[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"wc6myp"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2",key:"94qvcw"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9",key:"m1ah89"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5",key:"t1skq1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VU=U("HandPlatter",[["path",{d:"M12 3V2",key:"ar7q03"}],["path",{d:"m15.4 17.4 3.2-2.8a2 2 0 1 1 2.8 2.9l-3.6 3.3c-.7.8-1.7 1.2-2.8 1.2h-4c-1.1 0-2.1-.4-2.8-1.2l-1.302-1.464A1 1 0 0 0 6.151 19H5",key:"n2g93r"}],["path",{d:"M2 14h12a2 2 0 0 1 0 4h-2",key:"1o2jem"}],["path",{d:"M4 10h16",key:"img6z1"}],["path",{d:"M5 10a7 7 0 0 1 14 0",key:"1ega1o"}],["path",{d:"M5 14v6a1 1 0 0 1-1 1H2",key:"1hescx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HU=U("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WU=U("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GU=U("HardDriveDownload",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KU=U("HardDriveUpload",[["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M12 2v8",key:"1q4o3n"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AT=U("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZU=U("HardHat",[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eS=U("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YU=U("Haze",[["path",{d:"m5.2 6.2 1.4 1.4",key:"17imol"}],["path",{d:"M2 13h2",key:"13gyu8"}],["path",{d:"M20 13h2",key:"16rner"}],["path",{d:"m17.4 7.6 1.4-1.4",key:"t4xlah"}],["path",{d:"M22 17H2",key:"1gtaj3"}],["path",{d:"M22 21H2",key:"1gy6en"}],["path",{d:"M16 13a4 4 0 0 0-8 0",key:"1dyczq"}],["path",{d:"M12 5V2.5",key:"1vytko"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XU=U("HdmiPort",[["path",{d:"M22 9a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h1l2 2h12l2-2h1a1 1 0 0 0 1-1Z",key:"2128wb"}],["path",{d:"M7.5 12h9",key:"1t0ckc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ET=U("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IT=U("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QU=U("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JU=U("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eq=U("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tq=U("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rq=U("Heading",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nq=U("HeadphoneOff",[["path",{d:"M21 14h-1.343",key:"1jdnxi"}],["path",{d:"M9.128 3.47A9 9 0 0 1 21 12v3.343",key:"6kipu2"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3",key:"9x50f4"}],["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364",key:"1bkxnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sq=U("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iq=U("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aq=U("HeartCrack",[["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"}],["path",{d:"m12 13-1-1 2-2-3-3 2-2",key:"xjdxli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oq=U("HeartHandshake",[["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"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lq=U("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cq=U("HeartPulse",[["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"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oa=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dq=U("Heater",[["path",{d:"M11 8c2-3-2-3 0-6",key:"1ldv5m"}],["path",{d:"M15.5 8c2-3-2-3 0-6",key:"1otqoz"}],["path",{d:"M6 10h.01",key:"1lbq93"}],["path",{d:"M6 14h.01",key:"zudwn7"}],["path",{d:"M10 16v-4",key:"1c25yv"}],["path",{d:"M14 16v-4",key:"1dkbt8"}],["path",{d:"M18 16v-4",key:"1yg9me"}],["path",{d:"M20 6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3",key:"1ubg90"}],["path",{d:"M5 20v2",key:"1abpe8"}],["path",{d:"M19 20v2",key:"kqn6ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uq=U("Hexagon",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hq=U("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tS=U("History",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fq=U("HopOff",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.28.01.53-.09.7-.27",key:"qyzcap"}],["path",{d:"M11.14 20.57c.52.24 2.44 1.12 4.08 1.37.46.06.86-.25.9-.71.12-1.52-.3-3.43-.5-4.28",key:"y078lb"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .7-.26",key:"1utre3"}],["path",{d:"M17.99 5.52a20.83 20.83 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-1.17.1-2.5.02-3.9-.25",key:"17o9hm"}],["path",{d:"M20.57 11.14c.24.52 1.12 2.44 1.37 4.08.04.3-.08.59-.31.75",key:"1d1n4p"}],["path",{d:"M4.93 4.93a10 10 0 0 0-.67 13.4c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.85.85 0 0 0 .48-.24",key:"9uv3tt"}],["path",{d:"M5.52 17.99c1.05.95 2.91 2.42 4.5 3.15a.8.8 0 0 0 1.13-.68c.2-2.34-.33-5.3-1.57-8.28",key:"1292wz"}],["path",{d:"M8.35 2.68a10 10 0 0 1 9.98 1.58c.43.35.4.96-.12 1.17-1.5.6-4.3.98-6.07 1.05",key:"7ozu9p"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pq=U("Hop",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.55.03 1-.42.97-.97-.06-1.27-.26-3.5-.85-5.18",key:"18lxf1"}],["path",{d:"M11.5 6.5c1.64 0 5-.38 6.71-1.07.52-.2.55-.82.12-1.17A10 10 0 0 0 4.26 18.33c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.88.88 0 0 0 .73-.74c.3-2.14-.15-3.5-.61-4.88",key:"vtfxrw"}],["path",{d:"M15.62 16.95c.2.85.62 2.76.5 4.28a.77.77 0 0 1-.9.7 16.64 16.64 0 0 1-4.08-1.36",key:"13hl71"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .96-.96 17.68 17.68 0 0 0-.9-4.87",key:"1sl8oj"}],["path",{d:"M16.94 15.62c.86.2 2.77.62 4.29.5a.77.77 0 0 0 .7-.9 16.64 16.64 0 0 0-1.36-4.08",key:"19c6kt"}],["path",{d:"M17.99 5.52a20.82 20.82 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-2.33.2-5.3-.32-8.27-1.57",key:"85ghs3"}],["path",{d:"M4.93 4.93 3 3a.7.7 0 0 1 0-1",key:"x087yj"}],["path",{d:"M9.58 12.18c1.24 2.98 1.77 5.95 1.57 8.28a.8.8 0 0 1-1.13.68 20.82 20.82 0 0 1-4.5-3.15",key:"11xdqo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mq=U("Hospital",[["path",{d:"M12 6v4",key:"16clxf"}],["path",{d:"M14 14h-4",key:"esezmu"}],["path",{d:"M14 18h-4",key:"16mqa2"}],["path",{d:"M14 8h-4",key:"z8ypaz"}],["path",{d:"M18 12h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h2",key:"b1k337"}],["path",{d:"M18 22V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v18",key:"16g51d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gq=U("Hotel",[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xq=U("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yq=U("HousePlug",[["path",{d:"M10 12V8.964",key:"1vll13"}],["path",{d:"M14 12V8.964",key:"1x3qvg"}],["path",{d:"M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z",key:"ppykja"}],["path",{d:"M8.5 21H5a2 2 0 0 1-2-2v-9a2 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 2h-5a2 2 0 0 1-2-2v-2",key:"1gvg2z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vq=U("HousePlus",[["path",{d:"M13.22 2.416a2 2 0 0 0-2.511.057l-7 5.999A2 2 0 0 0 3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7.354",key:"5phn05"}],["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 3v6",key:"x1uolp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fi=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L2=U("IceCreamBowl",[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O2=U("IceCreamCone",[["path",{d:"m7 11 4.08 10.35a1 1 0 0 0 1.84 0L17 11",key:"1v6356"}],["path",{d:"M17 7A5 5 0 0 0 7 7",key:"151p3v"}],["path",{d:"M17 7a2 2 0 0 1 0 4H7a2 2 0 0 1 0-4",key:"1sdaij"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _q=U("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bq=U("ImageDown",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19 3 3v-5.5",key:"9ldu5r"}],["path",{d:"m17 22 3-3",key:"1nkfve"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wq=U("ImageMinus",[["path",{d:"M21 9v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"m87ecr"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jq=U("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kq=U("ImagePlay",[["path",{d:"m11 16-5 5",key:"j5f7ct"}],["path",{d:"M11 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6.5",key:"7s81lt"}],["path",{d:"M15.765 22a.5.5 0 0 1-.765-.424V13.38a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"1omb6s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rS=U("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nq=U("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sq=U("ImageUpscale",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M17 21h2a2 2 0 0 0 2-2",key:"130fy9"}],["path",{d:"M21 12v3",key:"1wzk3p"}],["path",{d:"m21 3-5 5",key:"1g5oa7"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2",key:"kk3yz1"}],["path",{d:"m5 21 4.144-4.144a1.21 1.21 0 0 1 1.712 0L13 19",key:"fyekpt"}],["path",{d:"M9 3h3",key:"d52fa"}],["rect",{x:"3",y:"11",width:"10",height:"10",rx:"1",key:"1wpmix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zo=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cq=U("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mq=U("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tq=U("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D2=U("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R2=U("IndentIncrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aq=U("IndianRupee",[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eq=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iq=U("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pq=U("InspectionPanel",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h.01",key:"7u93v4"}],["path",{d:"M17 7h.01",key:"14a9sn"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eu=U("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nS=U("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lq=U("IterationCcw",[["path",{d:"M20 10c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8h8",key:"4znkd0"}],["polyline",{points:"16 14 20 18 16 22",key:"11njsm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oq=U("IterationCw",[["path",{d:"M4 10c0-4.4 3.6-8 8-8s8 3.6 8 8-3.6 8-8 8H4",key:"tuf4su"}],["polyline",{points:"8 22 4 18 8 14",key:"evkj9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dq=U("JapaneseYen",[["path",{d:"M12 9.5V21m0-11.5L6 3m6 6.5L18 3",key:"2ej80x"}],["path",{d:"M6 15h12",key:"1hwgt5"}],["path",{d:"M6 11h12",key:"wf4gp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rq=U("Joystick",[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f1=U("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mj=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fq=U("KeySquare",[["path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z",key:"165ttr"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"m9.4 10.6-6.814 6.814A2 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-.814",key:"1ubxi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zh=U("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zq=U("KeyboardMusic",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M6 12v4",key:"dy92yo"}],["path",{d:"M10 12v4",key:"1fxnav"}],["path",{d:"M14 12v4",key:"1hft58"}],["path",{d:"M18 12v4",key:"tjjnbz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bq=U("KeyboardOff",[["path",{d:"M 20 4 A2 2 0 0 1 22 6",key:"1g1fkt"}],["path",{d:"M 22 6 L 22 16.41",key:"1qjg3w"}],["path",{d:"M 7 16 L 16 16",key:"n0yqwb"}],["path",{d:"M 9.69 4 L 20 4",key:"kbpcgx"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2",key:"s23sx2"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M8 12h.01",key:"czm47f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $q=U("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uq=U("LampCeiling",[["path",{d:"M12 2v5",key:"nd4vlx"}],["path",{d:"M6 7h12l4 9H2l4-9Z",key:"123d64"}],["path",{d:"M9.17 16a3 3 0 1 0 5.66 0",key:"1061mw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qq=U("LampDesk",[["path",{d:"m14 5-3 3 2 7 8-8-7-2Z",key:"1b0msb"}],["path",{d:"m14 5-3 3-3-3 3-3 3 3Z",key:"1uemms"}],["path",{d:"M9.5 6.5 4 12l3 6",key:"1bx08v"}],["path",{d:"M3 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H3Z",key:"wap775"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vq=U("LampFloor",[["path",{d:"M9 2h6l3 7H6l3-7Z",key:"wcx6mj"}],["path",{d:"M12 9v13",key:"3n1su1"}],["path",{d:"M9 22h6",key:"1rlq3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hq=U("LampWallDown",[["path",{d:"M11 13h6l3 7H8l3-7Z",key:"9n3qlo"}],["path",{d:"M14 13V8a2 2 0 0 0-2-2H8",key:"1hu4hb"}],["path",{d:"M4 9h2a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H4v6Z",key:"s053bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wq=U("LampWallUp",[["path",{d:"M11 4h6l3 7H8l3-7Z",key:"11x1ee"}],["path",{d:"M14 11v5a2 2 0 0 1-2 2H8",key:"eutp5o"}],["path",{d:"M4 15h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H4v-6Z",key:"1iuthr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gq=U("Lamp",[["path",{d:"M8 2h8l4 10H4L8 2Z",key:"9dma5w"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M8 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H8Z",key:"mwf4oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kq=U("LandPlot",[["path",{d:"m12 8 6-3-6-3v10",key:"mvpnpy"}],["path",{d:"m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",key:"ek95tt"}],["path",{d:"m6.49 12.85 11.02 6.3",key:"1kt42w"}],["path",{d:"M17.51 12.85 6.5 19.15",key:"v55bdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zq=U("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yq=U("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xq=U("LaptopMinimalCheck",[["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{x:"3",y:"4",width:"18",height:"12",rx:"2",key:"8ur36m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F2=U("LaptopMinimal",[["rect",{width:"18",height:"12",x:"3",y:"4",rx:"2",ry:"2",key:"1qhy41"}],["line",{x1:"2",x2:"22",y1:"20",y2:"20",key:"ni3hll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qq=U("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jq=U("LassoSelect",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M7 16.93c.96.43 1.96.74 2.99.91",key:"ybbtv3"}],["path",{d:"M3.34 14A6.8 6.8 0 0 1 2 10c0-4.42 4.48-8 10-8s10 3.58 10 8a7.19 7.19 0 0 1-.33 2",key:"gt5e1w"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}],["path",{d:"M14.33 22h-.09a.35.35 0 0 1-.24-.32v-10a.34.34 0 0 1 .33-.34c.08 0 .15.03.21.08l7.34 6a.33.33 0 0 1-.21.59h-4.49l-2.57 3.85a.35.35 0 0 1-.28.14z",key:"72q637"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eV=U("Lasso",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",key:"146dds"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tV=U("Laugh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rV=U("Layers2",[["path",{d:"m16.02 12 5.48 3.13a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74L7.98 12",key:"1cuww1"}],["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74Z",key:"pdlvxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nV=U("Layers3",[["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:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sV=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fm=U("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iV=U("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aV=U("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oV=U("LayoutPanelTop",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lV=U("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cV=U("Leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dV=U("LeafyGreen",[["path",{d:"M2 22c1.25-.987 2.27-1.975 3.9-2.2a5.56 5.56 0 0 1 3.8 1.5 4 4 0 0 0 6.187-2.353 3.5 3.5 0 0 0 3.69-5.116A3.5 3.5 0 0 0 20.95 8 3.5 3.5 0 1 0 16 3.05a3.5 3.5 0 0 0-5.831 1.373 3.5 3.5 0 0 0-5.116 3.69 4 4 0 0 0-2.348 6.155C3.499 15.42 4.409 16.712 4.2 18.1 3.926 19.743 3.014 20.732 2 22",key:"1134nt"}],["path",{d:"M2 22 17 7",key:"1q7jp2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uV=U("Lectern",[["path",{d:"M16 12h3a2 2 0 0 0 1.902-1.38l1.056-3.333A1 1 0 0 0 21 6H3a1 1 0 0 0-.958 1.287l1.056 3.334A2 2 0 0 0 5 12h3",key:"13jjxg"}],["path",{d:"M18 6V3a1 1 0 0 0-1-1h-3",key:"1550fe"}],["rect",{width:"8",height:"12",x:"8",y:"10",rx:"1",key:"qmu8b6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hV=U("LetterText",[["path",{d:"M15 12h6",key:"upa0zy"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"m3 13 3.553-7.724a.5.5 0 0 1 .894 0L11 13",key:"blevx4"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M4 11h6",key:"olkgv1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fV=U("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iS=U("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aS=U("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pV=U("Ligature",[["path",{d:"M8 20V8c0-2.2 1.8-4 4-4 1.5 0 2.8.8 3.5 2",key:"1rtphz"}],["path",{d:"M6 12h4",key:"a4o3ry"}],["path",{d:"M14 12h2v8",key:"c1fccl"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 20h4",key:"lzx1xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mV=U("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p1=U("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gV=U("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yh=U("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const So=U("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pm=U("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xV=U("ListCheck",[["path",{d:"M11 18H3",key:"n3j2dh"}],["path",{d:"m15 18 2 2 4-4",key:"1szwhi"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yV=U("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vV=U("ListCollapse",[["path",{d:"m3 10 2.5-2.5L3 5",key:"i6eama"}],["path",{d:"m3 19 2.5-2.5L3 14",key:"w2gmor"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _V=U("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bV=U("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wV=U("ListMinus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jV=U("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oS=U("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kV=U("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NV=U("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SV=U("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CV=U("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MV=U("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TV=U("ListVideo",[["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}],["path",{d:"m16 12 5 3-5 3v-6Z",key:"zpskkp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AV=U("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hf=U("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nn=U("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EV=U("LoaderPinwheel",[["path",{d:"M22 12a1 1 0 0 1-10 0 1 1 0 0 0-10 0",key:"1lzz15"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IV=U("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PV=U("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LV=U("LocateOff",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["path",{d:"M7.11 7.11C5.83 8.39 5 10.1 5 12c0 3.87 3.13 7 7 7 1.9 0 3.61-.83 4.89-2.11",key:"1oh7ia"}],["path",{d:"M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29",key:"3qdecy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PT=U("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z2=U("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OV=U("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B2=U("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wf=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lS=U("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DV=U("Logs",[["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M3 18h1",key:"1eiwyy"}],["path",{d:"M3 6h1",key:"rgxa97"}],["path",{d:"M8 12h1",key:"1con00"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M8 6h1",key:"tn6mkg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RV=U("Lollipop",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M11 11a2 2 0 0 0 4 0 4 4 0 0 0-8 0 6 6 0 0 0 12 0",key:"107gwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FV=U("Luggage",[["path",{d:"M6 20a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1m57jg"}],["path",{d:"M8 18V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v14",key:"1l99gc"}],["path",{d:"M10 20h4",key:"ni2waw"}],["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zV=U("Magnet",[["path",{d:"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",key:"1i3lhw"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}],["path",{d:"m12 15 4 4",key:"lnac28"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BV=U("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $V=U("MailMinus",[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UV=U("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qV=U("MailPlus",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VV=U("MailQuestion",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HV=U("MailSearch",[["path",{d:"M22 12.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h7.5",key:"w80f2v"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"8lzu5m"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.5-1.5",key:"1x83k4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WV=U("MailWarning",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LT=U("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zs=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GV=U("Mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KV=U("Mails",[["rect",{width:"16",height:"13",x:"6",y:"4",rx:"2",key:"1drq3f"}],["path",{d:"m22 7-7.1 3.78c-.57.3-1.23.3-1.8 0L6 7",key:"xn252p"}],["path",{d:"M2 8v11c0 1.1.9 2 2 2h14",key:"n13cji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZV=U("MapPinCheckInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YV=U("MapPinCheck",[["path",{d:"M19.43 12.935c.357-.967.57-1.955.57-2.935a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32.197 32.197 0 0 0 .813-.728",key:"1dq61d"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m16 18 2 2 4-4",key:"1mkfmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XV=U("MapPinHouse",[["path",{d:"M15 22a1 1 0 0 1-1-1v-4a1 1 0 0 1 .445-.832l3-2a1 1 0 0 1 1.11 0l3 2A1 1 0 0 1 22 17v4a1 1 0 0 1-1 1z",key:"1p1rcz"}],["path",{d:"M18 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 .601.2",key:"mcbcs9"}],["path",{d:"M18 22v-3",key:"1t1ugv"}],["circle",{cx:"10",cy:"10",r:"3",key:"1ns7v1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QV=U("MapPinMinusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JV=U("MapPinMinus",[["path",{d:"M18.977 14C19.6 12.701 20 11.343 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"11uxia"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eH=U("MapPinOff",[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16",key:"1d4wjd"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",key:"12yil7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533",key:"lhrkcz"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74",key:"13wojd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tH=U("MapPinPlusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rH=U("MapPinPlus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nH=U("MapPinXInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sH=U("MapPinX",[["path",{d:"M19.752 11.901A7.78 7.78 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 19 19 0 0 0 .09-.077",key:"y0ewhp"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m21.5 15.5-5 5",key:"11iqnx"}],["path",{d:"m21.5 20.5-5-5",key:"1bylgx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pl=U("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iH=U("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aH=U("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oH=U("Martini",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M12 11v11",key:"ur9y6a"}],["path",{d:"m19 3-7 8-7-8Z",key:"1sgpiw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lH=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m1=U("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qx=U("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cH=U("MegaphoneOff",[["path",{d:"M9.26 9.26 3 11v3l14.14 3.14",key:"3429n"}],["path",{d:"M21 15.34V6l-7.31 2.03",key:"4o1dh8"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mm=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dH=U("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uH=U("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hH=U("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fH=U("MessageCircleCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",key:"k85zhp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pH=U("MessageCircleDashed",[["path",{d:"M13.5 3.1c-.5 0-1-.1-1.5-.1s-1 .1-1.5.1",key:"16ll65"}],["path",{d:"M19.3 6.8a10.45 10.45 0 0 0-2.1-2.1",key:"1nq77a"}],["path",{d:"M20.9 13.5c.1-.5.1-1 .1-1.5s-.1-1-.1-1.5",key:"1sf7wn"}],["path",{d:"M17.2 19.3a10.45 10.45 0 0 0 2.1-2.1",key:"x1hs5g"}],["path",{d:"M10.5 20.9c.5.1 1 .1 1.5.1s1-.1 1.5-.1",key:"19m18z"}],["path",{d:"M3.5 17.5 2 22l4.5-1.5",key:"1f36qi"}],["path",{d:"M3.1 10.5c0 .5-.1 1-.1 1.5s.1 1 .1 1.5",key:"1vz3ju"}],["path",{d:"M6.8 4.7a10.45 10.45 0 0 0-2.1 2.1",key:"19f9do"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dS=U("MessageCircleHeart",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7",key:"43lnbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mH=U("MessageCircleMore",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gH=U("MessageCircleOff",[["path",{d:"M20.5 14.9A9 9 0 0 0 9.1 3.5",key:"1iebmn"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7",key:"1ov8ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xH=U("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DT=U("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yH=U("MessageCircleReply",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}],["path",{d:"M7 12h7a2 2 0 0 1 2 2v1",key:"1gheu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vH=U("MessageCircleWarning",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _H=U("MessageCircleX",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zl=U("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bH=U("MessageSquareCode",[["path",{d:"M10 7.5 8 10l2 2.5",key:"xb17xw"}],["path",{d:"m14 7.5 2 2.5-2 2.5",key:"5rap1v"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wH=U("MessageSquareDashed",[["path",{d:"M10 17H7l-4 4v-7",key:"1r71xu"}],["path",{d:"M14 17h1",key:"nufu4t"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1a2 2 0 0 1-2 2",key:"29akq3"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jH=U("MessageSquareDiff",[["path",{d:"m5 19-2 2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1xuzuj"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kH=U("MessageSquareDot",[["path",{d:"M11.7 3H5a2 2 0 0 0-2 2v16l4-4h12a2 2 0 0 0 2-2v-2.7",key:"uodpkb"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NH=U("MessageSquareHeart",[["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"}],["path",{d:"M14.8 7.5a1.84 1.84 0 0 0-2.6 0l-.2.3-.3-.3a1.84 1.84 0 1 0-2.4 2.8L12 13l2.7-2.7c.9-.9.8-2.1.1-2.8",key:"1blaws"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SH=U("MessageSquareLock",[["path",{d:"M19 15v-2a2 2 0 1 0-4 0v2",key:"h3d1vz"}],["path",{d:"M9 17H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3.5",key:"xsnnhn"}],["rect",{x:"13",y:"15",width:"8",height:"5",rx:"1",key:"1ccwuk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CH=U("MessageSquareMore",[["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"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MH=U("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TH=U("MessageSquarePlus",[["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"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RT=U("MessageSquareQuote",[["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"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AH=U("MessageSquareReply",[["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"}],["path",{d:"m10 7-3 3 3 3",key:"1eugdv"}],["path",{d:"M17 13v-1a2 2 0 0 0-2-2H7",key:"ernfh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EH=U("MessageSquareShare",[["path",{d:"M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7",key:"tqtdkg"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m16 8 5-5",key:"15mbrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IH=U("MessageSquareText",[["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"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PH=U("MessageSquareWarning",[["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"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LH=U("MessageSquareX",[["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"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Po=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OH=U("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DH=U("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $2=U("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FT=U("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RH=U("Microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FH=U("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zH=U("Microwave",[["rect",{width:"20",height:"15",x:"2",y:"4",rx:"2",key:"2no95f"}],["rect",{width:"8",height:"7",x:"6",y:"8",rx:"1",key:"zh9wx"}],["path",{d:"M18 8v7",key:"o5zi4n"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 19v2",key:"1dawf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BH=U("Milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M4 6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h13a2 2 0 0 0 1.152-.365l3.424-2.317a1 1 0 0 0 0-1.635l-3.424-2.318A2 2 0 0 0 17 6z",key:"1btarq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $H=U("MilkOff",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v1.343M15 2v2.789a4 4 0 0 0 .672 2.219l.656.984a4 4 0 0 1 .672 2.22v1.131M7.8 7.8l-.128.192A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3",key:"y0ejgx"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.472 6.472 0 0 0 3.435.435",key:"iaxqsy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UH=U("Milk",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qH=U("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VH=U("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g1=U("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HH=U("MonitorCheck",[["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WH=U("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GH=U("MonitorDot",[["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9",key:"1fet9y"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KH=U("MonitorDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"m15 10-3 3-3-3",key:"lzhmyn"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZH=U("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YH=U("MonitorPause",[["path",{d:"M10 13V7",key:"1u13u9"}],["path",{d:"M14 13V7",key:"1vj9om"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XH=U("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QH=U("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JH=U("MonitorSpeaker",[["path",{d:"M5.5 20H8",key:"1k40s5"}],["path",{d:"M17 9h.01",key:"1j24nn"}],["rect",{width:"10",height:"16",x:"12",y:"4",rx:"2",key:"ixliua"}],["path",{d:"M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4",key:"1mp6e1"}],["circle",{cx:"17",cy:"15",r:"1",key:"tqvash"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eW=U("MonitorStop",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}],["rect",{x:"9",y:"7",width:"6",height:"6",rx:"1",key:"5m2oou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tW=U("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rW=U("MonitorX",[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nW=U("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sW=U("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iW=U("MountainSnow",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aW=U("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oW=U("MouseOff",[["path",{d:"M12 6v.343",key:"1gyhex"}],["path",{d:"M18.218 18.218A7 7 0 0 1 5 15V9a7 7 0 0 1 .782-3.218",key:"ukzz01"}],["path",{d:"M19 13.343V9A7 7 0 0 0 8.56 2.902",key:"104jy9"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lW=U("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cW=U("MousePointerBan",[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gj=U("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dW=U("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uW=U("Mouse",[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U2=U("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hW=U("MoveDiagonal2",[["path",{d:"M19 13v6h-6",key:"1hxl6d"}],["path",{d:"M5 11V5h6",key:"12e2xe"}],["path",{d:"m5 5 14 14",key:"11anup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fW=U("MoveDiagonal",[["path",{d:"M11 19H5v-6",key:"8awifj"}],["path",{d:"M13 5h6v6",key:"7voy1q"}],["path",{d:"M19 5 5 19",key:"wwaj1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pW=U("MoveDownLeft",[["path",{d:"M11 19H5V13",key:"1akmht"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mW=U("MoveDownRight",[["path",{d:"M19 13V19H13",key:"10vkzq"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gW=U("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xW=U("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yW=U("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vW=U("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _W=U("MoveUpLeft",[["path",{d:"M5 11V5H11",key:"3q78g9"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bW=U("MoveUpRight",[["path",{d:"M13 5H19V11",key:"1n1gyv"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wW=U("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jW=U("MoveVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kW=U("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NW=U("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SW=U("Music3",[["circle",{cx:"12",cy:"18",r:"4",key:"m3r9ws"}],["path",{d:"M16 18V2",key:"40x2m5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CW=U("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MW=U("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TW=U("Navigation2Off",[["path",{d:"M9.31 9.31 5 21l7-4 7 4-1.17-3.17",key:"qoq2o2"}],["path",{d:"M14.53 8.88 12 2l-1.17 3.17",key:"k3sjzy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AW=U("Navigation2",[["polygon",{points:"12 2 19 21 12 17 5 21 12 2",key:"x8c0qg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EW=U("NavigationOff",[["path",{d:"M8.43 8.43 3 11l8 2 2 8 2.57-5.43",key:"1vdtb7"}],["path",{d:"M17.39 11.73 22 2l-9.73 4.61",key:"tya3r6"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zT=U("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IW=U("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vx=U("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PW=U("Nfc",[["path",{d:"M6 8.32a7.43 7.43 0 0 1 0 7.36",key:"9iaqei"}],["path",{d:"M9.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"1yha7l"}],["path",{d:"M12.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"4iu2gk"}],["path",{d:"M16.37 2a20.16 20.16 0 0 1 0 20",key:"sap9u2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LW=U("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OW=U("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DW=U("NotebookText",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M9.5 8h5",key:"11mslq"}],["path",{d:"M9.5 12H16",key:"ktog6x"}],["path",{d:"M9.5 16H14",key:"p1seyn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RW=U("Notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FW=U("NotepadTextDashed",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"j91f56"}],["path",{d:"M20 12v2",key:"w8o0tu"}],["path",{d:"M20 18v2a2 2 0 0 1-2 2h-1",key:"1c9ggx"}],["path",{d:"M13 22h-2",key:"191ugt"}],["path",{d:"M7 22H6a2 2 0 0 1-2-2v-2",key:"1rt9px"}],["path",{d:"M4 14v-2",key:"1v0sqh"}],["path",{d:"M4 8V6a2 2 0 0 1 2-2h2",key:"1mwabg"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zW=U("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BW=U("NutOff",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592a7.01 7.01 0 0 0 4.125-2.939",key:"1xcvy9"}],["path",{d:"M19 10v3.343",key:"163tfc"}],["path",{d:"M12 12c-1.349-.573-1.905-1.005-2.5-2-.546.902-1.048 1.353-2.5 2-1.018-.644-1.46-1.08-2-2-1.028.71-1.69.918-3 1 1.081-1.048 1.757-2.03 2-3 .194-.776.84-1.551 1.79-2.21m11.654 5.997c.887-.457 1.28-.891 1.556-1.787 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4-.74 0-1.461.068-2.15.192",key:"17914v"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $W=U("Nut",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592A7.003 7.003 0 0 0 19 14v-4",key:"1tgyif"}],["path",{d:"M12 4C8 4 4.5 6 4 8c-.243.97-.919 1.952-2 3 1.31-.082 1.972-.29 3-1 .54.92.982 1.356 2 2 1.452-.647 1.954-1.098 2.5-2 .595.995 1.151 1.427 2.5 2 1.31-.621 1.862-1.058 2.5-2 .629.977 1.162 1.423 2.5 2 1.209-.548 1.68-.967 2-2 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4Z",key:"tnsqj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q2=U("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UW=U("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V2=U("OctagonPause",[["path",{d:"M10 15V9",key:"1lckn7"}],["path",{d:"M14 15V9",key:"1muqhk"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H2=U("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qW=U("Octagon",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VW=U("Omega",[["path",{d:"M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21",key:"1x94xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HW=U("Option",[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WW=U("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GW=U("Origami",[["path",{d:"M12 12V4a1 1 0 0 1 1-1h6.297a1 1 0 0 1 .651 1.759l-4.696 4.025",key:"1bx4vc"}],["path",{d:"m12 21-7.414-7.414A2 2 0 0 1 4 12.172V6.415a1.002 1.002 0 0 1 1.707-.707L20 20.009",key:"1h3km6"}],["path",{d:"m12.214 3.381 8.414 14.966a1 1 0 0 1-.167 1.199l-1.168 1.163a1 1 0 0 1-.706.291H6.351a1 1 0 0 1-.625-.219L3.25 18.8a1 1 0 0 1 .631-1.781l4.165.027",key:"1hj4wg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KW=U("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZW=U("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YW=U("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XW=U("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QW=U("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JW=U("PackageSearch",[["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eG=U("PackageX",[["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ol=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tG=U("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rG=U("PaintRoller",[["rect",{width:"16",height:"6",x:"2",y:"2",rx:"2",key:"jcyz7m"}],["path",{d:"M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1b9h7c"}],["rect",{width:"4",height:"6",x:"8",y:"16",rx:"1",key:"d6e7yl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W2=U("PaintbrushVertical",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v4",key:"qmzblu"}],["path",{d:"M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z",key:"ycvu00"}],["path",{d:"M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1",key:"iw4wnp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nG=U("Paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ld=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sG=U("PanelBottomClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G2=U("PanelBottomDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 15h1",key:"171nev"}],["path",{d:"M19 15h2",key:"1vnucp"}],["path",{d:"M3 15h2",key:"8bym0q"}],["path",{d:"M9 15h1",key:"1tg3ks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iG=U("PanelBottomOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aG=U("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K2=U("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z2=U("PanelLeftDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 14v1",key:"askpd8"}],["path",{d:"M9 19v2",key:"16tejx"}],["path",{d:"M9 3v2",key:"1noubl"}],["path",{d:"M9 9v1",key:"19ebxg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y2=U("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X2=U("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oG=U("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q2=U("PanelRightDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 14v1",key:"ilsfch"}],["path",{d:"M15 19v2",key:"1fst2f"}],["path",{d:"M15 3v2",key:"z204g4"}],["path",{d:"M15 9v1",key:"z2a8b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lG=U("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cG=U("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dG=U("PanelTopClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J2=U("PanelTopDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 9h1",key:"l0svgy"}],["path",{d:"M19 9h2",key:"te2zfg"}],["path",{d:"M3 9h2",key:"1h4ldw"}],["path",{d:"M9 9h1",key:"15jzuz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uG=U("PanelTopOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hG=U("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fG=U("PanelsLeftBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M9 15h12",key:"5ijen5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pG=U("PanelsRightBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h12",key:"1wkqb3"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h0=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mG=U("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gG=U("Parentheses",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xG=U("ParkingMeter",[["path",{d:"M11 15h2",key:"199qp6"}],["path",{d:"M12 12v3",key:"158kv8"}],["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15.282 19a1 1 0 0 0 .948-.68l2.37-6.988a7 7 0 1 0-13.2 0l2.37 6.988a1 1 0 0 0 .948.68z",key:"1jofit"}],["path",{d:"M9 9a3 3 0 1 1 6 0",key:"jdoeu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nc=U("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xh=U("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yG=U("PawPrint",[["circle",{cx:"11",cy:"4",r:"2",key:"vol9p0"}],["circle",{cx:"18",cy:"8",r:"2",key:"17gozi"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}],["path",{d:"M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z",key:"1ydw1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vG=U("PcCase",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",key:"1uq1d7"}],["path",{d:"M15 14h.01",key:"1kp3bh"}],["path",{d:"M9 6h6",key:"dgm16u"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eb=U("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _G=U("PenOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xj=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f0=U("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bG=U("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wG=U("PencilOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jG=U("PencilRuler",[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ha=U("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kG=U("Pentagon",[["path",{d:"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z",key:"2hea0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hS=U("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NG=U("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SG=U("PhilippinePeso",[["path",{d:"M20 11H4",key:"6ut86h"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"M7 21V4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 12H7",key:"1ana5r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CG=U("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MG=U("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TG=U("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AG=U("PhoneMissed",[["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["line",{x1:"16",x2:"22",y1:"2",y2:"8",key:"13zxdn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EG=U("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IG=U("PhoneOutgoing",[["polyline",{points:"22 8 22 2 16 2",key:"1g204g"}],["line",{x1:"16",x2:"22",y1:"8",y2:"2",key:"1ggias"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ca=U("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PG=U("Pi",[["line",{x1:"9",x2:"9",y1:"4",y2:"20",key:"ovs5a5"}],["path",{d:"M4 7c0-1.7 1.3-3 3-3h13",key:"10pag4"}],["path",{d:"M18 20c-1.7 0-3-1.3-3-3V4",key:"1gaosr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LG=U("Piano",[["path",{d:"M18.5 8c-1.4 0-2.6-.8-3.2-2A6.87 6.87 0 0 0 2 9v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8.5C22 9.6 20.4 8 18.5 8",key:"lag0yf"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M6 14v4",key:"9ng0ue"}],["path",{d:"M10 14v4",key:"1v8uk5"}],["path",{d:"M14 14v4",key:"1tqops"}],["path",{d:"M18 14v4",key:"18uqwm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OG=U("Pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DG=U("PictureInPicture2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RG=U("PictureInPicture",[["path",{d:"M8 4.5v5H3m-1-6 6 6m13 0v-3c0-1.16-.84-2-2-2h-7m-9 9v2c0 1.05.95 2 2 2h3",key:"bcd8fb"}],["rect",{width:"10",height:"7",x:"12",y:"13.5",ry:"2",key:"136fx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FG=U("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zG=U("PilcrowLeft",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BG=U("PilcrowRight",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $G=U("Pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UG=U("PillBottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qG=U("Pill",[["path",{d:"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z",key:"wa1lgi"}],["path",{d:"m8.5 8.5 7 7",key:"rvfmvr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BT=U("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x1=U("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VG=U("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HG=U("Pizza",[["path",{d:"m12 14-1 1",key:"11onhr"}],["path",{d:"m13.75 18.25-1.25 1.42",key:"1yisr3"}],["path",{d:"M17.775 5.654a15.68 15.68 0 0 0-12.121 12.12",key:"1qtqk6"}],["path",{d:"M18.8 9.3a1 1 0 0 0 2.1 7.7",key:"fbbbr2"}],["path",{d:"M21.964 20.732a1 1 0 0 1-1.232 1.232l-18-5a1 1 0 0 1-.695-1.232A19.68 19.68 0 0 1 15.732 2.037a1 1 0 0 1 1.232.695z",key:"1hyfdd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WG=U("PlaneLanding",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z",key:"1ma21e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GG=U("PlaneTakeoff",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M6.36 17.4 4 17l-2-4 1.1-.55a2 2 0 0 1 1.8 0l.17.1a2 2 0 0 0 1.8 0L8 12 5 6l.9-.45a2 2 0 0 1 2.09.2l4.02 3a2 2 0 0 0 2.1.2l4.19-2.06a2.41 2.41 0 0 1 1.73-.17L21 7a1.4 1.4 0 0 1 .87 1.99l-.38.76c-.23.46-.6.84-1.07 1.08L7.58 17.2a2 2 0 0 1-1.22.18Z",key:"fkigj9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KG=U("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sc=U("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZG=U("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tb=U("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YG=U("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jn=U("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XG=U("PocketKnife",[["path",{d:"M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2",key:"19w3oe"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z",key:"6fykxj"}],["path",{d:"M18 11.66V22a4 4 0 0 0 4-4V6",key:"1utzek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QG=U("Pocket",[["path",{d:"M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z",key:"1mz881"}],["polyline",{points:"8 10 12 14 16 10",key:"w4mbv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JG=U("Podcast",[["path",{d:"M16.85 18.58a9 9 0 1 0-9.7 0",key:"d71mpg"}],["path",{d:"M8 14a5 5 0 1 1 8 0",key:"fc81rn"}],["circle",{cx:"12",cy:"11",r:"1",key:"1gvufo"}],["path",{d:"M13 17a1 1 0 1 0-2 0l.5 4.5a.5.5 0 1 0 1 0Z",key:"za5kbj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eK=U("PointerOff",[["path",{d:"M10 4.5V4a2 2 0 0 0-2.41-1.957",key:"jsi14n"}],["path",{d:"M13.9 8.4a2 2 0 0 0-1.26-1.295",key:"hirc7f"}],["path",{d:"M21.7 16.2A8 8 0 0 0 22 14v-3a2 2 0 1 0-4 0v-1a2 2 0 0 0-3.63-1.158",key:"1jxb2e"}],["path",{d:"m7 15-1.8-1.8a2 2 0 0 0-2.79 2.86L6 19.7a7.74 7.74 0 0 0 6 2.3h2a8 8 0 0 0 5.657-2.343",key:"10r7hm"}],["path",{d:"M6 6v8",key:"tv5xkp"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tK=U("Pointer",[["path",{d:"M22 14a8 8 0 0 1-8 8",key:"56vcr3"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1agjmk"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1",key:"wdbh2u"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10",key:"1ibuk9"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"g6ys72"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rK=U("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nK=U("Popsicle",[["path",{d:"M18.6 14.4c.8-.8.8-2 0-2.8l-8.1-8.1a4.95 4.95 0 1 0-7.1 7.1l8.1 8.1c.9.7 2.1.7 2.9-.1Z",key:"1o68ps"}],["path",{d:"m22 22-5.5-5.5",key:"17o70y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sK=U("PoundSterling",[["path",{d:"M18 7c0-5.333-8-5.333-8 0",key:"1prm2n"}],["path",{d:"M10 7v14",key:"18tmcs"}],["path",{d:"M6 21h12",key:"4dkmi1"}],["path",{d:"M6 13h10",key:"ybwr4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iK=U("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aK=U("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oK=U("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lK=U("PrinterCheck",[["path",{d:"M13.5 22H7a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v.5",key:"qeb09x"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v2",key:"1md90i"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cK=U("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dK=U("Projector",[["path",{d:"M5 7 3 5",key:"1yys58"}],["path",{d:"M9 6V3",key:"1ptz9u"}],["path",{d:"m13 7 2-2",key:"1w3vmq"}],["circle",{cx:"9",cy:"13",r:"3",key:"1mma13"}],["path",{d:"M11.83 12H20a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h2.17",key:"2frwzc"}],["path",{d:"M16 16h2",key:"dnq2od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uK=U("Proportions",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M12 9v11",key:"1fnkrn"}],["path",{d:"M2 9h13a2 2 0 0 1 2 2v9",key:"11z3ex"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hK=U("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fK=U("Pyramid",[["path",{d:"M2.5 16.88a1 1 0 0 1-.32-1.43l9-13.02a1 1 0 0 1 1.64 0l9 13.01a1 1 0 0 1-.32 1.44l-8.51 4.86a2 2 0 0 1-1.98 0Z",key:"aenxs0"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $T=U("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pK=U("Rabbit",[["path",{d:"M13 16a3 3 0 0 1 2.24 5",key:"1epib5"}],["path",{d:"M18 12h.01",key:"yjnet6"}],["path",{d:"M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3",key:"ue9ozu"}],["path",{d:"M20 8.54V4a2 2 0 1 0-4 0v3",key:"49iql8"}],["path",{d:"M7.612 12.524a3 3 0 1 0-1.6 4.3",key:"1e33i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mK=U("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gK=U("Radiation",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",key:"wy49g3"}],["path",{d:"M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",key:"vklnvr"}],["path",{d:"M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",key:"wkdf1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xK=U("Radical",[["path",{d:"M3 12h3.28a1 1 0 0 1 .948.684l2.298 7.934a.5.5 0 0 0 .96-.044L13.82 4.771A1 1 0 0 1 14.792 4H21",key:"1mqj8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yK=U("RadioReceiver",[["path",{d:"M5 16v2",key:"g5qcv5"}],["path",{d:"M19 16v2",key:"1gbaio"}],["rect",{width:"20",height:"8",x:"2",y:"8",rx:"2",key:"vjsjur"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vK=U("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yj=U("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _K=U("Radius",[["path",{d:"M20.34 17.52a10 10 0 1 0-2.82 2.82",key:"fydyku"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["path",{d:"m13.41 13.41 4.18 4.18",key:"1gqbwc"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bK=U("RailSymbol",[["path",{d:"M5 15h14",key:"m0yey3"}],["path",{d:"M5 9h14",key:"7tsvo6"}],["path",{d:"m14 20-5-5 6-6-5-5",key:"1jo42i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wK=U("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jK=U("Rat",[["path",{d:"M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4",key:"1wq71c"}],["path",{d:"M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3",key:"1crdmb"}],["path",{d:"M13.2 18a3 3 0 0 0-2.2-5",key:"1ol3lk"}],["path",{d:"M13 22H4a2 2 0 0 1 0-4h12",key:"bt3f23"}],["path",{d:"M16 9h.01",key:"1bdo4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kK=U("Ratio",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NK=U("ReceiptCent",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M12 6.5v11",key:"ecfhkf"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SK=U("ReceiptEuro",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 12h5",key:"1g6qi8"}],["path",{d:"M16 9.5a4 4 0 1 0 0 5.2",key:"b2px4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CK=U("ReceiptIndianRupee",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 7h8",key:"i86dvs"}],["path",{d:"M12 17.5 8 15h1a4 4 0 0 0 0-8",key:"grpkl4"}],["path",{d:"M8 11h8",key:"vwpz6n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MK=U("ReceiptJapaneseYen",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"m12 10 3-3",key:"1mc12w"}],["path",{d:"m9 7 3 3v7.5",key:"39i0xv"}],["path",{d:"M9 11h6",key:"1fldmi"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TK=U("ReceiptPoundSterling",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 13h5",key:"1k9z8w"}],["path",{d:"M10 17V9.5a2.5 2.5 0 0 1 5 0",key:"1dzgp0"}],["path",{d:"M8 17h7",key:"8mjdqu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AK=U("ReceiptRussianRuble",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 15h5",key:"vxg57a"}],["path",{d:"M8 11h5a2 2 0 1 0 0-4h-3v10",key:"1usi5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EK=U("ReceiptSwissFranc",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M10 17V7h5",key:"k7jq18"}],["path",{d:"M10 11h4",key:"1i0mka"}],["path",{d:"M8 15h5",key:"vxg57a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IK=U("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PK=U("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rb=U("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LK=U("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OK=U("RectangleVertical",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DK=U("Recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RK=U("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FK=U("RedoDot",[["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}],["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fS=U("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zK=U("RefreshCcwDot",[["path",{d:"M3 2v6h6",key:"18ldww"}],["path",{d:"M21 12A9 9 0 0 0 6 5.3L3 8",key:"1pbrqz"}],["path",{d:"M21 22v-6h-6",key:"usdfbe"}],["path",{d:"M3 12a9 9 0 0 0 15 6.7l3-2.7",key:"1hosoe"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BK=U("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $K=U("RefreshCwOff",[["path",{d:"M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47",key:"1krf6h"}],["path",{d:"M8 16H3v5",key:"1cv678"}],["path",{d:"M3 12C3 9.51 4 7.26 5.64 5.64",key:"ruvoct"}],["path",{d:"m3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64",key:"19q130"}],["path",{d:"M21 12c0 1-.16 1.97-.47 2.87",key:"4w8emr"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ql=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UK=U("Refrigerator",[["path",{d:"M5 6a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6Z",key:"fpq118"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M15 7v6",key:"1nx30x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qK=U("Regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VK=U("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HK=U("Repeat1",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}],["path",{d:"M11 10h1v4",key:"70cz1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WK=U("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GK=U("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KK=U("ReplaceAll",[["path",{d:"M14 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"1yyzbs"}],["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"zfj4xr"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a 3 3 0 0 1 3-3h1",key:"1ageje"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZK=U("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YK=U("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qT=U("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XK=U("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QK=U("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _g=U("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:"m3kijz"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JK=U("RockingChair",[["polyline",{points:"3.5 2 6.5 12.5 18 12.5",key:"y3iy52"}],["line",{x1:"9.5",x2:"5.5",y1:"12.5",y2:"20",key:"19vg5i"}],["line",{x1:"15",x2:"18.5",y1:"12.5",y2:"20",key:"1inpmv"}],["path",{d:"M2.75 18a13 13 0 0 0 18.5 0",key:"1nquas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eZ=U("RollerCoaster",[["path",{d:"M6 19V5",key:"1r845m"}],["path",{d:"M10 19V6.8",key:"9j2tfs"}],["path",{d:"M14 19v-7.8",key:"10s8qv"}],["path",{d:"M18 5v4",key:"1tajlv"}],["path",{d:"M18 19v-6",key:"ielfq3"}],["path",{d:"M22 19V9",key:"158nzp"}],["path",{d:"M2 19V9a4 4 0 0 1 4-4c2 0 4 1.33 6 4s4 4 6 4a4 4 0 1 0-3-6.65",key:"1930oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nb=U("Rotate3d",[["path",{d:"M16.466 7.5C15.643 4.237 13.952 2 12 2 9.239 2 7 6.477 7 12s2.239 10 5 10c.342 0 .677-.069 1-.2",key:"10n0gc"}],["path",{d:"m15.194 13.707 3.814 1.86-1.86 3.814",key:"16shm9"}],["path",{d:"M19 15.57c-1.804.885-4.274 1.43-7 1.43-5.523 0-10-2.239-10-5s4.477-5 10-5c4.838 0 8.873 1.718 9.8 4",key:"1lxi77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tZ=U("RotateCcwSquare",[["path",{d:"M20 9V7a2 2 0 0 0-2-2h-6",key:"19z8uc"}],["path",{d:"m15 2-3 3 3 3",key:"177bxs"}],["path",{d:"M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2",key:"d36hnl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rZ=U("RotateCwSquare",[["path",{d:"M12 5H6a2 2 0 0 0-2 2v3",key:"l96uqu"}],["path",{d:"m9 8 3-3-3-3",key:"1gzgc3"}],["path",{d:"M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1w2k5h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nZ=U("RouteOff",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5c.4 0 .9-.1 1.3-.2",key:"1effex"}],["path",{d:"M5.2 5.2A3.5 3.53 0 0 0 6.5 12H12",key:"k9y2ds"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 15.3a3.5 3.5 0 0 0-3.3-3.3",key:"11nlu2"}],["path",{d:"M15 5h-4.3",key:"6537je"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sZ=U("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iZ=U("Router",[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sb=U("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ib=U("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aZ=U("Rows4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 7.5H3",key:"1hm9pq"}],["path",{d:"M21 12H3",key:"2avoz0"}],["path",{d:"M21 16.5H3",key:"n7jzkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oZ=U("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lZ=U("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cZ=U("RussianRuble",[["path",{d:"M6 11h8a4 4 0 0 0 0-8H9v18",key:"18ai8t"}],["path",{d:"M6 15h8",key:"1y8f6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dZ=U("Sailboat",[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uZ=U("Salad",[["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M11.38 12a2.4 2.4 0 0 1-.4-4.77 2.4 2.4 0 0 1 3.2-2.77 2.4 2.4 0 0 1 3.47-.63 2.4 2.4 0 0 1 3.37 3.37 2.4 2.4 0 0 1-1.1 3.7 2.51 2.51 0 0 1 .03 1.1",key:"10xrj0"}],["path",{d:"m13 12 4-4",key:"1hckqy"}],["path",{d:"M10.9 7.25A3.99 3.99 0 0 0 4 10c0 .73.2 1.41.54 2",key:"1p4srx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hZ=U("Sandwich",[["path",{d:"m2.37 11.223 8.372-6.777a2 2 0 0 1 2.516 0l8.371 6.777",key:"f1wd0e"}],["path",{d:"M21 15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-5.25",key:"1pfu07"}],["path",{d:"M3 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h9",key:"1oq9qw"}],["path",{d:"m6.67 15 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2",key:"1fnwu5"}],["rect",{width:"20",height:"4",x:"2",y:"11",rx:"1",key:"itshg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fZ=U("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pZ=U("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mZ=U("SaveAll",[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gZ=U("SaveOff",[["path",{d:"M13 13H8a1 1 0 0 0-1 1v7",key:"h8g396"}],["path",{d:"M14 8h1",key:"1lfen6"}],["path",{d:"M17 21v-4",key:"1yknxs"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.41 20.41A2 2 0 0 1 19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.41",key:"1t4vdl"}],["path",{d:"M29.5 11.5s5 5 4 5",key:"zzn4i6"}],["path",{d:"M9 3h6.2a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V15",key:"24cby9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bg=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ab=U("Scale3d",[["path",{d:"M5 7v11a1 1 0 0 0 1 1h11",key:"13dt1j"}],["path",{d:"M5.293 18.707 11 13",key:"ezgbsx"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xZ=U("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yZ=U("Scaling",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vZ=U("ScanBarcode",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 7v10",key:"23sfjj"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M17 7v10",key:"578dap"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Z=U("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bZ=U("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wZ=U("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jZ=U("ScanQrCode",[["path",{d:"M17 12v4a1 1 0 0 1-1 1h-4",key:"uk4fdo"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M17 8V7",key:"q2g9wo"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{x:"7",y:"7",width:"5",height:"5",rx:"1",key:"m9kyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kZ=U("ScanSearch",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NZ=U("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZ=U("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CZ=U("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MZ=U("ScissorsLineDashed",[["path",{d:"M5.42 9.42 8 12",key:"12pkuq"}],["circle",{cx:"4",cy:"8",r:"2",key:"107mxr"}],["path",{d:"m14 6-8.58 8.58",key:"gvzu5l"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"M10.8 14.8 14 18",key:"ax7m9r"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TZ=U("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AZ=U("ScreenShareOff",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EZ=U("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IZ=U("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PZ=U("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LZ=U("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OZ=U("SearchCode",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DZ=U("SearchSlash",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RZ=U("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mi=U("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FZ=U("Section",[["path",{d:"M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0",key:"vqan6v"}],["path",{d:"M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0",key:"wdjd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ob=U("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zZ=U("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lo=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BZ=U("SeparatorHorizontal",[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Z=U("SeparatorVertical",[["line",{x1:"12",x2:"12",y1:"3",y2:"21",key:"1efggb"}],["polyline",{points:"8 8 4 12 8 16",key:"bnfmv4"}],["polyline",{points:"16 16 20 12 16 8",key:"u90052"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UZ=U("ServerCog",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m15.7 13.4-.9-.3",key:"1jwmzr"}],["path",{d:"m9.2 10.9-.9-.3",key:"qapnim"}],["path",{d:"m10.6 15.7.3-.9",key:"quwk0k"}],["path",{d:"m13.6 15.7-.4-1",key:"cb9xp7"}],["path",{d:"m10.8 9.3-.4-1",key:"1uaiz5"}],["path",{d:"m8.3 13.6 1-.4",key:"s6srou"}],["path",{d:"m14.7 10.8 1-.4",key:"4d31cq"}],["path",{d:"m13.4 8.3-.3.9",key:"1bm987"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qZ=U("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VZ=U("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HZ=U("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WZ=U("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hd=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GZ=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dc=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HT=U("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KZ=U("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZZ=U("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YZ=U("ShieldAlert",[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XZ=U("ShieldBan",[["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:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QZ=U("ShieldEllipsis",[["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:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JZ=U("ShieldHalf",[["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:"M12 22V2",key:"zs6s6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eY=U("ShieldMinus",[["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 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tY=U("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rY=U("ShieldPlus",[["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 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nY=U("ShieldQuestion",[["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.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lb=U("ShieldX",[["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:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gf=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sY=U("ShipWheel",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["path",{d:"M12 2v7.5",key:"1e5rl5"}],["path",{d:"m19 5-5.23 5.23",key:"1ezxxf"}],["path",{d:"M22 12h-7.5",key:"le1719"}],["path",{d:"m19 19-5.23-5.23",key:"p3fmgn"}],["path",{d:"M12 14.5V22",key:"dgcmos"}],["path",{d:"M10.23 13.77 5 19",key:"qwopd4"}],["path",{d:"M9.5 12H2",key:"r7bup8"}],["path",{d:"M10.23 10.23 5 5",key:"k2y7lj"}],["circle",{cx:"12",cy:"12",r:"2.5",key:"ix0uyj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iY=U("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aY=U("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wg=U("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oY=U("ShoppingBasket",[["path",{d:"m15 11-1 9",key:"5wnq3a"}],["path",{d:"m19 11-4-7",key:"cnml18"}],["path",{d:"M2 11h20",key:"3eubbj"}],["path",{d:"m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4",key:"yiazzp"}],["path",{d:"M4.5 15.5h15",key:"13mye1"}],["path",{d:"m5 11 4-7",key:"116ra9"}],["path",{d:"m9 11 1 9",key:"1ojof7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dh=U("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lY=U("Shovel",[["path",{d:"M2 22v-5l5-5 5 5-5 5z",key:"1fh25c"}],["path",{d:"M9.5 14.5 16 8",key:"1smz5x"}],["path",{d:"m17 2 5 5-.5.5a3.53 3.53 0 0 1-5 0s0 0 0 0a3.53 3.53 0 0 1 0-5L17 2",key:"1q8uv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cY=U("ShowerHead",[["path",{d:"m4 4 2.5 2.5",key:"uv2vmf"}],["path",{d:"M13.5 6.5a4.95 4.95 0 0 0-7 7",key:"frdkwv"}],["path",{d:"M15 5 5 15",key:"1ag8rq"}],["path",{d:"M14 17v.01",key:"eokfpp"}],["path",{d:"M10 16v.01",key:"14uyyl"}],["path",{d:"M13 13v.01",key:"1v1k97"}],["path",{d:"M16 10v.01",key:"5169yg"}],["path",{d:"M11 20v.01",key:"cj92p8"}],["path",{d:"M17 14v.01",key:"11cswd"}],["path",{d:"M20 11v.01",key:"19e0od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dY=U("Shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uY=U("Shrub",[["path",{d:"M12 22v-7l-2-2",key:"eqv9mc"}],["path",{d:"M17 8v.8A6 6 0 0 1 13.8 20H10A6.5 6.5 0 0 1 7 8a5 5 0 0 1 10 0Z",key:"ubcgy"}],["path",{d:"m14 14-2 2",key:"847xa2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hY=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fY=U("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pY=U("SignalHigh",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mY=U("SignalLow",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gY=U("SignalMedium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xY=U("SignalZero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yY=U("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vY=U("Signature",[["path",{d:"m21 17-2.156-1.868A.5.5 0 0 0 18 15.5v.5a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1c0-2.545-3.991-3.97-8.5-4a1 1 0 0 0 0 5c4.153 0 4.745-11.295 5.708-13.5a2.5 2.5 0 1 1 3.31 3.284",key:"y32ogt"}],["path",{d:"M3 21h18",key:"itz85i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Y=U("SignpostBig",[["path",{d:"M10 9H4L2 7l2-2h6",key:"1hq7x2"}],["path",{d:"M14 5h6l2 2-2 2h-6",key:"bv62ej"}],["path",{d:"M10 22V4a2 2 0 1 1 4 0v18",key:"eqpcf2"}],["path",{d:"M8 22h8",key:"rmew8v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bY=U("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wY=U("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jY=U("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kY=U("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NY=U("Skull",[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SY=U("Slack",[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CY=U("Slash",[["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MY=U("Slice",[["path",{d:"M11 16.586V19a1 1 0 0 1-1 1H2L18.37 3.63a1 1 0 1 1 3 3l-9.663 9.663a1 1 0 0 1-1.414 0L8 14",key:"1sllp5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cb=U("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TY=U("SmartphoneCharging",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12.667 8 10 12h4l-2.667 4",key:"h9lk2d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AY=U("SmartphoneNfc",[["rect",{width:"7",height:"12",x:"2",y:"6",rx:"1",key:"5nje8w"}],["path",{d:"M13 8.32a7.43 7.43 0 0 1 0 7.36",key:"1g306n"}],["path",{d:"M16.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"uqvjvo"}],["path",{d:"M19.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"ujntz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gm=U("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EY=U("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IY=U("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PY=U("Snail",[["path",{d:"M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0",key:"hneq2s"}],["circle",{cx:"10",cy:"13",r:"8",key:"194lz3"}],["path",{d:"M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6",key:"ixqyt7"}],["path",{d:"M18 3 19.1 5.2",key:"9tjm43"}],["path",{d:"M22 3 20.9 5.2",key:"j3odrs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $0=U("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LY=U("Sofa",[["path",{d:"M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3",key:"1dgpiv"}],["path",{d:"M2 16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"xacw8m"}],["path",{d:"M4 18v2",key:"jwo5n2"}],["path",{d:"M20 18v2",key:"1ar1qi"}],["path",{d:"M12 4v9",key:"oqhhn3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OY=U("Soup",[["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M19.5 12 22 6",key:"shfsr5"}],["path",{d:"M16.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.73 1.62",key:"rpc6vp"}],["path",{d:"M11.25 3c.27.1.8.53.74 1.36-.05.83-.93 1.2-.98 2.02-.06.78.33 1.24.72 1.62",key:"1lf63m"}],["path",{d:"M6.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.74 1.62",key:"97tijn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DY=U("Space",[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RY=U("Spade",[["path",{d:"M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z",key:"40bo9n"}],["path",{d:"M12 18v4",key:"jadmvz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FY=U("Sparkle",[["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ss=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zY=U("Speaker",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["circle",{cx:"12",cy:"14",r:"4",key:"1jruaj"}],["path",{d:"M12 14h.01",key:"1etili"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BY=U("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Y=U("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UY=U("SpellCheck",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qY=U("Spline",[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VY=U("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HY=U("SprayCan",[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WY=U("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const db=U("SquareActivity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ub=U("SquareArrowDownLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 8-8 8",key:"166keh"}],["path",{d:"M16 16H8V8",key:"1w2ppm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hb=U("SquareArrowDownRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"M16 8v8H8",key:"1lbpgo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fb=U("SquareArrowDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pb=U("SquareArrowLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}],["path",{d:"M16 12H8",key:"1fr5h0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mb=U("SquareArrowOutDownLeft",[["path",{d:"M13 21h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6",key:"14qz4y"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gb=U("SquareArrowOutDownRight",[["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}],["path",{d:"m21 21-9-9",key:"1et2py"}],["path",{d:"M21 15v6h-6",key:"1jko0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xb=U("SquareArrowOutUpLeft",[["path",{d:"M13 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6",key:"14mv1t"}],["path",{d:"m3 3 9 9",key:"rks13r"}],["path",{d:"M3 9V3h6",key:"ira0h2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yb=U("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vb=U("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _b=U("SquareArrowUpLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8h8",key:"19xb1h"}],["path",{d:"M16 16 8 8",key:"1qdy8n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bb=U("SquareArrowUpRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wb=U("SquareArrowUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jb=U("SquareAsterisk",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8.5 14 7-4",key:"12hpby"}],["path",{d:"m8.5 10 7 4",key:"wwy2dy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kb=U("SquareBottomDashedScissors",[["path",{d:"M4 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2",key:"1vzg26"}],["path",{d:"M10 22H8",key:"euku7a"}],["path",{d:"M16 22h-2",key:"18d249"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qm=U("SquareChartGantt",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p0=U("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nb=U("SquareCheck",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sb=U("SquareChevronDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cb=U("SquareChevronLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mb=U("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tb=U("SquareChevronUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ab=U("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GY=U("SquareDashedBottomCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KY=U("SquareDashedBottom",[["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eb=U("SquareDashedKanban",[["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ib=U("SquareDashedMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pb=U("SquareDashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lb=U("SquareDivide",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ob=U("SquareDot",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Db=U("SquareEqual",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rb=U("SquareFunction",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fb=U("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zb=U("SquareLibrary",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7v10",key:"d5nglc"}],["path",{d:"M11 7v10",key:"pptsnr"}],["path",{d:"m15 7 2 10",key:"1m7qm5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bb=U("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $b=U("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ub=U("SquareMinus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qb=U("SquareMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vb=U("SquareParkingOff",[["path",{d:"M3.6 3.6A2 2 0 0 1 5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-.59 1.41",key:"9l1ft6"}],["path",{d:"M3 8.7V19a2 2 0 0 0 2 2h10.3",key:"17knke"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.3",key:"1jxgo2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hb=U("SquareParking",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rc=U("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wb=U("SquarePercent",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=U("SquarePi",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h10",key:"udp07y"}],["path",{d:"M10 7v10",key:"i1d9ee"}],["path",{d:"M16 17a2 2 0 0 1-2-2V7",key:"ftwdc7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kb=U("SquarePilcrow",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 12H9.5a2.5 2.5 0 0 1 0-5H17",key:"1l9586"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M16 7v10",key:"lavkr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zb=U("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=U("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=U("SquarePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZY=U("SquareRadical",[["path",{d:"M7 12h2l2 5 2-10h4",key:"1fxv6h"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qb=U("SquareScissors",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"2",key:"1btzen"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jb=U("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ew=U("SquareSlash",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tw=U("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rw=U("SquareSplitVertical",[["path",{d:"M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3",key:"1pi83i"}],["path",{d:"M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3",key:"ido5k7"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YY=U("SquareSquare",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XY=U("SquareStack",[["path",{d:"M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"4i38lg"}],["path",{d:"M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"mlte4a"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nw=U("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sw=U("SquareUserRound",[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iw=U("SquareUser",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 21v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1m6ac2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aw=U("SquareX",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xm=U("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QY=U("Squircle",[["path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9",key:"garfkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JY=U("Squirrel",[["path",{d:"M15.236 22a3 3 0 0 0-2.2-5",key:"21bitc"}],["path",{d:"M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4",key:"oh0fg0"}],["path",{d:"M18 13h.01",key:"9veqaj"}],["path",{d:"M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10",key:"980v8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eX=U("Stamp",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tX=U("StarHalf",[["path",{d:"M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2",key:"2ksp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rX=U("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vs=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nX=U("StepBack",[["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["polygon",{points:"14,20 4,12 14,4",key:"ypakod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sX=U("StepForward",[["line",{x1:"6",x2:"6",y1:"4",y2:"20",key:"fy8qot"}],["polygon",{points:"10,4 20,12 10,20",key:"1mc1pf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iX=U("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aX=U("Sticker",[["path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z",key:"1wis1t"}],["path",{d:"M14 3v4a2 2 0 0 0 2 2h4",key:"36rjfy"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oX=U("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lX=U("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cX=U("StretchHorizontal",[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dX=U("StretchVertical",[["rect",{width:"6",height:"20",x:"4",y:"2",rx:"2",key:"19qu7m"}],["rect",{width:"6",height:"20",x:"14",y:"2",rx:"2",key:"24v0nk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uX=U("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hX=U("Subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fX=U("SunDim",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pX=U("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mX=U("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gX=U("SunSnow",[["path",{d:"M10 9a3 3 0 1 0 0 6",key:"6zmtdl"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M14 21V3",key:"1llu3z"}],["path",{d:"M10 4V3",key:"pkzwkn"}],["path",{d:"M10 21v-1",key:"1u8rkd"}],["path",{d:"m3.64 18.36.7-.7",key:"105rm9"}],["path",{d:"m4.34 6.34-.7-.7",key:"d3unjp"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 4-3 3",key:"15jcng"}],["path",{d:"m14 17 3 3",key:"6tlq38"}],["path",{d:"m21 15-3-3 3-3",key:"1nlnje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y1=U("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xX=U("Sunrise",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yX=U("Sunset",[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vX=U("Superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _X=U("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h.01",key:"1euzgo"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bX=U("SwissFranc",[["path",{d:"M10 21V3h8",key:"br2l0g"}],["path",{d:"M6 16h9",key:"2py0wn"}],["path",{d:"M10 9.5h7",key:"13dmhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wX=U("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jX=U("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kX=U("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NX=U("Syringe",[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KT=U("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SX=U("TableCellsMerge",[["path",{d:"M12 21v-6",key:"lihzve"}],["path",{d:"M12 9V3",key:"da5inc"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CX=U("TableCellsSplit",[["path",{d:"M12 15V9",key:"8c7uyn"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MX=U("TableColumnsSplit",[["path",{d:"M14 14v2",key:"w2a1xv"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M14 8v2",key:"i67w9a"}],["path",{d:"M2 15h8",key:"82wtch"}],["path",{d:"M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2",key:"up0l64"}],["path",{d:"M2 9h8",key:"yelfik"}],["path",{d:"M22 15h-4",key:"1es58f"}],["path",{d:"M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"pdjoqf"}],["path",{d:"M22 9h-4",key:"1luja7"}],["path",{d:"M5 3v18",key:"14hmio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TX=U("TableOfContents",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M21 12h.01",key:"msek7k"}],["path",{d:"M21 18h.01",key:"1e8rq1"}],["path",{d:"M21 6h.01",key:"1koanj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AX=U("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EX=U("TableRowsSplit",[["path",{d:"M14 10h2",key:"1lstlu"}],["path",{d:"M15 22v-8",key:"1fwwgm"}],["path",{d:"M15 2v4",key:"1044rn"}],["path",{d:"M2 10h2",key:"1r8dkt"}],["path",{d:"M20 10h2",key:"1ug425"}],["path",{d:"M3 19h18",key:"awlh7x"}],["path",{d:"M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6",key:"ibqhof"}],["path",{d:"M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2",key:"1uenja"}],["path",{d:"M8 10h2",key:"66od0"}],["path",{d:"M9 22v-8",key:"fmnu31"}],["path",{d:"M9 2v4",key:"j1yeou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IX=U("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PX=U("TabletSmartphone",[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LX=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OX=U("Tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hx=U("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DX=U("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RX=U("Tally1",[["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FX=U("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zX=U("Tally3",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BX=U("Tally4",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $X=U("Tally5",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}],["path",{d:"M22 6 2 18",key:"h9moai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UX=U("Tangent",[["circle",{cx:"17",cy:"4",r:"2",key:"y5j2s2"}],["path",{d:"M15.59 5.41 5.41 15.59",key:"l0vprr"}],["circle",{cx:"4",cy:"17",r:"2",key:"9p4efm"}],["path",{d:"M12 22s-4-9-1.5-11.5S22 12 22 12",key:"1twk4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wx=U("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qX=U("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VX=U("TentTree",[["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}],["path",{d:"m14 5 3-3 3 3",key:"1sorif"}],["path",{d:"m14 10 3-3 3 3",key:"1jyi9h"}],["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M17 14H7l-5 8h20Z",key:"13ar7p"}],["path",{d:"M8 14v8",key:"1ghmqk"}],["path",{d:"m9 14 5 8",key:"13pgi6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HX=U("Tent",[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WX=U("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ow=U("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GX=U("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KX=U("TestTubes",[["path",{d:"M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",key:"1hjrqt"}],["path",{d:"M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2",key:"16lc8n"}],["path",{d:"M3 2h7",key:"7s29d5"}],["path",{d:"M14 2h7",key:"7sicin"}],["path",{d:"M9 16H4",key:"1bfye3"}],["path",{d:"M20 16h-5",key:"ddnjpe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZX=U("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YX=U("TextCursor",[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XX=U("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QX=U("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lw=U("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JX=U("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eQ=U("Theater",[["path",{d:"M2 10s3-3 3-8",key:"3xiif0"}],["path",{d:"M22 10s-3-3-3-8",key:"ioaa5q"}],["path",{d:"M10 2c0 4.4-3.6 8-8 8",key:"16fkpi"}],["path",{d:"M14 2c0 4.4 3.6 8 8 8",key:"b9eulq"}],["path",{d:"M2 10s2 2 2 5",key:"1au1lb"}],["path",{d:"M22 10s-2 2-2 5",key:"qi2y5e"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M2 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"1vsc2m"}],["path",{d:"M14 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"hrha4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tQ=U("ThermometerSnowflake",[["path",{d:"M2 12h10",key:"19562f"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"m3 9 3 3-3 3",key:"1sas0l"}],["path",{d:"M12 6 9 9 6 6",key:"pfrgxu"}],["path",{d:"m6 18 3-3 1.5 1.5",key:"1e277p"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rQ=U("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nQ=U("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Od=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sQ=U("TicketCheck",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iQ=U("TicketMinus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aQ=U("TicketPercent",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oQ=U("TicketPlus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lQ=U("TicketSlash",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cQ=U("TicketX",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YT=U("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dQ=U("TicketsPlane",[["path",{d:"M10.5 17h1.227a2 2 0 0 0 1.345-.52L18 12",key:"16muxl"}],["path",{d:"m12 13.5 3.75.5",key:"1i9qhk"}],["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uQ=U("Tickets",[["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hQ=U("TimerOff",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fQ=U("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pQ=U("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mQ=U("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gQ=U("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xQ=U("Toilet",[["path",{d:"M7 12h13a1 1 0 0 1 1 1 5 5 0 0 1-5 5h-.598a.5.5 0 0 0-.424.765l1.544 2.47a.5.5 0 0 1-.424.765H5.402a.5.5 0 0 1-.424-.765L7 18",key:"kc4kqr"}],["path",{d:"M8 18a5 5 0 0 1-5-5V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8",key:"1tqs57"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yQ=U("Tornado",[["path",{d:"M21 4H3",key:"1hwok0"}],["path",{d:"M18 8H6",key:"41n648"}],["path",{d:"M19 12H9",key:"1g4lpz"}],["path",{d:"M16 16h-6",key:"1j5d54"}],["path",{d:"M11 20H9",key:"39obr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vQ=U("Torus",[["ellipse",{cx:"12",cy:"11",rx:"3",ry:"2",key:"1b2qxu"}],["ellipse",{cx:"12",cy:"12.5",rx:"10",ry:"8.5",key:"h8emeu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Q=U("TouchpadOff",[["path",{d:"M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16",key:"lnt0bk"}],["path",{d:"M2 14h12",key:"d8icqz"}],["path",{d:"M22 14h-2",key:"jrx26d"}],["path",{d:"M12 20v-6",key:"1rm09r"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M22 16V6a2 2 0 0 0-2-2H10",key:"11y8e4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bQ=U("Touchpad",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wQ=U("TowerControl",[["path",{d:"M18.2 12.27 20 6H4l1.8 6.27a1 1 0 0 0 .95.73h10.5a1 1 0 0 0 .96-.73Z",key:"1pledb"}],["path",{d:"M8 13v9",key:"hmv0ci"}],["path",{d:"M16 22v-9",key:"ylnf1u"}],["path",{d:"m9 6 1 7",key:"dpdgam"}],["path",{d:"m15 6-1 7",key:"ls7zgu"}],["path",{d:"M12 6V2",key:"1pj48d"}],["path",{d:"M13 2h-2",key:"mj6ths"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jQ=U("ToyBrick",[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kQ=U("Tractor",[["path",{d:"m10 11 11 .9a1 1 0 0 1 .8 1.1l-.665 4.158a1 1 0 0 1-.988.842H20",key:"she1j9"}],["path",{d:"M16 18h-5",key:"bq60fd"}],["path",{d:"M18 5a1 1 0 0 0-1 1v5.573",key:"1kv8ia"}],["path",{d:"M3 4h8.129a1 1 0 0 1 .99.863L13 11.246",key:"1q1ert"}],["path",{d:"M4 11V4",key:"9ft8pt"}],["path",{d:"M7 15h.01",key:"k5ht0j"}],["path",{d:"M8 10.1V4",key:"1jgyzo"}],["circle",{cx:"18",cy:"18",r:"2",key:"1emm8v"}],["circle",{cx:"7",cy:"15",r:"5",key:"ddtuc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NQ=U("TrafficCone",[["path",{d:"M9.3 6.2a4.55 4.55 0 0 0 5.4 0",key:"flyxqv"}],["path",{d:"M7.9 10.7c.9.8 2.4 1.3 4.1 1.3s3.2-.5 4.1-1.3",key:"1nlxxg"}],["path",{d:"M13.9 3.5a1.93 1.93 0 0 0-3.8-.1l-3 10c-.1.2-.1.4-.1.6 0 1.7 2.2 3 5 3s5-1.3 5-3c0-.2 0-.4-.1-.5Z",key:"vz7x1l"}],["path",{d:"m7.5 12.2-4.7 2.7c-.5.3-.8.7-.8 1.1s.3.8.8 1.1l7.6 4.5c.9.5 2.1.5 3 0l7.6-4.5c.7-.3 1-.7 1-1.1s-.3-.8-.8-1.1l-4.7-2.8",key:"1xfzlw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SQ=U("TrainFrontTunnel",[["path",{d:"M2 22V12a10 10 0 1 1 20 0v10",key:"o0fyp0"}],["path",{d:"M15 6.8v1.4a3 2.8 0 1 1-6 0V6.8",key:"m8q3n9"}],["path",{d:"M10 15h.01",key:"44in9x"}],["path",{d:"M14 15h.01",key:"5mohn5"}],["path",{d:"M10 19a4 4 0 0 1-4-4v-3a6 6 0 1 1 12 0v3a4 4 0 0 1-4 4Z",key:"hckbmu"}],["path",{d:"m9 19-2 3",key:"iij7hm"}],["path",{d:"m15 19 2 3",key:"npx8sa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CQ=U("TrainFront",[["path",{d:"M8 3.1V7a4 4 0 0 0 8 0V3.1",key:"1v71zp"}],["path",{d:"m9 15-1-1",key:"1yrq24"}],["path",{d:"m15 15 1-1",key:"1t0d6s"}],["path",{d:"M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5Z",key:"1p0hjs"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m16 19 2 3",key:"xo31yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MQ=U("TrainTrack",[["path",{d:"M2 17 17 2",key:"18b09t"}],["path",{d:"m2 14 8 8",key:"1gv9hu"}],["path",{d:"m5 11 8 8",key:"189pqp"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"m11 5 8 8",key:"ummqn6"}],["path",{d:"m14 2 8 8",key:"1vk7dn"}],["path",{d:"M7 22 22 7",key:"15mb1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cw=U("TramFront",[["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m18 22-2-3",key:"1p0ohu"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zn=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TQ=U("Trash",[["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AQ=U("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dw=U("TreePalm",[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v1=U("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EQ=U("Trees",[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IQ=U("Trello",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["rect",{width:"3",height:"9",x:"7",y:"7",key:"14n3xi"}],["rect",{width:"3",height:"5",x:"14",y:"7",key:"s4azjd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _1=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PQ=U("TrendingUpDown",[["path",{d:"M14.828 14.828 21 21",key:"ar5fw7"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"m21 3-9 9-4-4-6 6",key:"1h02xo"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kf=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zh=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LQ=U("TriangleRight",[["path",{d:"M22 18a2 2 0 0 1-2 2H3c-1.1 0-1.3-.6-.4-1.3L20.4 4.3c.9-.7 1.6-.4 1.6.7Z",key:"183wce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OQ=U("Triangle",[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ha=U("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XT=U("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DQ=U("Turtle",[["path",{d:"m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z",key:"1lbbv7"}],["path",{d:"M4.82 7.9 8 10",key:"m9wose"}],["path",{d:"M15.18 7.9 12 10",key:"p8dp2u"}],["path",{d:"M16.93 10H20a2 2 0 0 1 0 4H2",key:"12nsm7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RQ=U("TvMinimalPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uw=U("TvMinimal",[["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FQ=U("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zQ=U("Twitch",[["path",{d:"M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7",key:"c0yzno"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BQ=U("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Q=U("TypeOutline",[["path",{d:"M14 16.5a.5.5 0 0 0 .5.5h.5a2 2 0 0 1 0 4H9a2 2 0 0 1 0-4h.5a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5V8a2 2 0 0 1-4 0V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3a2 2 0 0 1-4 0v-.5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z",key:"1reda3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UQ=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qQ=U("UmbrellaOff",[["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"M15.5 21a1.85 1.85 0 0 1-3.5-1v-8H2a10 10 0 0 1 3.428-6.575",key:"eki10q"}],["path",{d:"M17.5 12H22A10 10 0 0 0 9.004 3.455",key:"n2ayka"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VQ=U("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HQ=U("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WQ=U("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GQ=U("UndoDot",[["path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13",key:"8mp6z9"}],["path",{d:"M3 7v6h6",key:"1v2h90"}],["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mS=U("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KQ=U("UnfoldHorizontal",[["path",{d:"M16 12h6",key:"15xry1"}],["path",{d:"M8 12H2",key:"1jqql6"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 15 3-3-3-3",key:"wjy7rq"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZQ=U("UnfoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YQ=U("Ungroup",[["rect",{width:"8",height:"6",x:"5",y:"4",rx:"1",key:"nzclkv"}],["rect",{width:"8",height:"6",x:"11",y:"14",rx:"1",key:"4tytwb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hw=U("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XQ=U("Unlink2",[["path",{d:"M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",key:"1re2ne"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QT=U("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QQ=U("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const go=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JQ=U("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vj=U("UserCheck",[["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"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JT=U("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eJ=U("UserMinus",[["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"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tJ=U("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qh=U("UserPlus",[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fw=U("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pw=U("UserRoundCog",[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mw=U("UserRoundMinus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rJ=U("UserRoundPen",[["path",{d:"M2 21a8 8 0 0 1 10.821-7.487",key:"1c8h7z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gw=U("UserRoundPlus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nJ=U("UserRoundSearch",[["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.9-1.9",key:"1e5ubv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xw=U("UserRoundX",[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yw=U("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sJ=U("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iJ=U("UserX",[["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"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cc=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vw=U("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kn=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _w=U("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bw=U("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aJ=U("UtilityPole",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M3 3v2",key:"9imdir"}],["path",{d:"M7 3v2",key:"n0os7"}],["path",{d:"M17 3v2",key:"1l2re6"}],["path",{d:"M21 3v2",key:"1duuac"}],["path",{d:"m19 5-7 7-7-7",key:"133zxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eA=U("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oJ=U("Vault",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["path",{d:"m7.9 7.9 2.7 2.7",key:"hpeyl3"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}],["path",{d:"m13.4 10.6 2.7-2.7",key:"264c1n"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["path",{d:"m7.9 16.1 2.7-2.7",key:"p81g5e"}],["circle",{cx:"16.5",cy:"16.5",r:".5",fill:"currentColor",key:"fubopw"}],["path",{d:"m13.4 13.4 2.7 2.7",key:"abhel3"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lJ=U("Vegan",[["path",{d:"M16 8q6 0 6-6-6 0-6 6",key:"qsyyc4"}],["path",{d:"M17.41 3.59a10 10 0 1 0 3 3",key:"41m9h7"}],["path",{d:"M2 2a26.6 26.6 0 0 1 10 20c.9-6.82 1.5-9.5 4-14",key:"qiv7li"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cJ=U("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dJ=U("VibrateOff",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["path",{d:"M8 8v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2",key:"1hbad5"}],["path",{d:"M16 10.34V6c0-.55-.45-1-1-1h-4.34",key:"1x5tf0"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uJ=U("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hJ=U("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fi=U("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fJ=U("Videotape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 8h20",key:"d11cs7"}],["circle",{cx:"8",cy:"14",r:"2",key:"1k2qr5"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"14",r:"2",key:"14k7lr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pJ=U("View",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mJ=U("Voicemail",[["circle",{cx:"6",cy:"12",r:"4",key:"1ehtga"}],["circle",{cx:"18",cy:"12",r:"4",key:"4vafl8"}],["line",{x1:"6",x2:"18",y1:"16",y2:"16",key:"pmt8us"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gJ=U("Volleyball",[["path",{d:"M11.1 7.1a16.55 16.55 0 0 1 10.9 4",key:"2880wi"}],["path",{d:"M12 12a12.6 12.6 0 0 1-8.7 5",key:"113sja"}],["path",{d:"M16.8 13.6a16.55 16.55 0 0 1-9 7.5",key:"1qmsgl"}],["path",{d:"M20.7 17a12.8 12.8 0 0 0-8.7-5 13.3 13.3 0 0 1 0-10",key:"1bmeqp"}],["path",{d:"M6.3 3.8a16.55 16.55 0 0 0 1.9 11.5",key:"iekzv9"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xJ=U("Volume1",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yJ=U("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vJ=U("VolumeOff",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _J=U("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bJ=U("Volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wJ=U("Vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jJ=U("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ww=U("WalletMinimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kJ=U("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NJ=U("Wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jw=U("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SJ=U("Wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CJ=U("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MJ=U("WashingMachine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TJ=U("Watch",[["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["polyline",{points:"12 10 12 12 13 13",key:"19dquz"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AJ=U("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EJ=U("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IJ=U("Webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PJ=U("WebhookOff",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LJ=U("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OJ=U("Weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DJ=U("WheatOff",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RJ=U("Wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FJ=U("WholeWord",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zJ=U("WifiHigh",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BJ=U("WifiLow",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $J=U("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UJ=U("WifiZero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qJ=U("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VJ=U("WindArrowDown",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HJ=U("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WJ=U("WineOff",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GJ=U("Wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KJ=U("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZJ=U("Worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YJ=U("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gx=U("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ts=U("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XJ=U("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QJ=U("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jg=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gS=U("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xS=U("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wZe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:m8,AArrowUp:g8,ALargeSmall:x8,Accessibility:y8,Activity:xg,AirVent:v8,Airplay:_8,AlarmClock:w8,AlarmClockCheck:u_,AlarmClockMinus:h_,AlarmClockOff:b8,AlarmClockPlus:f_,AlarmSmoke:j8,Album:k8,AlignCenter:K4,AlignCenterHorizontal:N8,AlignCenterVertical:S8,AlignEndHorizontal:C8,AlignEndVertical:M8,AlignHorizontalDistributeCenter:T8,AlignHorizontalDistributeEnd:A8,AlignHorizontalDistributeStart:E8,AlignHorizontalJustifyCenter:I8,AlignHorizontalJustifyEnd:P8,AlignHorizontalJustifyStart:L8,AlignHorizontalSpaceAround:O8,AlignHorizontalSpaceBetween:D8,AlignJustify:R8,AlignLeft:Z4,AlignRight:Y4,AlignStartHorizontal:F8,AlignStartVertical:z8,AlignVerticalDistributeCenter:B8,AlignVerticalDistributeEnd:$8,AlignVerticalDistributeStart:U8,AlignVerticalJustifyCenter:q8,AlignVerticalJustifyEnd:V8,AlignVerticalJustifyStart:H8,AlignVerticalSpaceAround:W8,AlignVerticalSpaceBetween:G8,Ambulance:K8,Ampersand:Z8,Ampersands:Y8,Amphora:X8,Anchor:Q8,Angry:J8,Annoyed:eO,Antenna:tO,Anvil:rO,Aperture:nO,AppWindow:ST,AppWindowMac:sO,Apple:iO,Archive:lO,ArchiveRestore:aO,ArchiveX:oO,Armchair:cO,ArrowBigDown:uO,ArrowBigDownDash:dO,ArrowBigLeft:fO,ArrowBigLeftDash:hO,ArrowBigRight:mO,ArrowBigRightDash:pO,ArrowBigUp:xO,ArrowBigUpDash:gO,ArrowDown:n1,ArrowDown01:yO,ArrowDown10:vO,ArrowDownAZ:p_,ArrowDownFromLine:_O,ArrowDownLeft:bO,ArrowDownNarrowWide:wO,ArrowDownRight:jO,ArrowDownToDot:kO,ArrowDownToLine:NO,ArrowDownUp:SO,ArrowDownWideNarrow:m_,ArrowDownZA:g_,ArrowLeft:Qa,ArrowLeftFromLine:CO,ArrowLeftRight:MO,ArrowLeftToLine:TO,ArrowRight:Ko,ArrowRightFromLine:AO,ArrowRightLeft:EO,ArrowRightToLine:IO,ArrowUp:yg,ArrowUp01:PO,ArrowUp10:LO,ArrowUpAZ:x_,ArrowUpDown:zx,ArrowUpFromDot:OO,ArrowUpFromLine:DO,ArrowUpLeft:RO,ArrowUpNarrowWide:y_,ArrowUpRight:FO,ArrowUpToLine:zO,ArrowUpWideNarrow:BO,ArrowUpZA:v_,ArrowsUpFromLine:$O,Asterisk:UO,AtSign:qO,Atom:VO,AudioLines:HO,AudioWaveform:WO,Award:Pl,Axe:GO,Axis3d:__,Baby:KO,Backpack:ZO,Badge:uD,BadgeAlert:YO,BadgeCent:XO,BadgeCheck:b_,BadgeDollarSign:QO,BadgeEuro:JO,BadgeHelp:eD,BadgeIndianRupee:tD,BadgeInfo:rD,BadgeJapaneseYen:nD,BadgeMinus:sD,BadgePercent:iD,BadgePlus:aD,BadgePoundSterling:oD,BadgeRussianRuble:lD,BadgeSwissFranc:cD,BadgeX:dD,BaggageClaim:hD,Ban:fD,Banana:pD,Bandage:mD,Banknote:gD,Barcode:xD,Baseline:yD,Bath:qf,Battery:kD,BatteryCharging:vD,BatteryFull:_D,BatteryLow:bD,BatteryMedium:wD,BatteryWarning:jD,Beaker:ND,Bean:CD,BeanOff:SD,Bed:Vf,BedDouble:MD,BedSingle:TD,Beef:AD,Beer:ID,BeerOff:ED,Bell:vg,BellDot:PD,BellElectric:LD,BellMinus:OD,BellOff:aj,BellPlus:DD,BellRing:RD,BetweenHorizontalEnd:w_,BetweenHorizontalStart:j_,BetweenVerticalEnd:FD,BetweenVerticalStart:zD,BicepsFlexed:BD,Bike:$D,Binary:UD,Binoculars:qD,Biohazard:VD,Bird:HD,Bitcoin:WD,Blend:GD,Blinds:KD,Blocks:ZD,Bluetooth:JD,BluetoothConnected:YD,BluetoothOff:XD,BluetoothSearching:QD,Bold:X4,Bolt:eR,Bomb:tR,Bone:rR,Book:kR,BookA:nR,BookAudio:sR,BookCheck:iR,BookCopy:aR,BookDashed:k_,BookDown:oR,BookHeadphones:lR,BookHeart:cR,BookImage:dR,BookKey:uR,BookLock:hR,BookMarked:fR,BookMinus:pR,BookOpen:CT,BookOpenCheck:mR,BookOpenText:gR,BookPlus:xR,BookText:yR,BookType:vR,BookUp:bR,BookUp2:_R,BookUser:wR,BookX:jR,Bookmark:dm,BookmarkCheck:NR,BookmarkMinus:SR,BookmarkPlus:CR,BookmarkX:MR,BoomBox:TR,Bot:Q4,BotMessageSquare:AR,BotOff:ER,Box:IR,Boxes:PR,Braces:N_,Brackets:LR,Brain:MT,BrainCircuit:OR,BrainCog:DR,BrickWall:RR,Briefcase:gh,BriefcaseBusiness:FR,BriefcaseConveyorBelt:zR,BriefcaseMedical:BR,BringToFront:$R,Brush:UR,Bug:HR,BugOff:qR,BugPlay:VR,Building:oj,Building2:na,Bus:GR,BusFront:WR,Cable:ZR,CableCar:KR,Cake:Gh,CakeSlice:YR,Calculator:XR,Calendar:Ys,Calendar1:QR,CalendarArrowDown:JR,CalendarArrowUp:eF,CalendarCheck:rF,CalendarCheck2:tF,CalendarClock:nF,CalendarCog:sF,CalendarDays:um,CalendarFold:iF,CalendarHeart:aF,CalendarMinus:lF,CalendarMinus2:oF,CalendarOff:cF,CalendarPlus:lj,CalendarPlus2:dF,CalendarRange:uF,CalendarSearch:hF,CalendarSync:fF,CalendarX:mF,CalendarX2:pF,Camera:s1,CameraOff:gF,Candy:vF,CandyCane:xF,CandyOff:yF,Cannabis:_F,Captions:S_,CaptionsOff:bF,Car:kF,CarFront:wF,CarTaxiFront:jF,Caravan:NF,Carrot:SF,CaseLower:CF,CaseSensitive:MF,CaseUpper:TF,CassetteTape:AF,Cast:EF,Castle:IF,Cat:PF,Cctv:LF,ChartArea:C_,ChartBar:T_,ChartBarBig:M_,ChartBarDecreasing:OF,ChartBarIncreasing:DF,ChartBarStacked:RF,ChartCandlestick:A_,ChartColumn:ac,ChartColumnBig:E_,ChartColumnDecreasing:FF,ChartColumnIncreasing:I_,ChartColumnStacked:zF,ChartGantt:BF,ChartLine:P_,ChartNetwork:$F,ChartNoAxesColumn:O_,ChartNoAxesColumnDecreasing:UF,ChartNoAxesColumnIncreasing:L_,ChartNoAxesCombined:qF,ChartNoAxesGantt:D_,ChartPie:R_,ChartScatter:F_,ChartSpline:VF,Check:Ca,CheckCheck:HF,ChefHat:WF,Cherry:GF,ChevronDown:Iu,ChevronFirst:KF,ChevronLast:ZF,ChevronLeft:qc,ChevronRight:Ga,ChevronUp:i1,ChevronsDown:XF,ChevronsDownUp:YF,ChevronsLeft:ez,ChevronsLeftRight:JF,ChevronsLeftRightEllipsis:QF,ChevronsRight:rz,ChevronsRightLeft:tz,ChevronsUp:nz,ChevronsUpDown:a1,Chrome:sz,Church:iz,Cigarette:oz,CigaretteOff:az,Circle:Pu,CircleAlert:El,CircleArrowDown:z_,CircleArrowLeft:B_,CircleArrowOutDownLeft:$_,CircleArrowOutDownRight:U_,CircleArrowOutUpLeft:q_,CircleArrowOutUpRight:V_,CircleArrowRight:H_,CircleArrowUp:W_,CircleCheck:Za,CircleCheckBig:qa,CircleChevronDown:G_,CircleChevronLeft:K_,CircleChevronRight:Z_,CircleChevronUp:Y_,CircleDashed:lz,CircleDivide:X_,CircleDollarSign:cz,CircleDot:uz,CircleDotDashed:dz,CircleEllipsis:hz,CircleEqual:fz,CircleFadingArrowUp:pz,CircleFadingPlus:mz,CircleGauge:Q_,CircleHelp:Nx,CircleMinus:J_,CircleOff:gz,CircleParking:t2,CircleParkingOff:e2,CirclePause:r2,CirclePercent:n2,CirclePlay:Of,CirclePlus:s2,CirclePower:i2,CircleSlash:xz,CircleSlash2:a2,CircleStop:o2,CircleUser:c2,CircleUserRound:l2,CircleX:zc,CircuitBoard:yz,Citrus:vz,Clapperboard:_z,Clipboard:Mz,ClipboardCheck:TT,ClipboardCopy:bz,ClipboardList:wz,ClipboardMinus:jz,ClipboardPaste:kz,ClipboardPen:u2,ClipboardPenLine:d2,ClipboardPlus:Nz,ClipboardType:Sz,ClipboardX:Cz,Clock:Ki,Clock1:Tz,Clock10:Az,Clock11:Ez,Clock12:Iz,Clock2:Pz,Clock3:Lz,Clock4:Oz,Clock5:Dz,Clock6:Rz,Clock7:Fz,Clock8:zz,Clock9:Bz,ClockAlert:$z,ClockArrowDown:Uz,ClockArrowUp:qz,Cloud:s7,CloudAlert:Vz,CloudCog:Hz,CloudDownload:h2,CloudDrizzle:Wz,CloudFog:Gz,CloudHail:Kz,CloudLightning:Zz,CloudMoon:Xz,CloudMoonRain:Yz,CloudOff:Qz,CloudRain:e7,CloudRainWind:Jz,CloudSnow:t7,CloudSun:n7,CloudSunRain:r7,CloudUpload:f2,Cloudy:i7,Clover:Px,Club:a7,Code:cj,CodeXml:p2,Codepen:o7,Codesandbox:l7,Coffee:dj,Cog:c7,Coins:d7,Columns2:m2,Columns3:g2,Columns4:u7,Combine:h7,Command:f7,Compass:p7,Component:m7,Computer:g7,ConciergeBell:x7,Cone:y7,Construction:v7,Contact:_7,ContactRound:x2,Container:b7,Contrast:w7,Cookie:j7,CookingPot:k7,Copy:jl,CopyCheck:N7,CopyMinus:S7,CopyPlus:C7,CopySlash:M7,CopyX:T7,Copyleft:A7,Copyright:E7,CornerDownLeft:I7,CornerDownRight:P7,CornerLeftDown:L7,CornerLeftUp:O7,CornerRightDown:D7,CornerRightUp:R7,CornerUpLeft:F7,CornerUpRight:z7,Cpu:B7,CreativeCommons:$7,CreditCard:hm,Croissant:U7,Crop:q7,Cross:V7,Crosshair:H7,Crown:o1,Cuboid:W7,CupSoda:G7,Currency:K7,Cylinder:Z7,Dam:Y7,Database:J7,DatabaseBackup:X7,DatabaseZap:Q7,Delete:e9,Dessert:t9,Diameter:r9,Diamond:i9,DiamondMinus:n9,DiamondPercent:y2,DiamondPlus:s9,Dice1:a9,Dice2:o9,Dice3:l9,Dice4:c9,Dice5:d9,Dice6:u9,Dices:h9,Diff:f9,Disc:x9,Disc2:p9,Disc3:m9,DiscAlbum:g9,Divide:y9,Dna:_9,DnaOff:v9,Dock:b9,Dog:w9,DollarSign:ud,Donut:j9,DoorClosed:k9,DoorOpen:l1,Dot:N9,Download:Xa,DraftingCompass:S9,Drama:C9,Dribbble:M9,Drill:T9,Droplet:A9,Droplets:E9,Drum:I9,Drumstick:P9,Dumbbell:L9,Ear:D9,EarOff:O9,Earth:v2,EarthLock:R9,Eclipse:F9,Egg:J4,EggFried:z9,EggOff:B9,Ellipsis:og,EllipsisVertical:Sx,Equal:q9,EqualApproximately:$9,EqualNot:U9,Eraser:V9,EthernetPort:H9,Euro:W9,Expand:G9,ExternalLink:Ls,Eye:Qo,EyeClosed:K9,EyeOff:c1,Facebook:Pd,Factory:Z9,Fan:Y9,FastForward:X9,Feather:Q9,Fence:J9,FerrisWheel:eB,Figma:tB,File:ZB,FileArchive:rB,FileAudio:sB,FileAudio2:nB,FileAxis3d:_2,FileBadge:aB,FileBadge2:iB,FileBox:oB,FileChartColumn:w2,FileChartColumnIncreasing:b2,FileChartLine:j2,FileChartPie:k2,FileCheck:cB,FileCheck2:lB,FileClock:dB,FileCode:hB,FileCode2:uB,FileCog:N2,FileDiff:fB,FileDigit:pB,FileDown:mB,FileHeart:gB,FileImage:d1,FileInput:xB,FileJson:vB,FileJson2:yB,FileKey:bB,FileKey2:_B,FileLock:jB,FileLock2:wB,FileMinus:NB,FileMinus2:kB,FileMusic:SB,FileOutput:CB,FilePen:C2,FilePenLine:S2,FilePlus:TB,FilePlus2:MB,FileQuestion:AB,FileScan:EB,FileSearch:PB,FileSearch2:IB,FileSliders:LB,FileSpreadsheet:u1,FileStack:OB,FileSymlink:DB,FileTerminal:RB,FileText:Ai,FileType:zB,FileType2:FB,FileUp:BB,FileUser:$B,FileVideo:qB,FileVideo2:UB,FileVolume:HB,FileVolume2:VB,FileWarning:WB,FileX:KB,FileX2:GB,Files:YB,Film:Md,Filter:uj,FilterX:XB,Fingerprint:QB,FireExtinguisher:JB,Fish:r$,FishOff:e$,FishSymbol:t$,Flag:Bx,FlagOff:n$,FlagTriangleLeft:s$,FlagTriangleRight:i$,Flame:Kh,FlameKindling:a$,Flashlight:l$,FlashlightOff:o$,FlaskConical:hj,FlaskConicalOff:c$,FlaskRound:d$,FlipHorizontal:h$,FlipHorizontal2:u$,FlipVertical:p$,FlipVertical2:f$,Flower:m$,Flower2:im,Focus:g$,FoldHorizontal:x$,FoldVertical:y$,Folder:H$,FolderArchive:v$,FolderCheck:_$,FolderClock:b$,FolderClosed:w$,FolderCode:j$,FolderCog:M2,FolderDot:k$,FolderDown:N$,FolderGit:C$,FolderGit2:S$,FolderHeart:M$,FolderInput:T$,FolderKanban:A$,FolderKey:E$,FolderLock:I$,FolderMinus:P$,FolderOpen:$x,FolderOpenDot:L$,FolderOutput:O$,FolderPen:T2,FolderPlus:D$,FolderRoot:R$,FolderSearch:z$,FolderSearch2:F$,FolderSymlink:B$,FolderSync:$$,FolderTree:U$,FolderUp:q$,FolderX:V$,Folders:W$,Footprints:G$,Forklift:K$,Forward:Z$,Frame:Y$,Framer:X$,Frown:Q$,Fuel:J$,Fullscreen:eU,GalleryHorizontal:rU,GalleryHorizontalEnd:tU,GalleryThumbnails:nU,GalleryVertical:iU,GalleryVerticalEnd:sU,Gamepad:oU,Gamepad2:aU,Gauge:lU,Gavel:cU,Gem:dU,Ghost:fj,Gift:Va,GitBranch:hU,GitBranchPlus:uU,GitCommitHorizontal:A2,GitCommitVertical:fU,GitCompare:mU,GitCompareArrows:pU,GitFork:gU,GitGraph:xU,GitMerge:yU,GitPullRequest:kU,GitPullRequestArrow:vU,GitPullRequestClosed:_U,GitPullRequestCreate:wU,GitPullRequestCreateArrow:bU,GitPullRequestDraft:jU,Github:NU,Gitlab:SU,GlassWater:CU,Glasses:MU,Globe:Ux,GlobeLock:TU,Goal:AU,Grab:EU,GraduationCap:h1,Grape:IU,Grid2x2:I2,Grid2x2Check:PU,Grid2x2Plus:E2,Grid2x2X:LU,Grid3x3:Oh,Grip:DU,GripHorizontal:OU,GripVertical:pj,Group:RU,Guitar:FU,Ham:zU,Hammer:BU,Hand:HU,HandCoins:$U,HandHeart:UU,HandHelping:P2,HandMetal:qU,HandPlatter:VU,Handshake:WU,HardDrive:AT,HardDriveDownload:GU,HardDriveUpload:KU,HardHat:ZU,Hash:eS,Haze:YU,HdmiPort:XU,Heading:rq,Heading1:ET,Heading2:IT,Heading3:QU,Heading4:JU,Heading5:eq,Heading6:tq,HeadphoneOff:nq,Headphones:sq,Headset:iq,Heart:oa,HeartCrack:aq,HeartHandshake:oq,HeartOff:lq,HeartPulse:cq,Heater:dq,Hexagon:uq,Highlighter:hq,History:tS,Hop:pq,HopOff:fq,Hospital:mq,Hotel:gq,Hourglass:xq,House:fi,HousePlug:yq,HousePlus:vq,IceCreamBowl:L2,IceCreamCone:O2,IdCard:_q,Image:Zo,ImageDown:bq,ImageMinus:wq,ImageOff:jq,ImagePlay:kq,ImagePlus:rS,ImageUp:Nq,ImageUpscale:Sq,Images:Cq,Import:Mq,Inbox:Tq,IndentDecrease:D2,IndentIncrease:R2,IndianRupee:Aq,Infinity:Eq,Info:Iq,InspectionPanel:Pq,Instagram:eu,Italic:nS,IterationCcw:Lq,IterationCw:Oq,JapaneseYen:Dq,Joystick:Rq,Kanban:f1,Key:Zh,KeyRound:mj,KeySquare:Fq,Keyboard:$q,KeyboardMusic:zq,KeyboardOff:Bq,Lamp:Gq,LampCeiling:Uq,LampDesk:qq,LampFloor:Vq,LampWallDown:Hq,LampWallUp:Wq,LandPlot:Kq,Landmark:Zq,Languages:Yq,Laptop:Qq,LaptopMinimal:F2,LaptopMinimalCheck:Xq,Lasso:eV,LassoSelect:Jq,Laugh:tV,Layers:sV,Layers2:rV,Layers3:nV,LayoutDashboard:sS,LayoutGrid:fm,LayoutList:iV,LayoutPanelLeft:aV,LayoutPanelTop:oV,LayoutTemplate:lV,Leaf:cV,LeafyGreen:dV,Lectern:uV,LetterText:hV,Library:iS,LibraryBig:fV,LifeBuoy:aS,Ligature:pV,Lightbulb:p1,LightbulbOff:mV,Link:So,Link2:Yh,Link2Off:gV,Linkedin:pm,List:Hf,ListCheck:xV,ListChecks:yV,ListCollapse:vV,ListEnd:_V,ListFilter:bV,ListMinus:wV,ListMusic:jV,ListOrdered:oS,ListPlus:kV,ListRestart:NV,ListStart:SV,ListTodo:CV,ListTree:MV,ListVideo:TV,ListX:AV,Loader:IV,LoaderCircle:nn,LoaderPinwheel:EV,Locate:PT,LocateFixed:PV,LocateOff:LV,Lock:Wf,LockKeyhole:OV,LockKeyholeOpen:z2,LockOpen:B2,LogIn:lS,LogOut:cS,Logs:DV,Lollipop:RV,Luggage:FV,Magnet:zV,Mail:Zs,MailCheck:BV,MailMinus:$V,MailOpen:UV,MailPlus:qV,MailQuestion:VV,MailSearch:HV,MailWarning:WV,MailX:LT,Mailbox:GV,Mails:KV,Map:aH,MapPin:pl,MapPinCheck:YV,MapPinCheckInside:ZV,MapPinHouse:XV,MapPinMinus:JV,MapPinMinusInside:QV,MapPinOff:eH,MapPinPlus:rH,MapPinPlusInside:tH,MapPinX:sH,MapPinXInside:nH,MapPinned:iH,Martini:oH,Maximize:m1,Maximize2:lH,Medal:qx,Megaphone:mm,MegaphoneOff:cH,Meh:dH,MemoryStick:uH,Menu:OT,Merge:hH,MessageCircle:Zl,MessageCircleCode:fH,MessageCircleDashed:pH,MessageCircleHeart:dS,MessageCircleMore:mH,MessageCircleOff:gH,MessageCirclePlus:xH,MessageCircleQuestion:DT,MessageCircleReply:yH,MessageCircleWarning:vH,MessageCircleX:_H,MessageSquare:Po,MessageSquareCode:bH,MessageSquareDashed:wH,MessageSquareDiff:jH,MessageSquareDot:kH,MessageSquareHeart:NH,MessageSquareLock:SH,MessageSquareMore:CH,MessageSquareOff:MH,MessageSquarePlus:TH,MessageSquareQuote:RT,MessageSquareReply:AH,MessageSquareShare:EH,MessageSquareText:IH,MessageSquareWarning:PH,MessageSquareX:LH,MessagesSquare:OH,Mic:FT,MicOff:DH,MicVocal:$2,Microchip:RH,Microscope:FH,Microwave:zH,Milestone:BH,Milk:UH,MilkOff:$H,Minimize:VH,Minimize2:qH,Minus:g1,Monitor:uS,MonitorCheck:HH,MonitorCog:WH,MonitorDot:GH,MonitorDown:KH,MonitorOff:ZH,MonitorPause:YH,MonitorPlay:XH,MonitorSmartphone:QH,MonitorSpeaker:JH,MonitorStop:eW,MonitorUp:tW,MonitorX:rW,Moon:sW,MoonStar:nW,Mountain:aW,MountainSnow:iW,Mouse:uW,MouseOff:oW,MousePointer:dW,MousePointer2:lW,MousePointerBan:cW,MousePointerClick:gj,Move:kW,Move3d:U2,MoveDiagonal:fW,MoveDiagonal2:hW,MoveDown:gW,MoveDownLeft:pW,MoveDownRight:mW,MoveHorizontal:xW,MoveLeft:yW,MoveRight:vW,MoveUp:wW,MoveUpLeft:_W,MoveUpRight:bW,MoveVertical:jW,Music:MW,Music2:NW,Music3:SW,Music4:CW,Navigation:zT,Navigation2:AW,Navigation2Off:TW,NavigationOff:EW,Network:IW,Newspaper:Vx,Nfc:PW,Notebook:RW,NotebookPen:LW,NotebookTabs:OW,NotebookText:DW,NotepadText:zW,NotepadTextDashed:FW,Nut:$W,NutOff:BW,Octagon:qW,OctagonAlert:q2,OctagonMinus:UW,OctagonPause:V2,OctagonX:H2,Omega:VW,Option:HW,Orbit:WW,Origami:GW,Package:Ol,Package2:KW,PackageCheck:ZW,PackageMinus:YW,PackageOpen:XW,PackagePlus:QW,PackageSearch:JW,PackageX:eG,PaintBucket:tG,PaintRoller:rG,Paintbrush:nG,PaintbrushVertical:W2,Palette:Ld,PanelBottom:aG,PanelBottomClose:sG,PanelBottomDashed:G2,PanelBottomOpen:iG,PanelLeft:X2,PanelLeftClose:K2,PanelLeftDashed:Z2,PanelLeftOpen:Y2,PanelRight:cG,PanelRightClose:oG,PanelRightDashed:Q2,PanelRightOpen:lG,PanelTop:hG,PanelTopClose:dG,PanelTopDashed:J2,PanelTopOpen:uG,PanelsLeftBottom:fG,PanelsRightBottom:pG,PanelsTopLeft:h0,Paperclip:mG,Parentheses:gG,ParkingMeter:xG,PartyPopper:Nc,Pause:Xh,PawPrint:yG,PcCase:vG,Pen:f0,PenLine:eb,PenOff:_G,PenTool:xj,Pencil:ha,PencilLine:bG,PencilOff:wG,PencilRuler:jG,Pentagon:kG,Percent:hS,PersonStanding:NG,PhilippinePeso:SG,Phone:ca,PhoneCall:CG,PhoneForwarded:MG,PhoneIncoming:TG,PhoneMissed:AG,PhoneOff:EG,PhoneOutgoing:IG,Pi:PG,Piano:LG,Pickaxe:OG,PictureInPicture:RG,PictureInPicture2:DG,PiggyBank:FG,Pilcrow:$G,PilcrowLeft:zG,PilcrowRight:BG,Pill:qG,PillBottle:UG,Pin:x1,PinOff:BT,Pipette:VG,Pizza:HG,Plane:KG,PlaneLanding:WG,PlaneTakeoff:GG,Play:Sc,Plug:YG,Plug2:ZG,PlugZap:tb,Plus:jn,Pocket:QG,PocketKnife:XG,Podcast:JG,Pointer:tK,PointerOff:eK,Popcorn:rK,Popsicle:nK,PoundSterling:sK,Power:aK,PowerOff:iK,Presentation:oK,Printer:cK,PrinterCheck:lK,Projector:dK,Proportions:uK,Puzzle:hK,Pyramid:fK,QrCode:$T,Quote:UT,Rabbit:pK,Radar:mK,Radiation:gK,Radical:xK,Radio:yj,RadioReceiver:yK,RadioTower:vK,Radius:_K,RailSymbol:bK,Rainbow:wK,Rat:jK,Ratio:kK,Receipt:PK,ReceiptCent:NK,ReceiptEuro:SK,ReceiptIndianRupee:CK,ReceiptJapaneseYen:MK,ReceiptPoundSterling:TK,ReceiptRussianRuble:AK,ReceiptSwissFranc:EK,ReceiptText:IK,RectangleEllipsis:rb,RectangleHorizontal:LK,RectangleVertical:OK,Recycle:DK,Redo:fS,Redo2:RK,RedoDot:FK,RefreshCcw:BK,RefreshCcwDot:zK,RefreshCw:ql,RefreshCwOff:$K,Refrigerator:UK,Regex:qK,RemoveFormatting:VK,Repeat:GK,Repeat1:HK,Repeat2:WK,Replace:ZK,ReplaceAll:KK,Reply:qT,ReplyAll:YK,Rewind:XK,Ribbon:QK,Rocket:_g,RockingChair:JK,RollerCoaster:eZ,Rotate3d:nb,RotateCcw:pS,RotateCcwSquare:tZ,RotateCw:VT,RotateCwSquare:rZ,Route:sZ,RouteOff:nZ,Router:iZ,Rows2:sb,Rows3:ib,Rows4:aZ,Rss:oZ,Ruler:lZ,RussianRuble:cZ,Sailboat:dZ,Salad:uZ,Sandwich:hZ,Satellite:pZ,SatelliteDish:fZ,Save:bg,SaveAll:mZ,SaveOff:gZ,Scale:xZ,Scale3d:ab,Scaling:yZ,Scan:SZ,ScanBarcode:vZ,ScanEye:_Z,ScanFace:bZ,ScanLine:wZ,ScanQrCode:jZ,ScanSearch:kZ,ScanText:NZ,School:CZ,Scissors:TZ,ScissorsLineDashed:MZ,ScreenShare:EZ,ScreenShareOff:AZ,Scroll:PZ,ScrollText:IZ,Search:Mi,SearchCheck:LZ,SearchCode:OZ,SearchSlash:DZ,SearchX:RZ,Section:FZ,Send:Lo,SendHorizontal:ob,SendToBack:zZ,SeparatorHorizontal:BZ,SeparatorVertical:$Z,Server:HZ,ServerCog:UZ,ServerCrash:qZ,ServerOff:VZ,Settings:hd,Settings2:WZ,Shapes:GZ,Share:HT,Share2:dc,Sheet:KZ,Shell:ZZ,Shield:Gf,ShieldAlert:YZ,ShieldBan:XZ,ShieldCheck:WT,ShieldEllipsis:QZ,ShieldHalf:JZ,ShieldMinus:eY,ShieldOff:tY,ShieldPlus:rY,ShieldQuestion:nY,ShieldX:lb,Ship:iY,ShipWheel:sY,Shirt:aY,ShoppingBag:wg,ShoppingBasket:oY,ShoppingCart:dh,Shovel:lY,ShowerHead:cY,Shrink:dY,Shrub:uY,Shuffle:hY,Sigma:fY,Signal:yY,SignalHigh:pY,SignalLow:mY,SignalMedium:gY,SignalZero:xY,Signature:vY,Signpost:bY,SignpostBig:_Y,Siren:wY,SkipBack:jY,SkipForward:kY,Skull:NY,Slack:SY,Slash:CY,Slice:MY,SlidersHorizontal:GT,SlidersVertical:cb,Smartphone:gm,SmartphoneCharging:TY,SmartphoneNfc:AY,Smile:IY,SmilePlus:EY,Snail:PY,Snowflake:$0,Sofa:LY,Soup:OY,Space:DY,Spade:RY,Sparkle:FY,Sparkles:Ss,Speaker:zY,Speech:BY,SpellCheck:UY,SpellCheck2:$Y,Spline:qY,Split:VY,SprayCan:HY,Sprout:WY,Square:xm,SquareActivity:db,SquareArrowDown:fb,SquareArrowDownLeft:ub,SquareArrowDownRight:hb,SquareArrowLeft:pb,SquareArrowOutDownLeft:mb,SquareArrowOutDownRight:gb,SquareArrowOutUpLeft:xb,SquareArrowOutUpRight:yb,SquareArrowRight:vb,SquareArrowUp:wb,SquareArrowUpLeft:_b,SquareArrowUpRight:bb,SquareAsterisk:jb,SquareBottomDashedScissors:kb,SquareChartGantt:Qm,SquareCheck:Nb,SquareCheckBig:p0,SquareChevronDown:Sb,SquareChevronLeft:Cb,SquareChevronRight:Mb,SquareChevronUp:Tb,SquareCode:Ab,SquareDashed:Pb,SquareDashedBottom:KY,SquareDashedBottomCode:GY,SquareDashedKanban:Eb,SquareDashedMousePointer:Ib,SquareDivide:Lb,SquareDot:Ob,SquareEqual:Db,SquareFunction:Rb,SquareKanban:Fb,SquareLibrary:zb,SquareM:Bb,SquareMenu:$b,SquareMinus:Ub,SquareMousePointer:qb,SquareParking:Hb,SquareParkingOff:Vb,SquarePen:rc,SquarePercent:Wb,SquarePi:Gb,SquarePilcrow:Kb,SquarePlay:Zb,SquarePlus:Yb,SquarePower:Xb,SquareRadical:ZY,SquareScissors:Qb,SquareSigma:Jb,SquareSlash:ew,SquareSplitHorizontal:tw,SquareSplitVertical:rw,SquareSquare:YY,SquareStack:XY,SquareTerminal:nw,SquareUser:iw,SquareUserRound:sw,SquareX:aw,Squircle:QY,Squirrel:JY,Stamp:eX,Star:vs,StarHalf:tX,StarOff:rX,StepBack:nX,StepForward:sX,Stethoscope:iX,Sticker:aX,StickyNote:oX,Store:lX,StretchHorizontal:cX,StretchVertical:dX,Strikethrough:uX,Subscript:hX,Sun:y1,SunDim:fX,SunMedium:pX,SunMoon:mX,SunSnow:gX,Sunrise:xX,Sunset:yX,Superscript:vX,SwatchBook:_X,SwissFranc:bX,SwitchCamera:wX,Sword:jX,Swords:kX,Syringe:NX,Table:IX,Table2:KT,TableCellsMerge:SX,TableCellsSplit:CX,TableColumnsSplit:MX,TableOfContents:TX,TableProperties:AX,TableRowsSplit:EX,Tablet:LX,TabletSmartphone:PX,Tablets:OX,Tag:Hx,Tags:DX,Tally1:RX,Tally2:FX,Tally3:zX,Tally4:BX,Tally5:$X,Tangent:UX,Target:Wx,Telescope:qX,Tent:HX,TentTree:VX,Terminal:WX,TestTube:GX,TestTubeDiagonal:ow,TestTubes:KX,Text:JX,TextCursor:YX,TextCursorInput:ZX,TextQuote:XX,TextSearch:QX,TextSelect:lw,Theater:eQ,Thermometer:nQ,ThermometerSnowflake:tQ,ThermometerSun:rQ,ThumbsDown:ZT,ThumbsUp:Od,Ticket:YT,TicketCheck:sQ,TicketMinus:iQ,TicketPercent:aQ,TicketPlus:oQ,TicketSlash:lQ,TicketX:cQ,Tickets:uQ,TicketsPlane:dQ,Timer:pQ,TimerOff:hQ,TimerReset:fQ,ToggleLeft:mQ,ToggleRight:gQ,Toilet:xQ,Tornado:yQ,Torus:vQ,Touchpad:bQ,TouchpadOff:_Q,TowerControl:wQ,ToyBrick:jQ,Tractor:kQ,TrafficCone:NQ,TrainFront:CQ,TrainFrontTunnel:SQ,TrainTrack:MQ,TramFront:cw,Trash:TQ,Trash2:Zn,TreeDeciduous:AQ,TreePalm:dw,TreePine:v1,Trees:EQ,Trello:IQ,TrendingDown:_1,TrendingUp:Kf,TrendingUpDown:PQ,Triangle:OQ,TriangleAlert:zh,TriangleRight:LQ,Trophy:Ha,Truck:XT,Turtle:DQ,Tv:FQ,TvMinimal:uw,TvMinimalPlay:RQ,Twitch:zQ,Twitter:BQ,Type:UQ,TypeOutline:$Q,Umbrella:VQ,UmbrellaOff:qQ,Underline:HQ,Undo:mS,Undo2:WQ,UndoDot:GQ,UnfoldHorizontal:KQ,UnfoldVertical:ZQ,Ungroup:YQ,University:hw,Unlink:QT,Unlink2:XQ,Unplug:QQ,Upload:go,Usb:JQ,User:Cc,UserCheck:vj,UserCog:JT,UserMinus:eJ,UserPen:tJ,UserPlus:Qh,UserRound:yw,UserRoundCheck:fw,UserRoundCog:pw,UserRoundMinus:mw,UserRoundPen:rJ,UserRoundPlus:gw,UserRoundSearch:nJ,UserRoundX:xw,UserSearch:sJ,UserX:iJ,Users:Kn,UsersRound:vw,Utensils:bw,UtensilsCrossed:_w,UtilityPole:aJ,Variable:eA,Vault:oJ,Vegan:lJ,VenetianMask:cJ,Vibrate:uJ,VibrateOff:dJ,Video:Fi,VideoOff:hJ,Videotape:fJ,View:pJ,Voicemail:mJ,Volleyball:gJ,Volume:bJ,Volume1:xJ,Volume2:yJ,VolumeOff:vJ,VolumeX:_J,Vote:wJ,Wallet:kJ,WalletCards:jJ,WalletMinimal:ww,Wallpaper:NJ,Wand:SJ,WandSparkles:jw,Warehouse:CJ,WashingMachine:MJ,Watch:TJ,Waves:AJ,Waypoints:EJ,Webcam:IJ,Webhook:LJ,WebhookOff:PJ,Weight:OJ,Wheat:RJ,WheatOff:DJ,WholeWord:FJ,Wifi:qJ,WifiHigh:zJ,WifiLow:BJ,WifiOff:$J,WifiZero:UJ,Wind:HJ,WindArrowDown:VJ,Wine:GJ,WineOff:WJ,Workflow:KJ,Worm:ZJ,WrapText:YJ,Wrench:Gx,X:Ts,Youtube:XJ,Zap:jg,ZapOff:QJ,ZoomIn:gS,ZoomOut:xS},Symbol.toStringTag,{value:"Module"}));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CAe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:m8,AArrowDownIcon:m8,AArrowUp:g8,AArrowUpIcon:g8,ALargeSmall:x8,ALargeSmallIcon:x8,Accessibility:y8,AccessibilityIcon:y8,Activity:xg,ActivityIcon:xg,ActivitySquare:db,ActivitySquareIcon:db,AirVent:v8,AirVentIcon:v8,Airplay:_8,AirplayIcon:_8,AlarmCheck:u_,AlarmCheckIcon:u_,AlarmClock:w8,AlarmClockCheck:u_,AlarmClockCheckIcon:u_,AlarmClockIcon:w8,AlarmClockMinus:h_,AlarmClockMinusIcon:h_,AlarmClockOff:b8,AlarmClockOffIcon:b8,AlarmClockPlus:f_,AlarmClockPlusIcon:f_,AlarmMinus:h_,AlarmMinusIcon:h_,AlarmPlus:f_,AlarmPlusIcon:f_,AlarmSmoke:j8,AlarmSmokeIcon:j8,Album:k8,AlbumIcon:k8,AlertCircle:El,AlertCircleIcon:El,AlertOctagon:q2,AlertOctagonIcon:q2,AlertTriangle:zh,AlertTriangleIcon:zh,AlignCenter:K4,AlignCenterHorizontal:N8,AlignCenterHorizontalIcon:N8,AlignCenterIcon:K4,AlignCenterVertical:S8,AlignCenterVerticalIcon:S8,AlignEndHorizontal:C8,AlignEndHorizontalIcon:C8,AlignEndVertical:M8,AlignEndVerticalIcon:M8,AlignHorizontalDistributeCenter:T8,AlignHorizontalDistributeCenterIcon:T8,AlignHorizontalDistributeEnd:A8,AlignHorizontalDistributeEndIcon:A8,AlignHorizontalDistributeStart:E8,AlignHorizontalDistributeStartIcon:E8,AlignHorizontalJustifyCenter:I8,AlignHorizontalJustifyCenterIcon:I8,AlignHorizontalJustifyEnd:P8,AlignHorizontalJustifyEndIcon:P8,AlignHorizontalJustifyStart:L8,AlignHorizontalJustifyStartIcon:L8,AlignHorizontalSpaceAround:O8,AlignHorizontalSpaceAroundIcon:O8,AlignHorizontalSpaceBetween:D8,AlignHorizontalSpaceBetweenIcon:D8,AlignJustify:R8,AlignJustifyIcon:R8,AlignLeft:Z4,AlignLeftIcon:Z4,AlignRight:Y4,AlignRightIcon:Y4,AlignStartHorizontal:F8,AlignStartHorizontalIcon:F8,AlignStartVertical:z8,AlignStartVerticalIcon:z8,AlignVerticalDistributeCenter:B8,AlignVerticalDistributeCenterIcon:B8,AlignVerticalDistributeEnd:$8,AlignVerticalDistributeEndIcon:$8,AlignVerticalDistributeStart:U8,AlignVerticalDistributeStartIcon:U8,AlignVerticalJustifyCenter:q8,AlignVerticalJustifyCenterIcon:q8,AlignVerticalJustifyEnd:V8,AlignVerticalJustifyEndIcon:V8,AlignVerticalJustifyStart:H8,AlignVerticalJustifyStartIcon:H8,AlignVerticalSpaceAround:W8,AlignVerticalSpaceAroundIcon:W8,AlignVerticalSpaceBetween:G8,AlignVerticalSpaceBetweenIcon:G8,Ambulance:K8,AmbulanceIcon:K8,Ampersand:Z8,AmpersandIcon:Z8,Ampersands:Y8,AmpersandsIcon:Y8,Amphora:X8,AmphoraIcon:X8,Anchor:Q8,AnchorIcon:Q8,Angry:J8,AngryIcon:J8,Annoyed:eO,AnnoyedIcon:eO,Antenna:tO,AntennaIcon:tO,Anvil:rO,AnvilIcon:rO,Aperture:nO,ApertureIcon:nO,AppWindow:ST,AppWindowIcon:ST,AppWindowMac:sO,AppWindowMacIcon:sO,Apple:iO,AppleIcon:iO,Archive:lO,ArchiveIcon:lO,ArchiveRestore:aO,ArchiveRestoreIcon:aO,ArchiveX:oO,ArchiveXIcon:oO,AreaChart:C_,AreaChartIcon:C_,Armchair:cO,ArmchairIcon:cO,ArrowBigDown:uO,ArrowBigDownDash:dO,ArrowBigDownDashIcon:dO,ArrowBigDownIcon:uO,ArrowBigLeft:fO,ArrowBigLeftDash:hO,ArrowBigLeftDashIcon:hO,ArrowBigLeftIcon:fO,ArrowBigRight:mO,ArrowBigRightDash:pO,ArrowBigRightDashIcon:pO,ArrowBigRightIcon:mO,ArrowBigUp:xO,ArrowBigUpDash:gO,ArrowBigUpDashIcon:gO,ArrowBigUpIcon:xO,ArrowDown:n1,ArrowDown01:yO,ArrowDown01Icon:yO,ArrowDown10:vO,ArrowDown10Icon:vO,ArrowDownAZ:p_,ArrowDownAZIcon:p_,ArrowDownAz:p_,ArrowDownAzIcon:p_,ArrowDownCircle:z_,ArrowDownCircleIcon:z_,ArrowDownFromLine:_O,ArrowDownFromLineIcon:_O,ArrowDownIcon:n1,ArrowDownLeft:bO,ArrowDownLeftFromCircle:$_,ArrowDownLeftFromCircleIcon:$_,ArrowDownLeftFromSquare:mb,ArrowDownLeftFromSquareIcon:mb,ArrowDownLeftIcon:bO,ArrowDownLeftSquare:ub,ArrowDownLeftSquareIcon:ub,ArrowDownNarrowWide:wO,ArrowDownNarrowWideIcon:wO,ArrowDownRight:jO,ArrowDownRightFromCircle:U_,ArrowDownRightFromCircleIcon:U_,ArrowDownRightFromSquare:gb,ArrowDownRightFromSquareIcon:gb,ArrowDownRightIcon:jO,ArrowDownRightSquare:hb,ArrowDownRightSquareIcon:hb,ArrowDownSquare:fb,ArrowDownSquareIcon:fb,ArrowDownToDot:kO,ArrowDownToDotIcon:kO,ArrowDownToLine:NO,ArrowDownToLineIcon:NO,ArrowDownUp:SO,ArrowDownUpIcon:SO,ArrowDownWideNarrow:m_,ArrowDownWideNarrowIcon:m_,ArrowDownZA:g_,ArrowDownZAIcon:g_,ArrowDownZa:g_,ArrowDownZaIcon:g_,ArrowLeft:Qa,ArrowLeftCircle:B_,ArrowLeftCircleIcon:B_,ArrowLeftFromLine:CO,ArrowLeftFromLineIcon:CO,ArrowLeftIcon:Qa,ArrowLeftRight:MO,ArrowLeftRightIcon:MO,ArrowLeftSquare:pb,ArrowLeftSquareIcon:pb,ArrowLeftToLine:TO,ArrowLeftToLineIcon:TO,ArrowRight:Ko,ArrowRightCircle:H_,ArrowRightCircleIcon:H_,ArrowRightFromLine:AO,ArrowRightFromLineIcon:AO,ArrowRightIcon:Ko,ArrowRightLeft:EO,ArrowRightLeftIcon:EO,ArrowRightSquare:vb,ArrowRightSquareIcon:vb,ArrowRightToLine:IO,ArrowRightToLineIcon:IO,ArrowUp:yg,ArrowUp01:PO,ArrowUp01Icon:PO,ArrowUp10:LO,ArrowUp10Icon:LO,ArrowUpAZ:x_,ArrowUpAZIcon:x_,ArrowUpAz:x_,ArrowUpAzIcon:x_,ArrowUpCircle:W_,ArrowUpCircleIcon:W_,ArrowUpDown:zx,ArrowUpDownIcon:zx,ArrowUpFromDot:OO,ArrowUpFromDotIcon:OO,ArrowUpFromLine:DO,ArrowUpFromLineIcon:DO,ArrowUpIcon:yg,ArrowUpLeft:RO,ArrowUpLeftFromCircle:q_,ArrowUpLeftFromCircleIcon:q_,ArrowUpLeftFromSquare:xb,ArrowUpLeftFromSquareIcon:xb,ArrowUpLeftIcon:RO,ArrowUpLeftSquare:_b,ArrowUpLeftSquareIcon:_b,ArrowUpNarrowWide:y_,ArrowUpNarrowWideIcon:y_,ArrowUpRight:FO,ArrowUpRightFromCircle:V_,ArrowUpRightFromCircleIcon:V_,ArrowUpRightFromSquare:yb,ArrowUpRightFromSquareIcon:yb,ArrowUpRightIcon:FO,ArrowUpRightSquare:bb,ArrowUpRightSquareIcon:bb,ArrowUpSquare:wb,ArrowUpSquareIcon:wb,ArrowUpToLine:zO,ArrowUpToLineIcon:zO,ArrowUpWideNarrow:BO,ArrowUpWideNarrowIcon:BO,ArrowUpZA:v_,ArrowUpZAIcon:v_,ArrowUpZa:v_,ArrowUpZaIcon:v_,ArrowsUpFromLine:$O,ArrowsUpFromLineIcon:$O,Asterisk:UO,AsteriskIcon:UO,AsteriskSquare:jb,AsteriskSquareIcon:jb,AtSign:qO,AtSignIcon:qO,Atom:VO,AtomIcon:VO,AudioLines:HO,AudioLinesIcon:HO,AudioWaveform:WO,AudioWaveformIcon:WO,Award:Pl,AwardIcon:Pl,Axe:GO,AxeIcon:GO,Axis3D:__,Axis3DIcon:__,Axis3d:__,Axis3dIcon:__,Baby:KO,BabyIcon:KO,Backpack:ZO,BackpackIcon:ZO,Badge:uD,BadgeAlert:YO,BadgeAlertIcon:YO,BadgeCent:XO,BadgeCentIcon:XO,BadgeCheck:b_,BadgeCheckIcon:b_,BadgeDollarSign:QO,BadgeDollarSignIcon:QO,BadgeEuro:JO,BadgeEuroIcon:JO,BadgeHelp:eD,BadgeHelpIcon:eD,BadgeIcon:uD,BadgeIndianRupee:tD,BadgeIndianRupeeIcon:tD,BadgeInfo:rD,BadgeInfoIcon:rD,BadgeJapaneseYen:nD,BadgeJapaneseYenIcon:nD,BadgeMinus:sD,BadgeMinusIcon:sD,BadgePercent:iD,BadgePercentIcon:iD,BadgePlus:aD,BadgePlusIcon:aD,BadgePoundSterling:oD,BadgePoundSterlingIcon:oD,BadgeRussianRuble:lD,BadgeRussianRubleIcon:lD,BadgeSwissFranc:cD,BadgeSwissFrancIcon:cD,BadgeX:dD,BadgeXIcon:dD,BaggageClaim:hD,BaggageClaimIcon:hD,Ban:fD,BanIcon:fD,Banana:pD,BananaIcon:pD,Bandage:mD,BandageIcon:mD,Banknote:gD,BanknoteIcon:gD,BarChart:L_,BarChart2:O_,BarChart2Icon:O_,BarChart3:ac,BarChart3Icon:ac,BarChart4:I_,BarChart4Icon:I_,BarChartBig:E_,BarChartBigIcon:E_,BarChartHorizontal:T_,BarChartHorizontalBig:M_,BarChartHorizontalBigIcon:M_,BarChartHorizontalIcon:T_,BarChartIcon:L_,Barcode:xD,BarcodeIcon:xD,Baseline:yD,BaselineIcon:yD,Bath:qf,BathIcon:qf,Battery:kD,BatteryCharging:vD,BatteryChargingIcon:vD,BatteryFull:_D,BatteryFullIcon:_D,BatteryIcon:kD,BatteryLow:bD,BatteryLowIcon:bD,BatteryMedium:wD,BatteryMediumIcon:wD,BatteryWarning:jD,BatteryWarningIcon:jD,Beaker:ND,BeakerIcon:ND,Bean:CD,BeanIcon:CD,BeanOff:SD,BeanOffIcon:SD,Bed:Vf,BedDouble:MD,BedDoubleIcon:MD,BedIcon:Vf,BedSingle:TD,BedSingleIcon:TD,Beef:AD,BeefIcon:AD,Beer:ID,BeerIcon:ID,BeerOff:ED,BeerOffIcon:ED,Bell:vg,BellDot:PD,BellDotIcon:PD,BellElectric:LD,BellElectricIcon:LD,BellIcon:vg,BellMinus:OD,BellMinusIcon:OD,BellOff:aj,BellOffIcon:aj,BellPlus:DD,BellPlusIcon:DD,BellRing:RD,BellRingIcon:RD,BetweenHorizonalEnd:w_,BetweenHorizonalEndIcon:w_,BetweenHorizonalStart:j_,BetweenHorizonalStartIcon:j_,BetweenHorizontalEnd:w_,BetweenHorizontalEndIcon:w_,BetweenHorizontalStart:j_,BetweenHorizontalStartIcon:j_,BetweenVerticalEnd:FD,BetweenVerticalEndIcon:FD,BetweenVerticalStart:zD,BetweenVerticalStartIcon:zD,BicepsFlexed:BD,BicepsFlexedIcon:BD,Bike:$D,BikeIcon:$D,Binary:UD,BinaryIcon:UD,Binoculars:qD,BinocularsIcon:qD,Biohazard:VD,BiohazardIcon:VD,Bird:HD,BirdIcon:HD,Bitcoin:WD,BitcoinIcon:WD,Blend:GD,BlendIcon:GD,Blinds:KD,BlindsIcon:KD,Blocks:ZD,BlocksIcon:ZD,Bluetooth:JD,BluetoothConnected:YD,BluetoothConnectedIcon:YD,BluetoothIcon:JD,BluetoothOff:XD,BluetoothOffIcon:XD,BluetoothSearching:QD,BluetoothSearchingIcon:QD,Bold:X4,BoldIcon:X4,Bolt:eR,BoltIcon:eR,Bomb:tR,BombIcon:tR,Bone:rR,BoneIcon:rR,Book:kR,BookA:nR,BookAIcon:nR,BookAudio:sR,BookAudioIcon:sR,BookCheck:iR,BookCheckIcon:iR,BookCopy:aR,BookCopyIcon:aR,BookDashed:k_,BookDashedIcon:k_,BookDown:oR,BookDownIcon:oR,BookHeadphones:lR,BookHeadphonesIcon:lR,BookHeart:cR,BookHeartIcon:cR,BookIcon:kR,BookImage:dR,BookImageIcon:dR,BookKey:uR,BookKeyIcon:uR,BookLock:hR,BookLockIcon:hR,BookMarked:fR,BookMarkedIcon:fR,BookMinus:pR,BookMinusIcon:pR,BookOpen:CT,BookOpenCheck:mR,BookOpenCheckIcon:mR,BookOpenIcon:CT,BookOpenText:gR,BookOpenTextIcon:gR,BookPlus:xR,BookPlusIcon:xR,BookTemplate:k_,BookTemplateIcon:k_,BookText:yR,BookTextIcon:yR,BookType:vR,BookTypeIcon:vR,BookUp:bR,BookUp2:_R,BookUp2Icon:_R,BookUpIcon:bR,BookUser:wR,BookUserIcon:wR,BookX:jR,BookXIcon:jR,Bookmark:dm,BookmarkCheck:NR,BookmarkCheckIcon:NR,BookmarkIcon:dm,BookmarkMinus:SR,BookmarkMinusIcon:SR,BookmarkPlus:CR,BookmarkPlusIcon:CR,BookmarkX:MR,BookmarkXIcon:MR,BoomBox:TR,BoomBoxIcon:TR,Bot:Q4,BotIcon:Q4,BotMessageSquare:AR,BotMessageSquareIcon:AR,BotOff:ER,BotOffIcon:ER,Box:IR,BoxIcon:IR,BoxSelect:Pb,BoxSelectIcon:Pb,Boxes:PR,BoxesIcon:PR,Braces:N_,BracesIcon:N_,Brackets:LR,BracketsIcon:LR,Brain:MT,BrainCircuit:OR,BrainCircuitIcon:OR,BrainCog:DR,BrainCogIcon:DR,BrainIcon:MT,BrickWall:RR,BrickWallIcon:RR,Briefcase:gh,BriefcaseBusiness:FR,BriefcaseBusinessIcon:FR,BriefcaseConveyorBelt:zR,BriefcaseConveyorBeltIcon:zR,BriefcaseIcon:gh,BriefcaseMedical:BR,BriefcaseMedicalIcon:BR,BringToFront:$R,BringToFrontIcon:$R,Brush:UR,BrushIcon:UR,Bug:HR,BugIcon:HR,BugOff:qR,BugOffIcon:qR,BugPlay:VR,BugPlayIcon:VR,Building:oj,Building2:na,Building2Icon:na,BuildingIcon:oj,Bus:GR,BusFront:WR,BusFrontIcon:WR,BusIcon:GR,Cable:ZR,CableCar:KR,CableCarIcon:KR,CableIcon:ZR,Cake:Gh,CakeIcon:Gh,CakeSlice:YR,CakeSliceIcon:YR,Calculator:XR,CalculatorIcon:XR,Calendar:Ys,Calendar1:QR,Calendar1Icon:QR,CalendarArrowDown:JR,CalendarArrowDownIcon:JR,CalendarArrowUp:eF,CalendarArrowUpIcon:eF,CalendarCheck:rF,CalendarCheck2:tF,CalendarCheck2Icon:tF,CalendarCheckIcon:rF,CalendarClock:nF,CalendarClockIcon:nF,CalendarCog:sF,CalendarCogIcon:sF,CalendarDays:um,CalendarDaysIcon:um,CalendarFold:iF,CalendarFoldIcon:iF,CalendarHeart:aF,CalendarHeartIcon:aF,CalendarIcon:Ys,CalendarMinus:lF,CalendarMinus2:oF,CalendarMinus2Icon:oF,CalendarMinusIcon:lF,CalendarOff:cF,CalendarOffIcon:cF,CalendarPlus:lj,CalendarPlus2:dF,CalendarPlus2Icon:dF,CalendarPlusIcon:lj,CalendarRange:uF,CalendarRangeIcon:uF,CalendarSearch:hF,CalendarSearchIcon:hF,CalendarSync:fF,CalendarSyncIcon:fF,CalendarX:mF,CalendarX2:pF,CalendarX2Icon:pF,CalendarXIcon:mF,Camera:s1,CameraIcon:s1,CameraOff:gF,CameraOffIcon:gF,CandlestickChart:A_,CandlestickChartIcon:A_,Candy:vF,CandyCane:xF,CandyCaneIcon:xF,CandyIcon:vF,CandyOff:yF,CandyOffIcon:yF,Cannabis:_F,CannabisIcon:_F,Captions:S_,CaptionsIcon:S_,CaptionsOff:bF,CaptionsOffIcon:bF,Car:kF,CarFront:wF,CarFrontIcon:wF,CarIcon:kF,CarTaxiFront:jF,CarTaxiFrontIcon:jF,Caravan:NF,CaravanIcon:NF,Carrot:SF,CarrotIcon:SF,CaseLower:CF,CaseLowerIcon:CF,CaseSensitive:MF,CaseSensitiveIcon:MF,CaseUpper:TF,CaseUpperIcon:TF,CassetteTape:AF,CassetteTapeIcon:AF,Cast:EF,CastIcon:EF,Castle:IF,CastleIcon:IF,Cat:PF,CatIcon:PF,Cctv:LF,CctvIcon:LF,ChartArea:C_,ChartAreaIcon:C_,ChartBar:T_,ChartBarBig:M_,ChartBarBigIcon:M_,ChartBarDecreasing:OF,ChartBarDecreasingIcon:OF,ChartBarIcon:T_,ChartBarIncreasing:DF,ChartBarIncreasingIcon:DF,ChartBarStacked:RF,ChartBarStackedIcon:RF,ChartCandlestick:A_,ChartCandlestickIcon:A_,ChartColumn:ac,ChartColumnBig:E_,ChartColumnBigIcon:E_,ChartColumnDecreasing:FF,ChartColumnDecreasingIcon:FF,ChartColumnIcon:ac,ChartColumnIncreasing:I_,ChartColumnIncreasingIcon:I_,ChartColumnStacked:zF,ChartColumnStackedIcon:zF,ChartGantt:BF,ChartGanttIcon:BF,ChartLine:P_,ChartLineIcon:P_,ChartNetwork:$F,ChartNetworkIcon:$F,ChartNoAxesColumn:O_,ChartNoAxesColumnDecreasing:UF,ChartNoAxesColumnDecreasingIcon:UF,ChartNoAxesColumnIcon:O_,ChartNoAxesColumnIncreasing:L_,ChartNoAxesColumnIncreasingIcon:L_,ChartNoAxesCombined:qF,ChartNoAxesCombinedIcon:qF,ChartNoAxesGantt:D_,ChartNoAxesGanttIcon:D_,ChartPie:R_,ChartPieIcon:R_,ChartScatter:F_,ChartScatterIcon:F_,ChartSpline:VF,ChartSplineIcon:VF,Check:Ca,CheckCheck:HF,CheckCheckIcon:HF,CheckCircle:qa,CheckCircle2:Za,CheckCircle2Icon:Za,CheckCircleIcon:qa,CheckIcon:Ca,CheckSquare:p0,CheckSquare2:Nb,CheckSquare2Icon:Nb,CheckSquareIcon:p0,ChefHat:WF,ChefHatIcon:WF,Cherry:GF,CherryIcon:GF,ChevronDown:Iu,ChevronDownCircle:G_,ChevronDownCircleIcon:G_,ChevronDownIcon:Iu,ChevronDownSquare:Sb,ChevronDownSquareIcon:Sb,ChevronFirst:KF,ChevronFirstIcon:KF,ChevronLast:ZF,ChevronLastIcon:ZF,ChevronLeft:qc,ChevronLeftCircle:K_,ChevronLeftCircleIcon:K_,ChevronLeftIcon:qc,ChevronLeftSquare:Cb,ChevronLeftSquareIcon:Cb,ChevronRight:Ga,ChevronRightCircle:Z_,ChevronRightCircleIcon:Z_,ChevronRightIcon:Ga,ChevronRightSquare:Mb,ChevronRightSquareIcon:Mb,ChevronUp:i1,ChevronUpCircle:Y_,ChevronUpCircleIcon:Y_,ChevronUpIcon:i1,ChevronUpSquare:Tb,ChevronUpSquareIcon:Tb,ChevronsDown:XF,ChevronsDownIcon:XF,ChevronsDownUp:YF,ChevronsDownUpIcon:YF,ChevronsLeft:ez,ChevronsLeftIcon:ez,ChevronsLeftRight:JF,ChevronsLeftRightEllipsis:QF,ChevronsLeftRightEllipsisIcon:QF,ChevronsLeftRightIcon:JF,ChevronsRight:rz,ChevronsRightIcon:rz,ChevronsRightLeft:tz,ChevronsRightLeftIcon:tz,ChevronsUp:nz,ChevronsUpDown:a1,ChevronsUpDownIcon:a1,ChevronsUpIcon:nz,Chrome:sz,ChromeIcon:sz,Church:iz,ChurchIcon:iz,Cigarette:oz,CigaretteIcon:oz,CigaretteOff:az,CigaretteOffIcon:az,Circle:Pu,CircleAlert:El,CircleAlertIcon:El,CircleArrowDown:z_,CircleArrowDownIcon:z_,CircleArrowLeft:B_,CircleArrowLeftIcon:B_,CircleArrowOutDownLeft:$_,CircleArrowOutDownLeftIcon:$_,CircleArrowOutDownRight:U_,CircleArrowOutDownRightIcon:U_,CircleArrowOutUpLeft:q_,CircleArrowOutUpLeftIcon:q_,CircleArrowOutUpRight:V_,CircleArrowOutUpRightIcon:V_,CircleArrowRight:H_,CircleArrowRightIcon:H_,CircleArrowUp:W_,CircleArrowUpIcon:W_,CircleCheck:Za,CircleCheckBig:qa,CircleCheckBigIcon:qa,CircleCheckIcon:Za,CircleChevronDown:G_,CircleChevronDownIcon:G_,CircleChevronLeft:K_,CircleChevronLeftIcon:K_,CircleChevronRight:Z_,CircleChevronRightIcon:Z_,CircleChevronUp:Y_,CircleChevronUpIcon:Y_,CircleDashed:lz,CircleDashedIcon:lz,CircleDivide:X_,CircleDivideIcon:X_,CircleDollarSign:cz,CircleDollarSignIcon:cz,CircleDot:uz,CircleDotDashed:dz,CircleDotDashedIcon:dz,CircleDotIcon:uz,CircleEllipsis:hz,CircleEllipsisIcon:hz,CircleEqual:fz,CircleEqualIcon:fz,CircleFadingArrowUp:pz,CircleFadingArrowUpIcon:pz,CircleFadingPlus:mz,CircleFadingPlusIcon:mz,CircleGauge:Q_,CircleGaugeIcon:Q_,CircleHelp:Nx,CircleHelpIcon:Nx,CircleIcon:Pu,CircleMinus:J_,CircleMinusIcon:J_,CircleOff:gz,CircleOffIcon:gz,CircleParking:t2,CircleParkingIcon:t2,CircleParkingOff:e2,CircleParkingOffIcon:e2,CirclePause:r2,CirclePauseIcon:r2,CirclePercent:n2,CirclePercentIcon:n2,CirclePlay:Of,CirclePlayIcon:Of,CirclePlus:s2,CirclePlusIcon:s2,CirclePower:i2,CirclePowerIcon:i2,CircleSlash:xz,CircleSlash2:a2,CircleSlash2Icon:a2,CircleSlashIcon:xz,CircleSlashed:a2,CircleSlashedIcon:a2,CircleStop:o2,CircleStopIcon:o2,CircleUser:c2,CircleUserIcon:c2,CircleUserRound:l2,CircleUserRoundIcon:l2,CircleX:zc,CircleXIcon:zc,CircuitBoard:yz,CircuitBoardIcon:yz,Citrus:vz,CitrusIcon:vz,Clapperboard:_z,ClapperboardIcon:_z,Clipboard:Mz,ClipboardCheck:TT,ClipboardCheckIcon:TT,ClipboardCopy:bz,ClipboardCopyIcon:bz,ClipboardEdit:u2,ClipboardEditIcon:u2,ClipboardIcon:Mz,ClipboardList:wz,ClipboardListIcon:wz,ClipboardMinus:jz,ClipboardMinusIcon:jz,ClipboardPaste:kz,ClipboardPasteIcon:kz,ClipboardPen:u2,ClipboardPenIcon:u2,ClipboardPenLine:d2,ClipboardPenLineIcon:d2,ClipboardPlus:Nz,ClipboardPlusIcon:Nz,ClipboardSignature:d2,ClipboardSignatureIcon:d2,ClipboardType:Sz,ClipboardTypeIcon:Sz,ClipboardX:Cz,ClipboardXIcon:Cz,Clock:Ki,Clock1:Tz,Clock10:Az,Clock10Icon:Az,Clock11:Ez,Clock11Icon:Ez,Clock12:Iz,Clock12Icon:Iz,Clock1Icon:Tz,Clock2:Pz,Clock2Icon:Pz,Clock3:Lz,Clock3Icon:Lz,Clock4:Oz,Clock4Icon:Oz,Clock5:Dz,Clock5Icon:Dz,Clock6:Rz,Clock6Icon:Rz,Clock7:Fz,Clock7Icon:Fz,Clock8:zz,Clock8Icon:zz,Clock9:Bz,Clock9Icon:Bz,ClockAlert:$z,ClockAlertIcon:$z,ClockArrowDown:Uz,ClockArrowDownIcon:Uz,ClockArrowUp:qz,ClockArrowUpIcon:qz,ClockIcon:Ki,Cloud:s7,CloudAlert:Vz,CloudAlertIcon:Vz,CloudCog:Hz,CloudCogIcon:Hz,CloudDownload:h2,CloudDownloadIcon:h2,CloudDrizzle:Wz,CloudDrizzleIcon:Wz,CloudFog:Gz,CloudFogIcon:Gz,CloudHail:Kz,CloudHailIcon:Kz,CloudIcon:s7,CloudLightning:Zz,CloudLightningIcon:Zz,CloudMoon:Xz,CloudMoonIcon:Xz,CloudMoonRain:Yz,CloudMoonRainIcon:Yz,CloudOff:Qz,CloudOffIcon:Qz,CloudRain:e7,CloudRainIcon:e7,CloudRainWind:Jz,CloudRainWindIcon:Jz,CloudSnow:t7,CloudSnowIcon:t7,CloudSun:n7,CloudSunIcon:n7,CloudSunRain:r7,CloudSunRainIcon:r7,CloudUpload:f2,CloudUploadIcon:f2,Cloudy:i7,CloudyIcon:i7,Clover:Px,CloverIcon:Px,Club:a7,ClubIcon:a7,Code:cj,Code2:p2,Code2Icon:p2,CodeIcon:cj,CodeSquare:Ab,CodeSquareIcon:Ab,CodeXml:p2,CodeXmlIcon:p2,Codepen:o7,CodepenIcon:o7,Codesandbox:l7,CodesandboxIcon:l7,Coffee:dj,CoffeeIcon:dj,Cog:c7,CogIcon:c7,Coins:d7,CoinsIcon:d7,Columns:m2,Columns2:m2,Columns2Icon:m2,Columns3:g2,Columns3Icon:g2,Columns4:u7,Columns4Icon:u7,ColumnsIcon:m2,Combine:h7,CombineIcon:h7,Command:f7,CommandIcon:f7,Compass:p7,CompassIcon:p7,Component:m7,ComponentIcon:m7,Computer:g7,ComputerIcon:g7,ConciergeBell:x7,ConciergeBellIcon:x7,Cone:y7,ConeIcon:y7,Construction:v7,ConstructionIcon:v7,Contact:_7,Contact2:x2,Contact2Icon:x2,ContactIcon:_7,ContactRound:x2,ContactRoundIcon:x2,Container:b7,ContainerIcon:b7,Contrast:w7,ContrastIcon:w7,Cookie:j7,CookieIcon:j7,CookingPot:k7,CookingPotIcon:k7,Copy:jl,CopyCheck:N7,CopyCheckIcon:N7,CopyIcon:jl,CopyMinus:S7,CopyMinusIcon:S7,CopyPlus:C7,CopyPlusIcon:C7,CopySlash:M7,CopySlashIcon:M7,CopyX:T7,CopyXIcon:T7,Copyleft:A7,CopyleftIcon:A7,Copyright:E7,CopyrightIcon:E7,CornerDownLeft:I7,CornerDownLeftIcon:I7,CornerDownRight:P7,CornerDownRightIcon:P7,CornerLeftDown:L7,CornerLeftDownIcon:L7,CornerLeftUp:O7,CornerLeftUpIcon:O7,CornerRightDown:D7,CornerRightDownIcon:D7,CornerRightUp:R7,CornerRightUpIcon:R7,CornerUpLeft:F7,CornerUpLeftIcon:F7,CornerUpRight:z7,CornerUpRightIcon:z7,Cpu:B7,CpuIcon:B7,CreativeCommons:$7,CreativeCommonsIcon:$7,CreditCard:hm,CreditCardIcon:hm,Croissant:U7,CroissantIcon:U7,Crop:q7,CropIcon:q7,Cross:V7,CrossIcon:V7,Crosshair:H7,CrosshairIcon:H7,Crown:o1,CrownIcon:o1,Cuboid:W7,CuboidIcon:W7,CupSoda:G7,CupSodaIcon:G7,CurlyBraces:N_,CurlyBracesIcon:N_,Currency:K7,CurrencyIcon:K7,Cylinder:Z7,CylinderIcon:Z7,Dam:Y7,DamIcon:Y7,Database:J7,DatabaseBackup:X7,DatabaseBackupIcon:X7,DatabaseIcon:J7,DatabaseZap:Q7,DatabaseZapIcon:Q7,Delete:e9,DeleteIcon:e9,Dessert:t9,DessertIcon:t9,Diameter:r9,DiameterIcon:r9,Diamond:i9,DiamondIcon:i9,DiamondMinus:n9,DiamondMinusIcon:n9,DiamondPercent:y2,DiamondPercentIcon:y2,DiamondPlus:s9,DiamondPlusIcon:s9,Dice1:a9,Dice1Icon:a9,Dice2:o9,Dice2Icon:o9,Dice3:l9,Dice3Icon:l9,Dice4:c9,Dice4Icon:c9,Dice5:d9,Dice5Icon:d9,Dice6:u9,Dice6Icon:u9,Dices:h9,DicesIcon:h9,Diff:f9,DiffIcon:f9,Disc:x9,Disc2:p9,Disc2Icon:p9,Disc3:m9,Disc3Icon:m9,DiscAlbum:g9,DiscAlbumIcon:g9,DiscIcon:x9,Divide:y9,DivideCircle:X_,DivideCircleIcon:X_,DivideIcon:y9,DivideSquare:Lb,DivideSquareIcon:Lb,Dna:_9,DnaIcon:_9,DnaOff:v9,DnaOffIcon:v9,Dock:b9,DockIcon:b9,Dog:w9,DogIcon:w9,DollarSign:ud,DollarSignIcon:ud,Donut:j9,DonutIcon:j9,DoorClosed:k9,DoorClosedIcon:k9,DoorOpen:l1,DoorOpenIcon:l1,Dot:N9,DotIcon:N9,DotSquare:Ob,DotSquareIcon:Ob,Download:Xa,DownloadCloud:h2,DownloadCloudIcon:h2,DownloadIcon:Xa,DraftingCompass:S9,DraftingCompassIcon:S9,Drama:C9,DramaIcon:C9,Dribbble:M9,DribbbleIcon:M9,Drill:T9,DrillIcon:T9,Droplet:A9,DropletIcon:A9,Droplets:E9,DropletsIcon:E9,Drum:I9,DrumIcon:I9,Drumstick:P9,DrumstickIcon:P9,Dumbbell:L9,DumbbellIcon:L9,Ear:D9,EarIcon:D9,EarOff:O9,EarOffIcon:O9,Earth:v2,EarthIcon:v2,EarthLock:R9,EarthLockIcon:R9,Eclipse:F9,EclipseIcon:F9,Edit:rc,Edit2:f0,Edit2Icon:f0,Edit3:eb,Edit3Icon:eb,EditIcon:rc,Egg:J4,EggFried:z9,EggFriedIcon:z9,EggIcon:J4,EggOff:B9,EggOffIcon:B9,Ellipsis:og,EllipsisIcon:og,EllipsisVertical:Sx,EllipsisVerticalIcon:Sx,Equal:q9,EqualApproximately:$9,EqualApproximatelyIcon:$9,EqualIcon:q9,EqualNot:U9,EqualNotIcon:U9,EqualSquare:Db,EqualSquareIcon:Db,Eraser:V9,EraserIcon:V9,EthernetPort:H9,EthernetPortIcon:H9,Euro:W9,EuroIcon:W9,Expand:G9,ExpandIcon:G9,ExternalLink:Ls,ExternalLinkIcon:Ls,Eye:Qo,EyeClosed:K9,EyeClosedIcon:K9,EyeIcon:Qo,EyeOff:c1,EyeOffIcon:c1,Facebook:Pd,FacebookIcon:Pd,Factory:Z9,FactoryIcon:Z9,Fan:Y9,FanIcon:Y9,FastForward:X9,FastForwardIcon:X9,Feather:Q9,FeatherIcon:Q9,Fence:J9,FenceIcon:J9,FerrisWheel:eB,FerrisWheelIcon:eB,Figma:tB,FigmaIcon:tB,File:ZB,FileArchive:rB,FileArchiveIcon:rB,FileAudio:sB,FileAudio2:nB,FileAudio2Icon:nB,FileAudioIcon:sB,FileAxis3D:_2,FileAxis3DIcon:_2,FileAxis3d:_2,FileAxis3dIcon:_2,FileBadge:aB,FileBadge2:iB,FileBadge2Icon:iB,FileBadgeIcon:aB,FileBarChart:b2,FileBarChart2:w2,FileBarChart2Icon:w2,FileBarChartIcon:b2,FileBox:oB,FileBoxIcon:oB,FileChartColumn:w2,FileChartColumnIcon:w2,FileChartColumnIncreasing:b2,FileChartColumnIncreasingIcon:b2,FileChartLine:j2,FileChartLineIcon:j2,FileChartPie:k2,FileChartPieIcon:k2,FileCheck:cB,FileCheck2:lB,FileCheck2Icon:lB,FileCheckIcon:cB,FileClock:dB,FileClockIcon:dB,FileCode:hB,FileCode2:uB,FileCode2Icon:uB,FileCodeIcon:hB,FileCog:N2,FileCog2:N2,FileCog2Icon:N2,FileCogIcon:N2,FileDiff:fB,FileDiffIcon:fB,FileDigit:pB,FileDigitIcon:pB,FileDown:mB,FileDownIcon:mB,FileEdit:C2,FileEditIcon:C2,FileHeart:gB,FileHeartIcon:gB,FileIcon:ZB,FileImage:d1,FileImageIcon:d1,FileInput:xB,FileInputIcon:xB,FileJson:vB,FileJson2:yB,FileJson2Icon:yB,FileJsonIcon:vB,FileKey:bB,FileKey2:_B,FileKey2Icon:_B,FileKeyIcon:bB,FileLineChart:j2,FileLineChartIcon:j2,FileLock:jB,FileLock2:wB,FileLock2Icon:wB,FileLockIcon:jB,FileMinus:NB,FileMinus2:kB,FileMinus2Icon:kB,FileMinusIcon:NB,FileMusic:SB,FileMusicIcon:SB,FileOutput:CB,FileOutputIcon:CB,FilePen:C2,FilePenIcon:C2,FilePenLine:S2,FilePenLineIcon:S2,FilePieChart:k2,FilePieChartIcon:k2,FilePlus:TB,FilePlus2:MB,FilePlus2Icon:MB,FilePlusIcon:TB,FileQuestion:AB,FileQuestionIcon:AB,FileScan:EB,FileScanIcon:EB,FileSearch:PB,FileSearch2:IB,FileSearch2Icon:IB,FileSearchIcon:PB,FileSignature:S2,FileSignatureIcon:S2,FileSliders:LB,FileSlidersIcon:LB,FileSpreadsheet:u1,FileSpreadsheetIcon:u1,FileStack:OB,FileStackIcon:OB,FileSymlink:DB,FileSymlinkIcon:DB,FileTerminal:RB,FileTerminalIcon:RB,FileText:Ai,FileTextIcon:Ai,FileType:zB,FileType2:FB,FileType2Icon:FB,FileTypeIcon:zB,FileUp:BB,FileUpIcon:BB,FileUser:$B,FileUserIcon:$B,FileVideo:qB,FileVideo2:UB,FileVideo2Icon:UB,FileVideoIcon:qB,FileVolume:HB,FileVolume2:VB,FileVolume2Icon:VB,FileVolumeIcon:HB,FileWarning:WB,FileWarningIcon:WB,FileX:KB,FileX2:GB,FileX2Icon:GB,FileXIcon:KB,Files:YB,FilesIcon:YB,Film:Md,FilmIcon:Md,Filter:uj,FilterIcon:uj,FilterX:XB,FilterXIcon:XB,Fingerprint:QB,FingerprintIcon:QB,FireExtinguisher:JB,FireExtinguisherIcon:JB,Fish:r$,FishIcon:r$,FishOff:e$,FishOffIcon:e$,FishSymbol:t$,FishSymbolIcon:t$,Flag:Bx,FlagIcon:Bx,FlagOff:n$,FlagOffIcon:n$,FlagTriangleLeft:s$,FlagTriangleLeftIcon:s$,FlagTriangleRight:i$,FlagTriangleRightIcon:i$,Flame:Kh,FlameIcon:Kh,FlameKindling:a$,FlameKindlingIcon:a$,Flashlight:l$,FlashlightIcon:l$,FlashlightOff:o$,FlashlightOffIcon:o$,FlaskConical:hj,FlaskConicalIcon:hj,FlaskConicalOff:c$,FlaskConicalOffIcon:c$,FlaskRound:d$,FlaskRoundIcon:d$,FlipHorizontal:h$,FlipHorizontal2:u$,FlipHorizontal2Icon:u$,FlipHorizontalIcon:h$,FlipVertical:p$,FlipVertical2:f$,FlipVertical2Icon:f$,FlipVerticalIcon:p$,Flower:m$,Flower2:im,Flower2Icon:im,FlowerIcon:m$,Focus:g$,FocusIcon:g$,FoldHorizontal:x$,FoldHorizontalIcon:x$,FoldVertical:y$,FoldVerticalIcon:y$,Folder:H$,FolderArchive:v$,FolderArchiveIcon:v$,FolderCheck:_$,FolderCheckIcon:_$,FolderClock:b$,FolderClockIcon:b$,FolderClosed:w$,FolderClosedIcon:w$,FolderCode:j$,FolderCodeIcon:j$,FolderCog:M2,FolderCog2:M2,FolderCog2Icon:M2,FolderCogIcon:M2,FolderDot:k$,FolderDotIcon:k$,FolderDown:N$,FolderDownIcon:N$,FolderEdit:T2,FolderEditIcon:T2,FolderGit:C$,FolderGit2:S$,FolderGit2Icon:S$,FolderGitIcon:C$,FolderHeart:M$,FolderHeartIcon:M$,FolderIcon:H$,FolderInput:T$,FolderInputIcon:T$,FolderKanban:A$,FolderKanbanIcon:A$,FolderKey:E$,FolderKeyIcon:E$,FolderLock:I$,FolderLockIcon:I$,FolderMinus:P$,FolderMinusIcon:P$,FolderOpen:$x,FolderOpenDot:L$,FolderOpenDotIcon:L$,FolderOpenIcon:$x,FolderOutput:O$,FolderOutputIcon:O$,FolderPen:T2,FolderPenIcon:T2,FolderPlus:D$,FolderPlusIcon:D$,FolderRoot:R$,FolderRootIcon:R$,FolderSearch:z$,FolderSearch2:F$,FolderSearch2Icon:F$,FolderSearchIcon:z$,FolderSymlink:B$,FolderSymlinkIcon:B$,FolderSync:$$,FolderSyncIcon:$$,FolderTree:U$,FolderTreeIcon:U$,FolderUp:q$,FolderUpIcon:q$,FolderX:V$,FolderXIcon:V$,Folders:W$,FoldersIcon:W$,Footprints:G$,FootprintsIcon:G$,ForkKnife:bw,ForkKnifeCrossed:_w,ForkKnifeCrossedIcon:_w,ForkKnifeIcon:bw,Forklift:K$,ForkliftIcon:K$,FormInput:rb,FormInputIcon:rb,Forward:Z$,ForwardIcon:Z$,Frame:Y$,FrameIcon:Y$,Framer:X$,FramerIcon:X$,Frown:Q$,FrownIcon:Q$,Fuel:J$,FuelIcon:J$,Fullscreen:eU,FullscreenIcon:eU,FunctionSquare:Rb,FunctionSquareIcon:Rb,GalleryHorizontal:rU,GalleryHorizontalEnd:tU,GalleryHorizontalEndIcon:tU,GalleryHorizontalIcon:rU,GalleryThumbnails:nU,GalleryThumbnailsIcon:nU,GalleryVertical:iU,GalleryVerticalEnd:sU,GalleryVerticalEndIcon:sU,GalleryVerticalIcon:iU,Gamepad:oU,Gamepad2:aU,Gamepad2Icon:aU,GamepadIcon:oU,GanttChart:D_,GanttChartIcon:D_,GanttChartSquare:Qm,GanttChartSquareIcon:Qm,Gauge:lU,GaugeCircle:Q_,GaugeCircleIcon:Q_,GaugeIcon:lU,Gavel:cU,GavelIcon:cU,Gem:dU,GemIcon:dU,Ghost:fj,GhostIcon:fj,Gift:Va,GiftIcon:Va,GitBranch:hU,GitBranchIcon:hU,GitBranchPlus:uU,GitBranchPlusIcon:uU,GitCommit:A2,GitCommitHorizontal:A2,GitCommitHorizontalIcon:A2,GitCommitIcon:A2,GitCommitVertical:fU,GitCommitVerticalIcon:fU,GitCompare:mU,GitCompareArrows:pU,GitCompareArrowsIcon:pU,GitCompareIcon:mU,GitFork:gU,GitForkIcon:gU,GitGraph:xU,GitGraphIcon:xU,GitMerge:yU,GitMergeIcon:yU,GitPullRequest:kU,GitPullRequestArrow:vU,GitPullRequestArrowIcon:vU,GitPullRequestClosed:_U,GitPullRequestClosedIcon:_U,GitPullRequestCreate:wU,GitPullRequestCreateArrow:bU,GitPullRequestCreateArrowIcon:bU,GitPullRequestCreateIcon:wU,GitPullRequestDraft:jU,GitPullRequestDraftIcon:jU,GitPullRequestIcon:kU,Github:NU,GithubIcon:NU,Gitlab:SU,GitlabIcon:SU,GlassWater:CU,GlassWaterIcon:CU,Glasses:MU,GlassesIcon:MU,Globe:Ux,Globe2:v2,Globe2Icon:v2,GlobeIcon:Ux,GlobeLock:TU,GlobeLockIcon:TU,Goal:AU,GoalIcon:AU,Grab:EU,GrabIcon:EU,GraduationCap:h1,GraduationCapIcon:h1,Grape:IU,GrapeIcon:IU,Grid:Oh,Grid2X2:I2,Grid2X2Icon:I2,Grid2X2Plus:E2,Grid2X2PlusIcon:E2,Grid2x2:I2,Grid2x2Check:PU,Grid2x2CheckIcon:PU,Grid2x2Icon:I2,Grid2x2Plus:E2,Grid2x2PlusIcon:E2,Grid2x2X:LU,Grid2x2XIcon:LU,Grid3X3:Oh,Grid3X3Icon:Oh,Grid3x3:Oh,Grid3x3Icon:Oh,GridIcon:Oh,Grip:DU,GripHorizontal:OU,GripHorizontalIcon:OU,GripIcon:DU,GripVertical:pj,GripVerticalIcon:pj,Group:RU,GroupIcon:RU,Guitar:FU,GuitarIcon:FU,Ham:zU,HamIcon:zU,Hammer:BU,HammerIcon:BU,Hand:HU,HandCoins:$U,HandCoinsIcon:$U,HandHeart:UU,HandHeartIcon:UU,HandHelping:P2,HandHelpingIcon:P2,HandIcon:HU,HandMetal:qU,HandMetalIcon:qU,HandPlatter:VU,HandPlatterIcon:VU,Handshake:WU,HandshakeIcon:WU,HardDrive:AT,HardDriveDownload:GU,HardDriveDownloadIcon:GU,HardDriveIcon:AT,HardDriveUpload:KU,HardDriveUploadIcon:KU,HardHat:ZU,HardHatIcon:ZU,Hash:eS,HashIcon:eS,Haze:YU,HazeIcon:YU,HdmiPort:XU,HdmiPortIcon:XU,Heading:rq,Heading1:ET,Heading1Icon:ET,Heading2:IT,Heading2Icon:IT,Heading3:QU,Heading3Icon:QU,Heading4:JU,Heading4Icon:JU,Heading5:eq,Heading5Icon:eq,Heading6:tq,Heading6Icon:tq,HeadingIcon:rq,HeadphoneOff:nq,HeadphoneOffIcon:nq,Headphones:sq,HeadphonesIcon:sq,Headset:iq,HeadsetIcon:iq,Heart:oa,HeartCrack:aq,HeartCrackIcon:aq,HeartHandshake:oq,HeartHandshakeIcon:oq,HeartIcon:oa,HeartOff:lq,HeartOffIcon:lq,HeartPulse:cq,HeartPulseIcon:cq,Heater:dq,HeaterIcon:dq,HelpCircle:Nx,HelpCircleIcon:Nx,HelpingHand:P2,HelpingHandIcon:P2,Hexagon:uq,HexagonIcon:uq,Highlighter:hq,HighlighterIcon:hq,History:tS,HistoryIcon:tS,Home:fi,HomeIcon:fi,Hop:pq,HopIcon:pq,HopOff:fq,HopOffIcon:fq,Hospital:mq,HospitalIcon:mq,Hotel:gq,HotelIcon:gq,Hourglass:xq,HourglassIcon:xq,House:fi,HouseIcon:fi,HousePlug:yq,HousePlugIcon:yq,HousePlus:vq,HousePlusIcon:vq,IceCream:O2,IceCream2:L2,IceCream2Icon:L2,IceCreamBowl:L2,IceCreamBowlIcon:L2,IceCreamCone:O2,IceCreamConeIcon:O2,IceCreamIcon:O2,Icon:SAe,IdCard:_q,IdCardIcon:_q,Image:Zo,ImageDown:bq,ImageDownIcon:bq,ImageIcon:Zo,ImageMinus:wq,ImageMinusIcon:wq,ImageOff:jq,ImageOffIcon:jq,ImagePlay:kq,ImagePlayIcon:kq,ImagePlus:rS,ImagePlusIcon:rS,ImageUp:Nq,ImageUpIcon:Nq,ImageUpscale:Sq,ImageUpscaleIcon:Sq,Images:Cq,ImagesIcon:Cq,Import:Mq,ImportIcon:Mq,Inbox:Tq,InboxIcon:Tq,Indent:R2,IndentDecrease:D2,IndentDecreaseIcon:D2,IndentIcon:R2,IndentIncrease:R2,IndentIncreaseIcon:R2,IndianRupee:Aq,IndianRupeeIcon:Aq,Infinity:Eq,InfinityIcon:Eq,Info:Iq,InfoIcon:Iq,Inspect:qb,InspectIcon:qb,InspectionPanel:Pq,InspectionPanelIcon:Pq,Instagram:eu,InstagramIcon:eu,Italic:nS,ItalicIcon:nS,IterationCcw:Lq,IterationCcwIcon:Lq,IterationCw:Oq,IterationCwIcon:Oq,JapaneseYen:Dq,JapaneseYenIcon:Dq,Joystick:Rq,JoystickIcon:Rq,Kanban:f1,KanbanIcon:f1,KanbanSquare:Fb,KanbanSquareDashed:Eb,KanbanSquareDashedIcon:Eb,KanbanSquareIcon:Fb,Key:Zh,KeyIcon:Zh,KeyRound:mj,KeyRoundIcon:mj,KeySquare:Fq,KeySquareIcon:Fq,Keyboard:$q,KeyboardIcon:$q,KeyboardMusic:zq,KeyboardMusicIcon:zq,KeyboardOff:Bq,KeyboardOffIcon:Bq,Lamp:Gq,LampCeiling:Uq,LampCeilingIcon:Uq,LampDesk:qq,LampDeskIcon:qq,LampFloor:Vq,LampFloorIcon:Vq,LampIcon:Gq,LampWallDown:Hq,LampWallDownIcon:Hq,LampWallUp:Wq,LampWallUpIcon:Wq,LandPlot:Kq,LandPlotIcon:Kq,Landmark:Zq,LandmarkIcon:Zq,Languages:Yq,LanguagesIcon:Yq,Laptop:Qq,Laptop2:F2,Laptop2Icon:F2,LaptopIcon:Qq,LaptopMinimal:F2,LaptopMinimalCheck:Xq,LaptopMinimalCheckIcon:Xq,LaptopMinimalIcon:F2,Lasso:eV,LassoIcon:eV,LassoSelect:Jq,LassoSelectIcon:Jq,Laugh:tV,LaughIcon:tV,Layers:sV,Layers2:rV,Layers2Icon:rV,Layers3:nV,Layers3Icon:nV,LayersIcon:sV,Layout:h0,LayoutDashboard:sS,LayoutDashboardIcon:sS,LayoutGrid:fm,LayoutGridIcon:fm,LayoutIcon:h0,LayoutList:iV,LayoutListIcon:iV,LayoutPanelLeft:aV,LayoutPanelLeftIcon:aV,LayoutPanelTop:oV,LayoutPanelTopIcon:oV,LayoutTemplate:lV,LayoutTemplateIcon:lV,Leaf:cV,LeafIcon:cV,LeafyGreen:dV,LeafyGreenIcon:dV,Lectern:uV,LecternIcon:uV,LetterText:hV,LetterTextIcon:hV,Library:iS,LibraryBig:fV,LibraryBigIcon:fV,LibraryIcon:iS,LibrarySquare:zb,LibrarySquareIcon:zb,LifeBuoy:aS,LifeBuoyIcon:aS,Ligature:pV,LigatureIcon:pV,Lightbulb:p1,LightbulbIcon:p1,LightbulbOff:mV,LightbulbOffIcon:mV,LineChart:P_,LineChartIcon:P_,Link:So,Link2:Yh,Link2Icon:Yh,Link2Off:gV,Link2OffIcon:gV,LinkIcon:So,Linkedin:pm,LinkedinIcon:pm,List:Hf,ListCheck:xV,ListCheckIcon:xV,ListChecks:yV,ListChecksIcon:yV,ListCollapse:vV,ListCollapseIcon:vV,ListEnd:_V,ListEndIcon:_V,ListFilter:bV,ListFilterIcon:bV,ListIcon:Hf,ListMinus:wV,ListMinusIcon:wV,ListMusic:jV,ListMusicIcon:jV,ListOrdered:oS,ListOrderedIcon:oS,ListPlus:kV,ListPlusIcon:kV,ListRestart:NV,ListRestartIcon:NV,ListStart:SV,ListStartIcon:SV,ListTodo:CV,ListTodoIcon:CV,ListTree:MV,ListTreeIcon:MV,ListVideo:TV,ListVideoIcon:TV,ListX:AV,ListXIcon:AV,Loader:IV,Loader2:nn,Loader2Icon:nn,LoaderCircle:nn,LoaderCircleIcon:nn,LoaderIcon:IV,LoaderPinwheel:EV,LoaderPinwheelIcon:EV,Locate:PT,LocateFixed:PV,LocateFixedIcon:PV,LocateIcon:PT,LocateOff:LV,LocateOffIcon:LV,Lock:Wf,LockIcon:Wf,LockKeyhole:OV,LockKeyholeIcon:OV,LockKeyholeOpen:z2,LockKeyholeOpenIcon:z2,LockOpen:B2,LockOpenIcon:B2,LogIn:lS,LogInIcon:lS,LogOut:cS,LogOutIcon:cS,Logs:DV,LogsIcon:DV,Lollipop:RV,LollipopIcon:RV,LucideAArrowDown:m8,LucideAArrowUp:g8,LucideALargeSmall:x8,LucideAccessibility:y8,LucideActivity:xg,LucideActivitySquare:db,LucideAirVent:v8,LucideAirplay:_8,LucideAlarmCheck:u_,LucideAlarmClock:w8,LucideAlarmClockCheck:u_,LucideAlarmClockMinus:h_,LucideAlarmClockOff:b8,LucideAlarmClockPlus:f_,LucideAlarmMinus:h_,LucideAlarmPlus:f_,LucideAlarmSmoke:j8,LucideAlbum:k8,LucideAlertCircle:El,LucideAlertOctagon:q2,LucideAlertTriangle:zh,LucideAlignCenter:K4,LucideAlignCenterHorizontal:N8,LucideAlignCenterVertical:S8,LucideAlignEndHorizontal:C8,LucideAlignEndVertical:M8,LucideAlignHorizontalDistributeCenter:T8,LucideAlignHorizontalDistributeEnd:A8,LucideAlignHorizontalDistributeStart:E8,LucideAlignHorizontalJustifyCenter:I8,LucideAlignHorizontalJustifyEnd:P8,LucideAlignHorizontalJustifyStart:L8,LucideAlignHorizontalSpaceAround:O8,LucideAlignHorizontalSpaceBetween:D8,LucideAlignJustify:R8,LucideAlignLeft:Z4,LucideAlignRight:Y4,LucideAlignStartHorizontal:F8,LucideAlignStartVertical:z8,LucideAlignVerticalDistributeCenter:B8,LucideAlignVerticalDistributeEnd:$8,LucideAlignVerticalDistributeStart:U8,LucideAlignVerticalJustifyCenter:q8,LucideAlignVerticalJustifyEnd:V8,LucideAlignVerticalJustifyStart:H8,LucideAlignVerticalSpaceAround:W8,LucideAlignVerticalSpaceBetween:G8,LucideAmbulance:K8,LucideAmpersand:Z8,LucideAmpersands:Y8,LucideAmphora:X8,LucideAnchor:Q8,LucideAngry:J8,LucideAnnoyed:eO,LucideAntenna:tO,LucideAnvil:rO,LucideAperture:nO,LucideAppWindow:ST,LucideAppWindowMac:sO,LucideApple:iO,LucideArchive:lO,LucideArchiveRestore:aO,LucideArchiveX:oO,LucideAreaChart:C_,LucideArmchair:cO,LucideArrowBigDown:uO,LucideArrowBigDownDash:dO,LucideArrowBigLeft:fO,LucideArrowBigLeftDash:hO,LucideArrowBigRight:mO,LucideArrowBigRightDash:pO,LucideArrowBigUp:xO,LucideArrowBigUpDash:gO,LucideArrowDown:n1,LucideArrowDown01:yO,LucideArrowDown10:vO,LucideArrowDownAZ:p_,LucideArrowDownAz:p_,LucideArrowDownCircle:z_,LucideArrowDownFromLine:_O,LucideArrowDownLeft:bO,LucideArrowDownLeftFromCircle:$_,LucideArrowDownLeftFromSquare:mb,LucideArrowDownLeftSquare:ub,LucideArrowDownNarrowWide:wO,LucideArrowDownRight:jO,LucideArrowDownRightFromCircle:U_,LucideArrowDownRightFromSquare:gb,LucideArrowDownRightSquare:hb,LucideArrowDownSquare:fb,LucideArrowDownToDot:kO,LucideArrowDownToLine:NO,LucideArrowDownUp:SO,LucideArrowDownWideNarrow:m_,LucideArrowDownZA:g_,LucideArrowDownZa:g_,LucideArrowLeft:Qa,LucideArrowLeftCircle:B_,LucideArrowLeftFromLine:CO,LucideArrowLeftRight:MO,LucideArrowLeftSquare:pb,LucideArrowLeftToLine:TO,LucideArrowRight:Ko,LucideArrowRightCircle:H_,LucideArrowRightFromLine:AO,LucideArrowRightLeft:EO,LucideArrowRightSquare:vb,LucideArrowRightToLine:IO,LucideArrowUp:yg,LucideArrowUp01:PO,LucideArrowUp10:LO,LucideArrowUpAZ:x_,LucideArrowUpAz:x_,LucideArrowUpCircle:W_,LucideArrowUpDown:zx,LucideArrowUpFromDot:OO,LucideArrowUpFromLine:DO,LucideArrowUpLeft:RO,LucideArrowUpLeftFromCircle:q_,LucideArrowUpLeftFromSquare:xb,LucideArrowUpLeftSquare:_b,LucideArrowUpNarrowWide:y_,LucideArrowUpRight:FO,LucideArrowUpRightFromCircle:V_,LucideArrowUpRightFromSquare:yb,LucideArrowUpRightSquare:bb,LucideArrowUpSquare:wb,LucideArrowUpToLine:zO,LucideArrowUpWideNarrow:BO,LucideArrowUpZA:v_,LucideArrowUpZa:v_,LucideArrowsUpFromLine:$O,LucideAsterisk:UO,LucideAsteriskSquare:jb,LucideAtSign:qO,LucideAtom:VO,LucideAudioLines:HO,LucideAudioWaveform:WO,LucideAward:Pl,LucideAxe:GO,LucideAxis3D:__,LucideAxis3d:__,LucideBaby:KO,LucideBackpack:ZO,LucideBadge:uD,LucideBadgeAlert:YO,LucideBadgeCent:XO,LucideBadgeCheck:b_,LucideBadgeDollarSign:QO,LucideBadgeEuro:JO,LucideBadgeHelp:eD,LucideBadgeIndianRupee:tD,LucideBadgeInfo:rD,LucideBadgeJapaneseYen:nD,LucideBadgeMinus:sD,LucideBadgePercent:iD,LucideBadgePlus:aD,LucideBadgePoundSterling:oD,LucideBadgeRussianRuble:lD,LucideBadgeSwissFranc:cD,LucideBadgeX:dD,LucideBaggageClaim:hD,LucideBan:fD,LucideBanana:pD,LucideBandage:mD,LucideBanknote:gD,LucideBarChart:L_,LucideBarChart2:O_,LucideBarChart3:ac,LucideBarChart4:I_,LucideBarChartBig:E_,LucideBarChartHorizontal:T_,LucideBarChartHorizontalBig:M_,LucideBarcode:xD,LucideBaseline:yD,LucideBath:qf,LucideBattery:kD,LucideBatteryCharging:vD,LucideBatteryFull:_D,LucideBatteryLow:bD,LucideBatteryMedium:wD,LucideBatteryWarning:jD,LucideBeaker:ND,LucideBean:CD,LucideBeanOff:SD,LucideBed:Vf,LucideBedDouble:MD,LucideBedSingle:TD,LucideBeef:AD,LucideBeer:ID,LucideBeerOff:ED,LucideBell:vg,LucideBellDot:PD,LucideBellElectric:LD,LucideBellMinus:OD,LucideBellOff:aj,LucideBellPlus:DD,LucideBellRing:RD,LucideBetweenHorizonalEnd:w_,LucideBetweenHorizonalStart:j_,LucideBetweenHorizontalEnd:w_,LucideBetweenHorizontalStart:j_,LucideBetweenVerticalEnd:FD,LucideBetweenVerticalStart:zD,LucideBicepsFlexed:BD,LucideBike:$D,LucideBinary:UD,LucideBinoculars:qD,LucideBiohazard:VD,LucideBird:HD,LucideBitcoin:WD,LucideBlend:GD,LucideBlinds:KD,LucideBlocks:ZD,LucideBluetooth:JD,LucideBluetoothConnected:YD,LucideBluetoothOff:XD,LucideBluetoothSearching:QD,LucideBold:X4,LucideBolt:eR,LucideBomb:tR,LucideBone:rR,LucideBook:kR,LucideBookA:nR,LucideBookAudio:sR,LucideBookCheck:iR,LucideBookCopy:aR,LucideBookDashed:k_,LucideBookDown:oR,LucideBookHeadphones:lR,LucideBookHeart:cR,LucideBookImage:dR,LucideBookKey:uR,LucideBookLock:hR,LucideBookMarked:fR,LucideBookMinus:pR,LucideBookOpen:CT,LucideBookOpenCheck:mR,LucideBookOpenText:gR,LucideBookPlus:xR,LucideBookTemplate:k_,LucideBookText:yR,LucideBookType:vR,LucideBookUp:bR,LucideBookUp2:_R,LucideBookUser:wR,LucideBookX:jR,LucideBookmark:dm,LucideBookmarkCheck:NR,LucideBookmarkMinus:SR,LucideBookmarkPlus:CR,LucideBookmarkX:MR,LucideBoomBox:TR,LucideBot:Q4,LucideBotMessageSquare:AR,LucideBotOff:ER,LucideBox:IR,LucideBoxSelect:Pb,LucideBoxes:PR,LucideBraces:N_,LucideBrackets:LR,LucideBrain:MT,LucideBrainCircuit:OR,LucideBrainCog:DR,LucideBrickWall:RR,LucideBriefcase:gh,LucideBriefcaseBusiness:FR,LucideBriefcaseConveyorBelt:zR,LucideBriefcaseMedical:BR,LucideBringToFront:$R,LucideBrush:UR,LucideBug:HR,LucideBugOff:qR,LucideBugPlay:VR,LucideBuilding:oj,LucideBuilding2:na,LucideBus:GR,LucideBusFront:WR,LucideCable:ZR,LucideCableCar:KR,LucideCake:Gh,LucideCakeSlice:YR,LucideCalculator:XR,LucideCalendar:Ys,LucideCalendar1:QR,LucideCalendarArrowDown:JR,LucideCalendarArrowUp:eF,LucideCalendarCheck:rF,LucideCalendarCheck2:tF,LucideCalendarClock:nF,LucideCalendarCog:sF,LucideCalendarDays:um,LucideCalendarFold:iF,LucideCalendarHeart:aF,LucideCalendarMinus:lF,LucideCalendarMinus2:oF,LucideCalendarOff:cF,LucideCalendarPlus:lj,LucideCalendarPlus2:dF,LucideCalendarRange:uF,LucideCalendarSearch:hF,LucideCalendarSync:fF,LucideCalendarX:mF,LucideCalendarX2:pF,LucideCamera:s1,LucideCameraOff:gF,LucideCandlestickChart:A_,LucideCandy:vF,LucideCandyCane:xF,LucideCandyOff:yF,LucideCannabis:_F,LucideCaptions:S_,LucideCaptionsOff:bF,LucideCar:kF,LucideCarFront:wF,LucideCarTaxiFront:jF,LucideCaravan:NF,LucideCarrot:SF,LucideCaseLower:CF,LucideCaseSensitive:MF,LucideCaseUpper:TF,LucideCassetteTape:AF,LucideCast:EF,LucideCastle:IF,LucideCat:PF,LucideCctv:LF,LucideChartArea:C_,LucideChartBar:T_,LucideChartBarBig:M_,LucideChartBarDecreasing:OF,LucideChartBarIncreasing:DF,LucideChartBarStacked:RF,LucideChartCandlestick:A_,LucideChartColumn:ac,LucideChartColumnBig:E_,LucideChartColumnDecreasing:FF,LucideChartColumnIncreasing:I_,LucideChartColumnStacked:zF,LucideChartGantt:BF,LucideChartLine:P_,LucideChartNetwork:$F,LucideChartNoAxesColumn:O_,LucideChartNoAxesColumnDecreasing:UF,LucideChartNoAxesColumnIncreasing:L_,LucideChartNoAxesCombined:qF,LucideChartNoAxesGantt:D_,LucideChartPie:R_,LucideChartScatter:F_,LucideChartSpline:VF,LucideCheck:Ca,LucideCheckCheck:HF,LucideCheckCircle:qa,LucideCheckCircle2:Za,LucideCheckSquare:p0,LucideCheckSquare2:Nb,LucideChefHat:WF,LucideCherry:GF,LucideChevronDown:Iu,LucideChevronDownCircle:G_,LucideChevronDownSquare:Sb,LucideChevronFirst:KF,LucideChevronLast:ZF,LucideChevronLeft:qc,LucideChevronLeftCircle:K_,LucideChevronLeftSquare:Cb,LucideChevronRight:Ga,LucideChevronRightCircle:Z_,LucideChevronRightSquare:Mb,LucideChevronUp:i1,LucideChevronUpCircle:Y_,LucideChevronUpSquare:Tb,LucideChevronsDown:XF,LucideChevronsDownUp:YF,LucideChevronsLeft:ez,LucideChevronsLeftRight:JF,LucideChevronsLeftRightEllipsis:QF,LucideChevronsRight:rz,LucideChevronsRightLeft:tz,LucideChevronsUp:nz,LucideChevronsUpDown:a1,LucideChrome:sz,LucideChurch:iz,LucideCigarette:oz,LucideCigaretteOff:az,LucideCircle:Pu,LucideCircleAlert:El,LucideCircleArrowDown:z_,LucideCircleArrowLeft:B_,LucideCircleArrowOutDownLeft:$_,LucideCircleArrowOutDownRight:U_,LucideCircleArrowOutUpLeft:q_,LucideCircleArrowOutUpRight:V_,LucideCircleArrowRight:H_,LucideCircleArrowUp:W_,LucideCircleCheck:Za,LucideCircleCheckBig:qa,LucideCircleChevronDown:G_,LucideCircleChevronLeft:K_,LucideCircleChevronRight:Z_,LucideCircleChevronUp:Y_,LucideCircleDashed:lz,LucideCircleDivide:X_,LucideCircleDollarSign:cz,LucideCircleDot:uz,LucideCircleDotDashed:dz,LucideCircleEllipsis:hz,LucideCircleEqual:fz,LucideCircleFadingArrowUp:pz,LucideCircleFadingPlus:mz,LucideCircleGauge:Q_,LucideCircleHelp:Nx,LucideCircleMinus:J_,LucideCircleOff:gz,LucideCircleParking:t2,LucideCircleParkingOff:e2,LucideCirclePause:r2,LucideCirclePercent:n2,LucideCirclePlay:Of,LucideCirclePlus:s2,LucideCirclePower:i2,LucideCircleSlash:xz,LucideCircleSlash2:a2,LucideCircleSlashed:a2,LucideCircleStop:o2,LucideCircleUser:c2,LucideCircleUserRound:l2,LucideCircleX:zc,LucideCircuitBoard:yz,LucideCitrus:vz,LucideClapperboard:_z,LucideClipboard:Mz,LucideClipboardCheck:TT,LucideClipboardCopy:bz,LucideClipboardEdit:u2,LucideClipboardList:wz,LucideClipboardMinus:jz,LucideClipboardPaste:kz,LucideClipboardPen:u2,LucideClipboardPenLine:d2,LucideClipboardPlus:Nz,LucideClipboardSignature:d2,LucideClipboardType:Sz,LucideClipboardX:Cz,LucideClock:Ki,LucideClock1:Tz,LucideClock10:Az,LucideClock11:Ez,LucideClock12:Iz,LucideClock2:Pz,LucideClock3:Lz,LucideClock4:Oz,LucideClock5:Dz,LucideClock6:Rz,LucideClock7:Fz,LucideClock8:zz,LucideClock9:Bz,LucideClockAlert:$z,LucideClockArrowDown:Uz,LucideClockArrowUp:qz,LucideCloud:s7,LucideCloudAlert:Vz,LucideCloudCog:Hz,LucideCloudDownload:h2,LucideCloudDrizzle:Wz,LucideCloudFog:Gz,LucideCloudHail:Kz,LucideCloudLightning:Zz,LucideCloudMoon:Xz,LucideCloudMoonRain:Yz,LucideCloudOff:Qz,LucideCloudRain:e7,LucideCloudRainWind:Jz,LucideCloudSnow:t7,LucideCloudSun:n7,LucideCloudSunRain:r7,LucideCloudUpload:f2,LucideCloudy:i7,LucideClover:Px,LucideClub:a7,LucideCode:cj,LucideCode2:p2,LucideCodeSquare:Ab,LucideCodeXml:p2,LucideCodepen:o7,LucideCodesandbox:l7,LucideCoffee:dj,LucideCog:c7,LucideCoins:d7,LucideColumns:m2,LucideColumns2:m2,LucideColumns3:g2,LucideColumns4:u7,LucideCombine:h7,LucideCommand:f7,LucideCompass:p7,LucideComponent:m7,LucideComputer:g7,LucideConciergeBell:x7,LucideCone:y7,LucideConstruction:v7,LucideContact:_7,LucideContact2:x2,LucideContactRound:x2,LucideContainer:b7,LucideContrast:w7,LucideCookie:j7,LucideCookingPot:k7,LucideCopy:jl,LucideCopyCheck:N7,LucideCopyMinus:S7,LucideCopyPlus:C7,LucideCopySlash:M7,LucideCopyX:T7,LucideCopyleft:A7,LucideCopyright:E7,LucideCornerDownLeft:I7,LucideCornerDownRight:P7,LucideCornerLeftDown:L7,LucideCornerLeftUp:O7,LucideCornerRightDown:D7,LucideCornerRightUp:R7,LucideCornerUpLeft:F7,LucideCornerUpRight:z7,LucideCpu:B7,LucideCreativeCommons:$7,LucideCreditCard:hm,LucideCroissant:U7,LucideCrop:q7,LucideCross:V7,LucideCrosshair:H7,LucideCrown:o1,LucideCuboid:W7,LucideCupSoda:G7,LucideCurlyBraces:N_,LucideCurrency:K7,LucideCylinder:Z7,LucideDam:Y7,LucideDatabase:J7,LucideDatabaseBackup:X7,LucideDatabaseZap:Q7,LucideDelete:e9,LucideDessert:t9,LucideDiameter:r9,LucideDiamond:i9,LucideDiamondMinus:n9,LucideDiamondPercent:y2,LucideDiamondPlus:s9,LucideDice1:a9,LucideDice2:o9,LucideDice3:l9,LucideDice4:c9,LucideDice5:d9,LucideDice6:u9,LucideDices:h9,LucideDiff:f9,LucideDisc:x9,LucideDisc2:p9,LucideDisc3:m9,LucideDiscAlbum:g9,LucideDivide:y9,LucideDivideCircle:X_,LucideDivideSquare:Lb,LucideDna:_9,LucideDnaOff:v9,LucideDock:b9,LucideDog:w9,LucideDollarSign:ud,LucideDonut:j9,LucideDoorClosed:k9,LucideDoorOpen:l1,LucideDot:N9,LucideDotSquare:Ob,LucideDownload:Xa,LucideDownloadCloud:h2,LucideDraftingCompass:S9,LucideDrama:C9,LucideDribbble:M9,LucideDrill:T9,LucideDroplet:A9,LucideDroplets:E9,LucideDrum:I9,LucideDrumstick:P9,LucideDumbbell:L9,LucideEar:D9,LucideEarOff:O9,LucideEarth:v2,LucideEarthLock:R9,LucideEclipse:F9,LucideEdit:rc,LucideEdit2:f0,LucideEdit3:eb,LucideEgg:J4,LucideEggFried:z9,LucideEggOff:B9,LucideEllipsis:og,LucideEllipsisVertical:Sx,LucideEqual:q9,LucideEqualApproximately:$9,LucideEqualNot:U9,LucideEqualSquare:Db,LucideEraser:V9,LucideEthernetPort:H9,LucideEuro:W9,LucideExpand:G9,LucideExternalLink:Ls,LucideEye:Qo,LucideEyeClosed:K9,LucideEyeOff:c1,LucideFacebook:Pd,LucideFactory:Z9,LucideFan:Y9,LucideFastForward:X9,LucideFeather:Q9,LucideFence:J9,LucideFerrisWheel:eB,LucideFigma:tB,LucideFile:ZB,LucideFileArchive:rB,LucideFileAudio:sB,LucideFileAudio2:nB,LucideFileAxis3D:_2,LucideFileAxis3d:_2,LucideFileBadge:aB,LucideFileBadge2:iB,LucideFileBarChart:b2,LucideFileBarChart2:w2,LucideFileBox:oB,LucideFileChartColumn:w2,LucideFileChartColumnIncreasing:b2,LucideFileChartLine:j2,LucideFileChartPie:k2,LucideFileCheck:cB,LucideFileCheck2:lB,LucideFileClock:dB,LucideFileCode:hB,LucideFileCode2:uB,LucideFileCog:N2,LucideFileCog2:N2,LucideFileDiff:fB,LucideFileDigit:pB,LucideFileDown:mB,LucideFileEdit:C2,LucideFileHeart:gB,LucideFileImage:d1,LucideFileInput:xB,LucideFileJson:vB,LucideFileJson2:yB,LucideFileKey:bB,LucideFileKey2:_B,LucideFileLineChart:j2,LucideFileLock:jB,LucideFileLock2:wB,LucideFileMinus:NB,LucideFileMinus2:kB,LucideFileMusic:SB,LucideFileOutput:CB,LucideFilePen:C2,LucideFilePenLine:S2,LucideFilePieChart:k2,LucideFilePlus:TB,LucideFilePlus2:MB,LucideFileQuestion:AB,LucideFileScan:EB,LucideFileSearch:PB,LucideFileSearch2:IB,LucideFileSignature:S2,LucideFileSliders:LB,LucideFileSpreadsheet:u1,LucideFileStack:OB,LucideFileSymlink:DB,LucideFileTerminal:RB,LucideFileText:Ai,LucideFileType:zB,LucideFileType2:FB,LucideFileUp:BB,LucideFileUser:$B,LucideFileVideo:qB,LucideFileVideo2:UB,LucideFileVolume:HB,LucideFileVolume2:VB,LucideFileWarning:WB,LucideFileX:KB,LucideFileX2:GB,LucideFiles:YB,LucideFilm:Md,LucideFilter:uj,LucideFilterX:XB,LucideFingerprint:QB,LucideFireExtinguisher:JB,LucideFish:r$,LucideFishOff:e$,LucideFishSymbol:t$,LucideFlag:Bx,LucideFlagOff:n$,LucideFlagTriangleLeft:s$,LucideFlagTriangleRight:i$,LucideFlame:Kh,LucideFlameKindling:a$,LucideFlashlight:l$,LucideFlashlightOff:o$,LucideFlaskConical:hj,LucideFlaskConicalOff:c$,LucideFlaskRound:d$,LucideFlipHorizontal:h$,LucideFlipHorizontal2:u$,LucideFlipVertical:p$,LucideFlipVertical2:f$,LucideFlower:m$,LucideFlower2:im,LucideFocus:g$,LucideFoldHorizontal:x$,LucideFoldVertical:y$,LucideFolder:H$,LucideFolderArchive:v$,LucideFolderCheck:_$,LucideFolderClock:b$,LucideFolderClosed:w$,LucideFolderCode:j$,LucideFolderCog:M2,LucideFolderCog2:M2,LucideFolderDot:k$,LucideFolderDown:N$,LucideFolderEdit:T2,LucideFolderGit:C$,LucideFolderGit2:S$,LucideFolderHeart:M$,LucideFolderInput:T$,LucideFolderKanban:A$,LucideFolderKey:E$,LucideFolderLock:I$,LucideFolderMinus:P$,LucideFolderOpen:$x,LucideFolderOpenDot:L$,LucideFolderOutput:O$,LucideFolderPen:T2,LucideFolderPlus:D$,LucideFolderRoot:R$,LucideFolderSearch:z$,LucideFolderSearch2:F$,LucideFolderSymlink:B$,LucideFolderSync:$$,LucideFolderTree:U$,LucideFolderUp:q$,LucideFolderX:V$,LucideFolders:W$,LucideFootprints:G$,LucideForkKnife:bw,LucideForkKnifeCrossed:_w,LucideForklift:K$,LucideFormInput:rb,LucideForward:Z$,LucideFrame:Y$,LucideFramer:X$,LucideFrown:Q$,LucideFuel:J$,LucideFullscreen:eU,LucideFunctionSquare:Rb,LucideGalleryHorizontal:rU,LucideGalleryHorizontalEnd:tU,LucideGalleryThumbnails:nU,LucideGalleryVertical:iU,LucideGalleryVerticalEnd:sU,LucideGamepad:oU,LucideGamepad2:aU,LucideGanttChart:D_,LucideGanttChartSquare:Qm,LucideGauge:lU,LucideGaugeCircle:Q_,LucideGavel:cU,LucideGem:dU,LucideGhost:fj,LucideGift:Va,LucideGitBranch:hU,LucideGitBranchPlus:uU,LucideGitCommit:A2,LucideGitCommitHorizontal:A2,LucideGitCommitVertical:fU,LucideGitCompare:mU,LucideGitCompareArrows:pU,LucideGitFork:gU,LucideGitGraph:xU,LucideGitMerge:yU,LucideGitPullRequest:kU,LucideGitPullRequestArrow:vU,LucideGitPullRequestClosed:_U,LucideGitPullRequestCreate:wU,LucideGitPullRequestCreateArrow:bU,LucideGitPullRequestDraft:jU,LucideGithub:NU,LucideGitlab:SU,LucideGlassWater:CU,LucideGlasses:MU,LucideGlobe:Ux,LucideGlobe2:v2,LucideGlobeLock:TU,LucideGoal:AU,LucideGrab:EU,LucideGraduationCap:h1,LucideGrape:IU,LucideGrid:Oh,LucideGrid2X2:I2,LucideGrid2X2Plus:E2,LucideGrid2x2:I2,LucideGrid2x2Check:PU,LucideGrid2x2Plus:E2,LucideGrid2x2X:LU,LucideGrid3X3:Oh,LucideGrid3x3:Oh,LucideGrip:DU,LucideGripHorizontal:OU,LucideGripVertical:pj,LucideGroup:RU,LucideGuitar:FU,LucideHam:zU,LucideHammer:BU,LucideHand:HU,LucideHandCoins:$U,LucideHandHeart:UU,LucideHandHelping:P2,LucideHandMetal:qU,LucideHandPlatter:VU,LucideHandshake:WU,LucideHardDrive:AT,LucideHardDriveDownload:GU,LucideHardDriveUpload:KU,LucideHardHat:ZU,LucideHash:eS,LucideHaze:YU,LucideHdmiPort:XU,LucideHeading:rq,LucideHeading1:ET,LucideHeading2:IT,LucideHeading3:QU,LucideHeading4:JU,LucideHeading5:eq,LucideHeading6:tq,LucideHeadphoneOff:nq,LucideHeadphones:sq,LucideHeadset:iq,LucideHeart:oa,LucideHeartCrack:aq,LucideHeartHandshake:oq,LucideHeartOff:lq,LucideHeartPulse:cq,LucideHeater:dq,LucideHelpCircle:Nx,LucideHelpingHand:P2,LucideHexagon:uq,LucideHighlighter:hq,LucideHistory:tS,LucideHome:fi,LucideHop:pq,LucideHopOff:fq,LucideHospital:mq,LucideHotel:gq,LucideHourglass:xq,LucideHouse:fi,LucideHousePlug:yq,LucideHousePlus:vq,LucideIceCream:O2,LucideIceCream2:L2,LucideIceCreamBowl:L2,LucideIceCreamCone:O2,LucideIdCard:_q,LucideImage:Zo,LucideImageDown:bq,LucideImageMinus:wq,LucideImageOff:jq,LucideImagePlay:kq,LucideImagePlus:rS,LucideImageUp:Nq,LucideImageUpscale:Sq,LucideImages:Cq,LucideImport:Mq,LucideInbox:Tq,LucideIndent:R2,LucideIndentDecrease:D2,LucideIndentIncrease:R2,LucideIndianRupee:Aq,LucideInfinity:Eq,LucideInfo:Iq,LucideInspect:qb,LucideInspectionPanel:Pq,LucideInstagram:eu,LucideItalic:nS,LucideIterationCcw:Lq,LucideIterationCw:Oq,LucideJapaneseYen:Dq,LucideJoystick:Rq,LucideKanban:f1,LucideKanbanSquare:Fb,LucideKanbanSquareDashed:Eb,LucideKey:Zh,LucideKeyRound:mj,LucideKeySquare:Fq,LucideKeyboard:$q,LucideKeyboardMusic:zq,LucideKeyboardOff:Bq,LucideLamp:Gq,LucideLampCeiling:Uq,LucideLampDesk:qq,LucideLampFloor:Vq,LucideLampWallDown:Hq,LucideLampWallUp:Wq,LucideLandPlot:Kq,LucideLandmark:Zq,LucideLanguages:Yq,LucideLaptop:Qq,LucideLaptop2:F2,LucideLaptopMinimal:F2,LucideLaptopMinimalCheck:Xq,LucideLasso:eV,LucideLassoSelect:Jq,LucideLaugh:tV,LucideLayers:sV,LucideLayers2:rV,LucideLayers3:nV,LucideLayout:h0,LucideLayoutDashboard:sS,LucideLayoutGrid:fm,LucideLayoutList:iV,LucideLayoutPanelLeft:aV,LucideLayoutPanelTop:oV,LucideLayoutTemplate:lV,LucideLeaf:cV,LucideLeafyGreen:dV,LucideLectern:uV,LucideLetterText:hV,LucideLibrary:iS,LucideLibraryBig:fV,LucideLibrarySquare:zb,LucideLifeBuoy:aS,LucideLigature:pV,LucideLightbulb:p1,LucideLightbulbOff:mV,LucideLineChart:P_,LucideLink:So,LucideLink2:Yh,LucideLink2Off:gV,LucideLinkedin:pm,LucideList:Hf,LucideListCheck:xV,LucideListChecks:yV,LucideListCollapse:vV,LucideListEnd:_V,LucideListFilter:bV,LucideListMinus:wV,LucideListMusic:jV,LucideListOrdered:oS,LucideListPlus:kV,LucideListRestart:NV,LucideListStart:SV,LucideListTodo:CV,LucideListTree:MV,LucideListVideo:TV,LucideListX:AV,LucideLoader:IV,LucideLoader2:nn,LucideLoaderCircle:nn,LucideLoaderPinwheel:EV,LucideLocate:PT,LucideLocateFixed:PV,LucideLocateOff:LV,LucideLock:Wf,LucideLockKeyhole:OV,LucideLockKeyholeOpen:z2,LucideLockOpen:B2,LucideLogIn:lS,LucideLogOut:cS,LucideLogs:DV,LucideLollipop:RV,LucideLuggage:FV,LucideMSquare:Bb,LucideMagnet:zV,LucideMail:Zs,LucideMailCheck:BV,LucideMailMinus:$V,LucideMailOpen:UV,LucideMailPlus:qV,LucideMailQuestion:VV,LucideMailSearch:HV,LucideMailWarning:WV,LucideMailX:LT,LucideMailbox:GV,LucideMails:KV,LucideMap:aH,LucideMapPin:pl,LucideMapPinCheck:YV,LucideMapPinCheckInside:ZV,LucideMapPinHouse:XV,LucideMapPinMinus:JV,LucideMapPinMinusInside:QV,LucideMapPinOff:eH,LucideMapPinPlus:rH,LucideMapPinPlusInside:tH,LucideMapPinX:sH,LucideMapPinXInside:nH,LucideMapPinned:iH,LucideMartini:oH,LucideMaximize:m1,LucideMaximize2:lH,LucideMedal:qx,LucideMegaphone:mm,LucideMegaphoneOff:cH,LucideMeh:dH,LucideMemoryStick:uH,LucideMenu:OT,LucideMenuSquare:$b,LucideMerge:hH,LucideMessageCircle:Zl,LucideMessageCircleCode:fH,LucideMessageCircleDashed:pH,LucideMessageCircleHeart:dS,LucideMessageCircleMore:mH,LucideMessageCircleOff:gH,LucideMessageCirclePlus:xH,LucideMessageCircleQuestion:DT,LucideMessageCircleReply:yH,LucideMessageCircleWarning:vH,LucideMessageCircleX:_H,LucideMessageSquare:Po,LucideMessageSquareCode:bH,LucideMessageSquareDashed:wH,LucideMessageSquareDiff:jH,LucideMessageSquareDot:kH,LucideMessageSquareHeart:NH,LucideMessageSquareLock:SH,LucideMessageSquareMore:CH,LucideMessageSquareOff:MH,LucideMessageSquarePlus:TH,LucideMessageSquareQuote:RT,LucideMessageSquareReply:AH,LucideMessageSquareShare:EH,LucideMessageSquareText:IH,LucideMessageSquareWarning:PH,LucideMessageSquareX:LH,LucideMessagesSquare:OH,LucideMic:FT,LucideMic2:$2,LucideMicOff:DH,LucideMicVocal:$2,LucideMicrochip:RH,LucideMicroscope:FH,LucideMicrowave:zH,LucideMilestone:BH,LucideMilk:UH,LucideMilkOff:$H,LucideMinimize:VH,LucideMinimize2:qH,LucideMinus:g1,LucideMinusCircle:J_,LucideMinusSquare:Ub,LucideMonitor:uS,LucideMonitorCheck:HH,LucideMonitorCog:WH,LucideMonitorDot:GH,LucideMonitorDown:KH,LucideMonitorOff:ZH,LucideMonitorPause:YH,LucideMonitorPlay:XH,LucideMonitorSmartphone:QH,LucideMonitorSpeaker:JH,LucideMonitorStop:eW,LucideMonitorUp:tW,LucideMonitorX:rW,LucideMoon:sW,LucideMoonStar:nW,LucideMoreHorizontal:og,LucideMoreVertical:Sx,LucideMountain:aW,LucideMountainSnow:iW,LucideMouse:uW,LucideMouseOff:oW,LucideMousePointer:dW,LucideMousePointer2:lW,LucideMousePointerBan:cW,LucideMousePointerClick:gj,LucideMousePointerSquareDashed:Ib,LucideMove:kW,LucideMove3D:U2,LucideMove3d:U2,LucideMoveDiagonal:fW,LucideMoveDiagonal2:hW,LucideMoveDown:gW,LucideMoveDownLeft:pW,LucideMoveDownRight:mW,LucideMoveHorizontal:xW,LucideMoveLeft:yW,LucideMoveRight:vW,LucideMoveUp:wW,LucideMoveUpLeft:_W,LucideMoveUpRight:bW,LucideMoveVertical:jW,LucideMusic:MW,LucideMusic2:NW,LucideMusic3:SW,LucideMusic4:CW,LucideNavigation:zT,LucideNavigation2:AW,LucideNavigation2Off:TW,LucideNavigationOff:EW,LucideNetwork:IW,LucideNewspaper:Vx,LucideNfc:PW,LucideNotebook:RW,LucideNotebookPen:LW,LucideNotebookTabs:OW,LucideNotebookText:DW,LucideNotepadText:zW,LucideNotepadTextDashed:FW,LucideNut:$W,LucideNutOff:BW,LucideOctagon:qW,LucideOctagonAlert:q2,LucideOctagonMinus:UW,LucideOctagonPause:V2,LucideOctagonX:H2,LucideOmega:VW,LucideOption:HW,LucideOrbit:WW,LucideOrigami:GW,LucideOutdent:D2,LucidePackage:Ol,LucidePackage2:KW,LucidePackageCheck:ZW,LucidePackageMinus:YW,LucidePackageOpen:XW,LucidePackagePlus:QW,LucidePackageSearch:JW,LucidePackageX:eG,LucidePaintBucket:tG,LucidePaintRoller:rG,LucidePaintbrush:nG,LucidePaintbrush2:W2,LucidePaintbrushVertical:W2,LucidePalette:Ld,LucidePalmtree:dw,LucidePanelBottom:aG,LucidePanelBottomClose:sG,LucidePanelBottomDashed:G2,LucidePanelBottomInactive:G2,LucidePanelBottomOpen:iG,LucidePanelLeft:X2,LucidePanelLeftClose:K2,LucidePanelLeftDashed:Z2,LucidePanelLeftInactive:Z2,LucidePanelLeftOpen:Y2,LucidePanelRight:cG,LucidePanelRightClose:oG,LucidePanelRightDashed:Q2,LucidePanelRightInactive:Q2,LucidePanelRightOpen:lG,LucidePanelTop:hG,LucidePanelTopClose:dG,LucidePanelTopDashed:J2,LucidePanelTopInactive:J2,LucidePanelTopOpen:uG,LucidePanelsLeftBottom:fG,LucidePanelsLeftRight:g2,LucidePanelsRightBottom:pG,LucidePanelsTopBottom:ib,LucidePanelsTopLeft:h0,LucidePaperclip:mG,LucideParentheses:gG,LucideParkingCircle:t2,LucideParkingCircleOff:e2,LucideParkingMeter:xG,LucideParkingSquare:Hb,LucideParkingSquareOff:Vb,LucidePartyPopper:Nc,LucidePause:Xh,LucidePauseCircle:r2,LucidePauseOctagon:V2,LucidePawPrint:yG,LucidePcCase:vG,LucidePen:f0,LucidePenBox:rc,LucidePenLine:eb,LucidePenOff:_G,LucidePenSquare:rc,LucidePenTool:xj,LucidePencil:ha,LucidePencilLine:bG,LucidePencilOff:wG,LucidePencilRuler:jG,LucidePentagon:kG,LucidePercent:hS,LucidePercentCircle:n2,LucidePercentDiamond:y2,LucidePercentSquare:Wb,LucidePersonStanding:NG,LucidePhilippinePeso:SG,LucidePhone:ca,LucidePhoneCall:CG,LucidePhoneForwarded:MG,LucidePhoneIncoming:TG,LucidePhoneMissed:AG,LucidePhoneOff:EG,LucidePhoneOutgoing:IG,LucidePi:PG,LucidePiSquare:Gb,LucidePiano:LG,LucidePickaxe:OG,LucidePictureInPicture:RG,LucidePictureInPicture2:DG,LucidePieChart:R_,LucidePiggyBank:FG,LucidePilcrow:$G,LucidePilcrowLeft:zG,LucidePilcrowRight:BG,LucidePilcrowSquare:Kb,LucidePill:qG,LucidePillBottle:UG,LucidePin:x1,LucidePinOff:BT,LucidePipette:VG,LucidePizza:HG,LucidePlane:KG,LucidePlaneLanding:WG,LucidePlaneTakeoff:GG,LucidePlay:Sc,LucidePlayCircle:Of,LucidePlaySquare:Zb,LucidePlug:YG,LucidePlug2:ZG,LucidePlugZap:tb,LucidePlugZap2:tb,LucidePlus:jn,LucidePlusCircle:s2,LucidePlusSquare:Yb,LucidePocket:QG,LucidePocketKnife:XG,LucidePodcast:JG,LucidePointer:tK,LucidePointerOff:eK,LucidePopcorn:rK,LucidePopsicle:nK,LucidePoundSterling:sK,LucidePower:aK,LucidePowerCircle:i2,LucidePowerOff:iK,LucidePowerSquare:Xb,LucidePresentation:oK,LucidePrinter:cK,LucidePrinterCheck:lK,LucideProjector:dK,LucideProportions:uK,LucidePuzzle:hK,LucidePyramid:fK,LucideQrCode:$T,LucideQuote:UT,LucideRabbit:pK,LucideRadar:mK,LucideRadiation:gK,LucideRadical:xK,LucideRadio:yj,LucideRadioReceiver:yK,LucideRadioTower:vK,LucideRadius:_K,LucideRailSymbol:bK,LucideRainbow:wK,LucideRat:jK,LucideRatio:kK,LucideReceipt:PK,LucideReceiptCent:NK,LucideReceiptEuro:SK,LucideReceiptIndianRupee:CK,LucideReceiptJapaneseYen:MK,LucideReceiptPoundSterling:TK,LucideReceiptRussianRuble:AK,LucideReceiptSwissFranc:EK,LucideReceiptText:IK,LucideRectangleEllipsis:rb,LucideRectangleHorizontal:LK,LucideRectangleVertical:OK,LucideRecycle:DK,LucideRedo:fS,LucideRedo2:RK,LucideRedoDot:FK,LucideRefreshCcw:BK,LucideRefreshCcwDot:zK,LucideRefreshCw:ql,LucideRefreshCwOff:$K,LucideRefrigerator:UK,LucideRegex:qK,LucideRemoveFormatting:VK,LucideRepeat:GK,LucideRepeat1:HK,LucideRepeat2:WK,LucideReplace:ZK,LucideReplaceAll:KK,LucideReply:qT,LucideReplyAll:YK,LucideRewind:XK,LucideRibbon:QK,LucideRocket:_g,LucideRockingChair:JK,LucideRollerCoaster:eZ,LucideRotate3D:nb,LucideRotate3d:nb,LucideRotateCcw:pS,LucideRotateCcwSquare:tZ,LucideRotateCw:VT,LucideRotateCwSquare:rZ,LucideRoute:sZ,LucideRouteOff:nZ,LucideRouter:iZ,LucideRows:sb,LucideRows2:sb,LucideRows3:ib,LucideRows4:aZ,LucideRss:oZ,LucideRuler:lZ,LucideRussianRuble:cZ,LucideSailboat:dZ,LucideSalad:uZ,LucideSandwich:hZ,LucideSatellite:pZ,LucideSatelliteDish:fZ,LucideSave:bg,LucideSaveAll:mZ,LucideSaveOff:gZ,LucideScale:xZ,LucideScale3D:ab,LucideScale3d:ab,LucideScaling:yZ,LucideScan:SZ,LucideScanBarcode:vZ,LucideScanEye:_Z,LucideScanFace:bZ,LucideScanLine:wZ,LucideScanQrCode:jZ,LucideScanSearch:kZ,LucideScanText:NZ,LucideScatterChart:F_,LucideSchool:CZ,LucideSchool2:hw,LucideScissors:TZ,LucideScissorsLineDashed:MZ,LucideScissorsSquare:Qb,LucideScissorsSquareDashedBottom:kb,LucideScreenShare:EZ,LucideScreenShareOff:AZ,LucideScroll:PZ,LucideScrollText:IZ,LucideSearch:Mi,LucideSearchCheck:LZ,LucideSearchCode:OZ,LucideSearchSlash:DZ,LucideSearchX:RZ,LucideSection:FZ,LucideSend:Lo,LucideSendHorizonal:ob,LucideSendHorizontal:ob,LucideSendToBack:zZ,LucideSeparatorHorizontal:BZ,LucideSeparatorVertical:$Z,LucideServer:HZ,LucideServerCog:UZ,LucideServerCrash:qZ,LucideServerOff:VZ,LucideSettings:hd,LucideSettings2:WZ,LucideShapes:GZ,LucideShare:HT,LucideShare2:dc,LucideSheet:KZ,LucideShell:ZZ,LucideShield:Gf,LucideShieldAlert:YZ,LucideShieldBan:XZ,LucideShieldCheck:WT,LucideShieldClose:lb,LucideShieldEllipsis:QZ,LucideShieldHalf:JZ,LucideShieldMinus:eY,LucideShieldOff:tY,LucideShieldPlus:rY,LucideShieldQuestion:nY,LucideShieldX:lb,LucideShip:iY,LucideShipWheel:sY,LucideShirt:aY,LucideShoppingBag:wg,LucideShoppingBasket:oY,LucideShoppingCart:dh,LucideShovel:lY,LucideShowerHead:cY,LucideShrink:dY,LucideShrub:uY,LucideShuffle:hY,LucideSidebar:X2,LucideSidebarClose:K2,LucideSidebarOpen:Y2,LucideSigma:fY,LucideSigmaSquare:Jb,LucideSignal:yY,LucideSignalHigh:pY,LucideSignalLow:mY,LucideSignalMedium:gY,LucideSignalZero:xY,LucideSignature:vY,LucideSignpost:bY,LucideSignpostBig:_Y,LucideSiren:wY,LucideSkipBack:jY,LucideSkipForward:kY,LucideSkull:NY,LucideSlack:SY,LucideSlash:CY,LucideSlashSquare:ew,LucideSlice:MY,LucideSliders:cb,LucideSlidersHorizontal:GT,LucideSlidersVertical:cb,LucideSmartphone:gm,LucideSmartphoneCharging:TY,LucideSmartphoneNfc:AY,LucideSmile:IY,LucideSmilePlus:EY,LucideSnail:PY,LucideSnowflake:$0,LucideSofa:LY,LucideSortAsc:y_,LucideSortDesc:m_,LucideSoup:OY,LucideSpace:DY,LucideSpade:RY,LucideSparkle:FY,LucideSparkles:Ss,LucideSpeaker:zY,LucideSpeech:BY,LucideSpellCheck:UY,LucideSpellCheck2:$Y,LucideSpline:qY,LucideSplit:VY,LucideSplitSquareHorizontal:tw,LucideSplitSquareVertical:rw,LucideSprayCan:HY,LucideSprout:WY,LucideSquare:xm,LucideSquareActivity:db,LucideSquareArrowDown:fb,LucideSquareArrowDownLeft:ub,LucideSquareArrowDownRight:hb,LucideSquareArrowLeft:pb,LucideSquareArrowOutDownLeft:mb,LucideSquareArrowOutDownRight:gb,LucideSquareArrowOutUpLeft:xb,LucideSquareArrowOutUpRight:yb,LucideSquareArrowRight:vb,LucideSquareArrowUp:wb,LucideSquareArrowUpLeft:_b,LucideSquareArrowUpRight:bb,LucideSquareAsterisk:jb,LucideSquareBottomDashedScissors:kb,LucideSquareChartGantt:Qm,LucideSquareCheck:Nb,LucideSquareCheckBig:p0,LucideSquareChevronDown:Sb,LucideSquareChevronLeft:Cb,LucideSquareChevronRight:Mb,LucideSquareChevronUp:Tb,LucideSquareCode:Ab,LucideSquareDashed:Pb,LucideSquareDashedBottom:KY,LucideSquareDashedBottomCode:GY,LucideSquareDashedKanban:Eb,LucideSquareDashedMousePointer:Ib,LucideSquareDivide:Lb,LucideSquareDot:Ob,LucideSquareEqual:Db,LucideSquareFunction:Rb,LucideSquareGanttChart:Qm,LucideSquareKanban:Fb,LucideSquareLibrary:zb,LucideSquareM:Bb,LucideSquareMenu:$b,LucideSquareMinus:Ub,LucideSquareMousePointer:qb,LucideSquareParking:Hb,LucideSquareParkingOff:Vb,LucideSquarePen:rc,LucideSquarePercent:Wb,LucideSquarePi:Gb,LucideSquarePilcrow:Kb,LucideSquarePlay:Zb,LucideSquarePlus:Yb,LucideSquarePower:Xb,LucideSquareRadical:ZY,LucideSquareScissors:Qb,LucideSquareSigma:Jb,LucideSquareSlash:ew,LucideSquareSplitHorizontal:tw,LucideSquareSplitVertical:rw,LucideSquareSquare:YY,LucideSquareStack:XY,LucideSquareTerminal:nw,LucideSquareUser:iw,LucideSquareUserRound:sw,LucideSquareX:aw,LucideSquircle:QY,LucideSquirrel:JY,LucideStamp:eX,LucideStar:vs,LucideStarHalf:tX,LucideStarOff:rX,LucideStars:Ss,LucideStepBack:nX,LucideStepForward:sX,LucideStethoscope:iX,LucideSticker:aX,LucideStickyNote:oX,LucideStopCircle:o2,LucideStore:lX,LucideStretchHorizontal:cX,LucideStretchVertical:dX,LucideStrikethrough:uX,LucideSubscript:hX,LucideSubtitles:S_,LucideSun:y1,LucideSunDim:fX,LucideSunMedium:pX,LucideSunMoon:mX,LucideSunSnow:gX,LucideSunrise:xX,LucideSunset:yX,LucideSuperscript:vX,LucideSwatchBook:_X,LucideSwissFranc:bX,LucideSwitchCamera:wX,LucideSword:jX,LucideSwords:kX,LucideSyringe:NX,LucideTable:IX,LucideTable2:KT,LucideTableCellsMerge:SX,LucideTableCellsSplit:CX,LucideTableColumnsSplit:MX,LucideTableOfContents:TX,LucideTableProperties:AX,LucideTableRowsSplit:EX,LucideTablet:LX,LucideTabletSmartphone:PX,LucideTablets:OX,LucideTag:Hx,LucideTags:DX,LucideTally1:RX,LucideTally2:FX,LucideTally3:zX,LucideTally4:BX,LucideTally5:$X,LucideTangent:UX,LucideTarget:Wx,LucideTelescope:qX,LucideTent:HX,LucideTentTree:VX,LucideTerminal:WX,LucideTerminalSquare:nw,LucideTestTube:GX,LucideTestTube2:ow,LucideTestTubeDiagonal:ow,LucideTestTubes:KX,LucideText:JX,LucideTextCursor:YX,LucideTextCursorInput:ZX,LucideTextQuote:XX,LucideTextSearch:QX,LucideTextSelect:lw,LucideTextSelection:lw,LucideTheater:eQ,LucideThermometer:nQ,LucideThermometerSnowflake:tQ,LucideThermometerSun:rQ,LucideThumbsDown:ZT,LucideThumbsUp:Od,LucideTicket:YT,LucideTicketCheck:sQ,LucideTicketMinus:iQ,LucideTicketPercent:aQ,LucideTicketPlus:oQ,LucideTicketSlash:lQ,LucideTicketX:cQ,LucideTickets:uQ,LucideTicketsPlane:dQ,LucideTimer:pQ,LucideTimerOff:hQ,LucideTimerReset:fQ,LucideToggleLeft:mQ,LucideToggleRight:gQ,LucideToilet:xQ,LucideTornado:yQ,LucideTorus:vQ,LucideTouchpad:bQ,LucideTouchpadOff:_Q,LucideTowerControl:wQ,LucideToyBrick:jQ,LucideTractor:kQ,LucideTrafficCone:NQ,LucideTrain:cw,LucideTrainFront:CQ,LucideTrainFrontTunnel:SQ,LucideTrainTrack:MQ,LucideTramFront:cw,LucideTrash:TQ,LucideTrash2:Zn,LucideTreeDeciduous:AQ,LucideTreePalm:dw,LucideTreePine:v1,LucideTrees:EQ,LucideTrello:IQ,LucideTrendingDown:_1,LucideTrendingUp:Kf,LucideTrendingUpDown:PQ,LucideTriangle:OQ,LucideTriangleAlert:zh,LucideTriangleRight:LQ,LucideTrophy:Ha,LucideTruck:XT,LucideTurtle:DQ,LucideTv:FQ,LucideTv2:uw,LucideTvMinimal:uw,LucideTvMinimalPlay:RQ,LucideTwitch:zQ,LucideTwitter:BQ,LucideType:UQ,LucideTypeOutline:$Q,LucideUmbrella:VQ,LucideUmbrellaOff:qQ,LucideUnderline:HQ,LucideUndo:mS,LucideUndo2:WQ,LucideUndoDot:GQ,LucideUnfoldHorizontal:KQ,LucideUnfoldVertical:ZQ,LucideUngroup:YQ,LucideUniversity:hw,LucideUnlink:QT,LucideUnlink2:XQ,LucideUnlock:B2,LucideUnlockKeyhole:z2,LucideUnplug:QQ,LucideUpload:go,LucideUploadCloud:f2,LucideUsb:JQ,LucideUser:Cc,LucideUser2:yw,LucideUserCheck:vj,LucideUserCheck2:fw,LucideUserCircle:c2,LucideUserCircle2:l2,LucideUserCog:JT,LucideUserCog2:pw,LucideUserMinus:eJ,LucideUserMinus2:mw,LucideUserPen:tJ,LucideUserPlus:Qh,LucideUserPlus2:gw,LucideUserRound:yw,LucideUserRoundCheck:fw,LucideUserRoundCog:pw,LucideUserRoundMinus:mw,LucideUserRoundPen:rJ,LucideUserRoundPlus:gw,LucideUserRoundSearch:nJ,LucideUserRoundX:xw,LucideUserSearch:sJ,LucideUserSquare:iw,LucideUserSquare2:sw,LucideUserX:iJ,LucideUserX2:xw,LucideUsers:Kn,LucideUsers2:vw,LucideUsersRound:vw,LucideUtensils:bw,LucideUtensilsCrossed:_w,LucideUtilityPole:aJ,LucideVariable:eA,LucideVault:oJ,LucideVegan:lJ,LucideVenetianMask:cJ,LucideVerified:b_,LucideVibrate:uJ,LucideVibrateOff:dJ,LucideVideo:Fi,LucideVideoOff:hJ,LucideVideotape:fJ,LucideView:pJ,LucideVoicemail:mJ,LucideVolleyball:gJ,LucideVolume:bJ,LucideVolume1:xJ,LucideVolume2:yJ,LucideVolumeOff:vJ,LucideVolumeX:_J,LucideVote:wJ,LucideWallet:kJ,LucideWallet2:ww,LucideWalletCards:jJ,LucideWalletMinimal:ww,LucideWallpaper:NJ,LucideWand:SJ,LucideWand2:jw,LucideWandSparkles:jw,LucideWarehouse:CJ,LucideWashingMachine:MJ,LucideWatch:TJ,LucideWaves:AJ,LucideWaypoints:EJ,LucideWebcam:IJ,LucideWebhook:LJ,LucideWebhookOff:PJ,LucideWeight:OJ,LucideWheat:RJ,LucideWheatOff:DJ,LucideWholeWord:FJ,LucideWifi:qJ,LucideWifiHigh:zJ,LucideWifiLow:BJ,LucideWifiOff:$J,LucideWifiZero:UJ,LucideWind:HJ,LucideWindArrowDown:VJ,LucideWine:GJ,LucideWineOff:WJ,LucideWorkflow:KJ,LucideWorm:ZJ,LucideWrapText:YJ,LucideWrench:Gx,LucideX:Ts,LucideXCircle:zc,LucideXOctagon:H2,LucideXSquare:aw,LucideYoutube:XJ,LucideZap:jg,LucideZapOff:QJ,LucideZoomIn:gS,LucideZoomOut:xS,Luggage:FV,LuggageIcon:FV,MSquare:Bb,MSquareIcon:Bb,Magnet:zV,MagnetIcon:zV,Mail:Zs,MailCheck:BV,MailCheckIcon:BV,MailIcon:Zs,MailMinus:$V,MailMinusIcon:$V,MailOpen:UV,MailOpenIcon:UV,MailPlus:qV,MailPlusIcon:qV,MailQuestion:VV,MailQuestionIcon:VV,MailSearch:HV,MailSearchIcon:HV,MailWarning:WV,MailWarningIcon:WV,MailX:LT,MailXIcon:LT,Mailbox:GV,MailboxIcon:GV,Mails:KV,MailsIcon:KV,Map:aH,MapIcon:aH,MapPin:pl,MapPinCheck:YV,MapPinCheckIcon:YV,MapPinCheckInside:ZV,MapPinCheckInsideIcon:ZV,MapPinHouse:XV,MapPinHouseIcon:XV,MapPinIcon:pl,MapPinMinus:JV,MapPinMinusIcon:JV,MapPinMinusInside:QV,MapPinMinusInsideIcon:QV,MapPinOff:eH,MapPinOffIcon:eH,MapPinPlus:rH,MapPinPlusIcon:rH,MapPinPlusInside:tH,MapPinPlusInsideIcon:tH,MapPinX:sH,MapPinXIcon:sH,MapPinXInside:nH,MapPinXInsideIcon:nH,MapPinned:iH,MapPinnedIcon:iH,Martini:oH,MartiniIcon:oH,Maximize:m1,Maximize2:lH,Maximize2Icon:lH,MaximizeIcon:m1,Medal:qx,MedalIcon:qx,Megaphone:mm,MegaphoneIcon:mm,MegaphoneOff:cH,MegaphoneOffIcon:cH,Meh:dH,MehIcon:dH,MemoryStick:uH,MemoryStickIcon:uH,Menu:OT,MenuIcon:OT,MenuSquare:$b,MenuSquareIcon:$b,Merge:hH,MergeIcon:hH,MessageCircle:Zl,MessageCircleCode:fH,MessageCircleCodeIcon:fH,MessageCircleDashed:pH,MessageCircleDashedIcon:pH,MessageCircleHeart:dS,MessageCircleHeartIcon:dS,MessageCircleIcon:Zl,MessageCircleMore:mH,MessageCircleMoreIcon:mH,MessageCircleOff:gH,MessageCircleOffIcon:gH,MessageCirclePlus:xH,MessageCirclePlusIcon:xH,MessageCircleQuestion:DT,MessageCircleQuestionIcon:DT,MessageCircleReply:yH,MessageCircleReplyIcon:yH,MessageCircleWarning:vH,MessageCircleWarningIcon:vH,MessageCircleX:_H,MessageCircleXIcon:_H,MessageSquare:Po,MessageSquareCode:bH,MessageSquareCodeIcon:bH,MessageSquareDashed:wH,MessageSquareDashedIcon:wH,MessageSquareDiff:jH,MessageSquareDiffIcon:jH,MessageSquareDot:kH,MessageSquareDotIcon:kH,MessageSquareHeart:NH,MessageSquareHeartIcon:NH,MessageSquareIcon:Po,MessageSquareLock:SH,MessageSquareLockIcon:SH,MessageSquareMore:CH,MessageSquareMoreIcon:CH,MessageSquareOff:MH,MessageSquareOffIcon:MH,MessageSquarePlus:TH,MessageSquarePlusIcon:TH,MessageSquareQuote:RT,MessageSquareQuoteIcon:RT,MessageSquareReply:AH,MessageSquareReplyIcon:AH,MessageSquareShare:EH,MessageSquareShareIcon:EH,MessageSquareText:IH,MessageSquareTextIcon:IH,MessageSquareWarning:PH,MessageSquareWarningIcon:PH,MessageSquareX:LH,MessageSquareXIcon:LH,MessagesSquare:OH,MessagesSquareIcon:OH,Mic:FT,Mic2:$2,Mic2Icon:$2,MicIcon:FT,MicOff:DH,MicOffIcon:DH,MicVocal:$2,MicVocalIcon:$2,Microchip:RH,MicrochipIcon:RH,Microscope:FH,MicroscopeIcon:FH,Microwave:zH,MicrowaveIcon:zH,Milestone:BH,MilestoneIcon:BH,Milk:UH,MilkIcon:UH,MilkOff:$H,MilkOffIcon:$H,Minimize:VH,Minimize2:qH,Minimize2Icon:qH,MinimizeIcon:VH,Minus:g1,MinusCircle:J_,MinusCircleIcon:J_,MinusIcon:g1,MinusSquare:Ub,MinusSquareIcon:Ub,Monitor:uS,MonitorCheck:HH,MonitorCheckIcon:HH,MonitorCog:WH,MonitorCogIcon:WH,MonitorDot:GH,MonitorDotIcon:GH,MonitorDown:KH,MonitorDownIcon:KH,MonitorIcon:uS,MonitorOff:ZH,MonitorOffIcon:ZH,MonitorPause:YH,MonitorPauseIcon:YH,MonitorPlay:XH,MonitorPlayIcon:XH,MonitorSmartphone:QH,MonitorSmartphoneIcon:QH,MonitorSpeaker:JH,MonitorSpeakerIcon:JH,MonitorStop:eW,MonitorStopIcon:eW,MonitorUp:tW,MonitorUpIcon:tW,MonitorX:rW,MonitorXIcon:rW,Moon:sW,MoonIcon:sW,MoonStar:nW,MoonStarIcon:nW,MoreHorizontal:og,MoreHorizontalIcon:og,MoreVertical:Sx,MoreVerticalIcon:Sx,Mountain:aW,MountainIcon:aW,MountainSnow:iW,MountainSnowIcon:iW,Mouse:uW,MouseIcon:uW,MouseOff:oW,MouseOffIcon:oW,MousePointer:dW,MousePointer2:lW,MousePointer2Icon:lW,MousePointerBan:cW,MousePointerBanIcon:cW,MousePointerClick:gj,MousePointerClickIcon:gj,MousePointerIcon:dW,MousePointerSquareDashed:Ib,MousePointerSquareDashedIcon:Ib,Move:kW,Move3D:U2,Move3DIcon:U2,Move3d:U2,Move3dIcon:U2,MoveDiagonal:fW,MoveDiagonal2:hW,MoveDiagonal2Icon:hW,MoveDiagonalIcon:fW,MoveDown:gW,MoveDownIcon:gW,MoveDownLeft:pW,MoveDownLeftIcon:pW,MoveDownRight:mW,MoveDownRightIcon:mW,MoveHorizontal:xW,MoveHorizontalIcon:xW,MoveIcon:kW,MoveLeft:yW,MoveLeftIcon:yW,MoveRight:vW,MoveRightIcon:vW,MoveUp:wW,MoveUpIcon:wW,MoveUpLeft:_W,MoveUpLeftIcon:_W,MoveUpRight:bW,MoveUpRightIcon:bW,MoveVertical:jW,MoveVerticalIcon:jW,Music:MW,Music2:NW,Music2Icon:NW,Music3:SW,Music3Icon:SW,Music4:CW,Music4Icon:CW,MusicIcon:MW,Navigation:zT,Navigation2:AW,Navigation2Icon:AW,Navigation2Off:TW,Navigation2OffIcon:TW,NavigationIcon:zT,NavigationOff:EW,NavigationOffIcon:EW,Network:IW,NetworkIcon:IW,Newspaper:Vx,NewspaperIcon:Vx,Nfc:PW,NfcIcon:PW,Notebook:RW,NotebookIcon:RW,NotebookPen:LW,NotebookPenIcon:LW,NotebookTabs:OW,NotebookTabsIcon:OW,NotebookText:DW,NotebookTextIcon:DW,NotepadText:zW,NotepadTextDashed:FW,NotepadTextDashedIcon:FW,NotepadTextIcon:zW,Nut:$W,NutIcon:$W,NutOff:BW,NutOffIcon:BW,Octagon:qW,OctagonAlert:q2,OctagonAlertIcon:q2,OctagonIcon:qW,OctagonMinus:UW,OctagonMinusIcon:UW,OctagonPause:V2,OctagonPauseIcon:V2,OctagonX:H2,OctagonXIcon:H2,Omega:VW,OmegaIcon:VW,Option:HW,OptionIcon:HW,Orbit:WW,OrbitIcon:WW,Origami:GW,OrigamiIcon:GW,Outdent:D2,OutdentIcon:D2,Package:Ol,Package2:KW,Package2Icon:KW,PackageCheck:ZW,PackageCheckIcon:ZW,PackageIcon:Ol,PackageMinus:YW,PackageMinusIcon:YW,PackageOpen:XW,PackageOpenIcon:XW,PackagePlus:QW,PackagePlusIcon:QW,PackageSearch:JW,PackageSearchIcon:JW,PackageX:eG,PackageXIcon:eG,PaintBucket:tG,PaintBucketIcon:tG,PaintRoller:rG,PaintRollerIcon:rG,Paintbrush:nG,Paintbrush2:W2,Paintbrush2Icon:W2,PaintbrushIcon:nG,PaintbrushVertical:W2,PaintbrushVerticalIcon:W2,Palette:Ld,PaletteIcon:Ld,Palmtree:dw,PalmtreeIcon:dw,PanelBottom:aG,PanelBottomClose:sG,PanelBottomCloseIcon:sG,PanelBottomDashed:G2,PanelBottomDashedIcon:G2,PanelBottomIcon:aG,PanelBottomInactive:G2,PanelBottomInactiveIcon:G2,PanelBottomOpen:iG,PanelBottomOpenIcon:iG,PanelLeft:X2,PanelLeftClose:K2,PanelLeftCloseIcon:K2,PanelLeftDashed:Z2,PanelLeftDashedIcon:Z2,PanelLeftIcon:X2,PanelLeftInactive:Z2,PanelLeftInactiveIcon:Z2,PanelLeftOpen:Y2,PanelLeftOpenIcon:Y2,PanelRight:cG,PanelRightClose:oG,PanelRightCloseIcon:oG,PanelRightDashed:Q2,PanelRightDashedIcon:Q2,PanelRightIcon:cG,PanelRightInactive:Q2,PanelRightInactiveIcon:Q2,PanelRightOpen:lG,PanelRightOpenIcon:lG,PanelTop:hG,PanelTopClose:dG,PanelTopCloseIcon:dG,PanelTopDashed:J2,PanelTopDashedIcon:J2,PanelTopIcon:hG,PanelTopInactive:J2,PanelTopInactiveIcon:J2,PanelTopOpen:uG,PanelTopOpenIcon:uG,PanelsLeftBottom:fG,PanelsLeftBottomIcon:fG,PanelsLeftRight:g2,PanelsLeftRightIcon:g2,PanelsRightBottom:pG,PanelsRightBottomIcon:pG,PanelsTopBottom:ib,PanelsTopBottomIcon:ib,PanelsTopLeft:h0,PanelsTopLeftIcon:h0,Paperclip:mG,PaperclipIcon:mG,Parentheses:gG,ParenthesesIcon:gG,ParkingCircle:t2,ParkingCircleIcon:t2,ParkingCircleOff:e2,ParkingCircleOffIcon:e2,ParkingMeter:xG,ParkingMeterIcon:xG,ParkingSquare:Hb,ParkingSquareIcon:Hb,ParkingSquareOff:Vb,ParkingSquareOffIcon:Vb,PartyPopper:Nc,PartyPopperIcon:Nc,Pause:Xh,PauseCircle:r2,PauseCircleIcon:r2,PauseIcon:Xh,PauseOctagon:V2,PauseOctagonIcon:V2,PawPrint:yG,PawPrintIcon:yG,PcCase:vG,PcCaseIcon:vG,Pen:f0,PenBox:rc,PenBoxIcon:rc,PenIcon:f0,PenLine:eb,PenLineIcon:eb,PenOff:_G,PenOffIcon:_G,PenSquare:rc,PenSquareIcon:rc,PenTool:xj,PenToolIcon:xj,Pencil:ha,PencilIcon:ha,PencilLine:bG,PencilLineIcon:bG,PencilOff:wG,PencilOffIcon:wG,PencilRuler:jG,PencilRulerIcon:jG,Pentagon:kG,PentagonIcon:kG,Percent:hS,PercentCircle:n2,PercentCircleIcon:n2,PercentDiamond:y2,PercentDiamondIcon:y2,PercentIcon:hS,PercentSquare:Wb,PercentSquareIcon:Wb,PersonStanding:NG,PersonStandingIcon:NG,PhilippinePeso:SG,PhilippinePesoIcon:SG,Phone:ca,PhoneCall:CG,PhoneCallIcon:CG,PhoneForwarded:MG,PhoneForwardedIcon:MG,PhoneIcon:ca,PhoneIncoming:TG,PhoneIncomingIcon:TG,PhoneMissed:AG,PhoneMissedIcon:AG,PhoneOff:EG,PhoneOffIcon:EG,PhoneOutgoing:IG,PhoneOutgoingIcon:IG,Pi:PG,PiIcon:PG,PiSquare:Gb,PiSquareIcon:Gb,Piano:LG,PianoIcon:LG,Pickaxe:OG,PickaxeIcon:OG,PictureInPicture:RG,PictureInPicture2:DG,PictureInPicture2Icon:DG,PictureInPictureIcon:RG,PieChart:R_,PieChartIcon:R_,PiggyBank:FG,PiggyBankIcon:FG,Pilcrow:$G,PilcrowIcon:$G,PilcrowLeft:zG,PilcrowLeftIcon:zG,PilcrowRight:BG,PilcrowRightIcon:BG,PilcrowSquare:Kb,PilcrowSquareIcon:Kb,Pill:qG,PillBottle:UG,PillBottleIcon:UG,PillIcon:qG,Pin:x1,PinIcon:x1,PinOff:BT,PinOffIcon:BT,Pipette:VG,PipetteIcon:VG,Pizza:HG,PizzaIcon:HG,Plane:KG,PlaneIcon:KG,PlaneLanding:WG,PlaneLandingIcon:WG,PlaneTakeoff:GG,PlaneTakeoffIcon:GG,Play:Sc,PlayCircle:Of,PlayCircleIcon:Of,PlayIcon:Sc,PlaySquare:Zb,PlaySquareIcon:Zb,Plug:YG,Plug2:ZG,Plug2Icon:ZG,PlugIcon:YG,PlugZap:tb,PlugZap2:tb,PlugZap2Icon:tb,PlugZapIcon:tb,Plus:jn,PlusCircle:s2,PlusCircleIcon:s2,PlusIcon:jn,PlusSquare:Yb,PlusSquareIcon:Yb,Pocket:QG,PocketIcon:QG,PocketKnife:XG,PocketKnifeIcon:XG,Podcast:JG,PodcastIcon:JG,Pointer:tK,PointerIcon:tK,PointerOff:eK,PointerOffIcon:eK,Popcorn:rK,PopcornIcon:rK,Popsicle:nK,PopsicleIcon:nK,PoundSterling:sK,PoundSterlingIcon:sK,Power:aK,PowerCircle:i2,PowerCircleIcon:i2,PowerIcon:aK,PowerOff:iK,PowerOffIcon:iK,PowerSquare:Xb,PowerSquareIcon:Xb,Presentation:oK,PresentationIcon:oK,Printer:cK,PrinterCheck:lK,PrinterCheckIcon:lK,PrinterIcon:cK,Projector:dK,ProjectorIcon:dK,Proportions:uK,ProportionsIcon:uK,Puzzle:hK,PuzzleIcon:hK,Pyramid:fK,PyramidIcon:fK,QrCode:$T,QrCodeIcon:$T,Quote:UT,QuoteIcon:UT,Rabbit:pK,RabbitIcon:pK,Radar:mK,RadarIcon:mK,Radiation:gK,RadiationIcon:gK,Radical:xK,RadicalIcon:xK,Radio:yj,RadioIcon:yj,RadioReceiver:yK,RadioReceiverIcon:yK,RadioTower:vK,RadioTowerIcon:vK,Radius:_K,RadiusIcon:_K,RailSymbol:bK,RailSymbolIcon:bK,Rainbow:wK,RainbowIcon:wK,Rat:jK,RatIcon:jK,Ratio:kK,RatioIcon:kK,Receipt:PK,ReceiptCent:NK,ReceiptCentIcon:NK,ReceiptEuro:SK,ReceiptEuroIcon:SK,ReceiptIcon:PK,ReceiptIndianRupee:CK,ReceiptIndianRupeeIcon:CK,ReceiptJapaneseYen:MK,ReceiptJapaneseYenIcon:MK,ReceiptPoundSterling:TK,ReceiptPoundSterlingIcon:TK,ReceiptRussianRuble:AK,ReceiptRussianRubleIcon:AK,ReceiptSwissFranc:EK,ReceiptSwissFrancIcon:EK,ReceiptText:IK,ReceiptTextIcon:IK,RectangleEllipsis:rb,RectangleEllipsisIcon:rb,RectangleHorizontal:LK,RectangleHorizontalIcon:LK,RectangleVertical:OK,RectangleVerticalIcon:OK,Recycle:DK,RecycleIcon:DK,Redo:fS,Redo2:RK,Redo2Icon:RK,RedoDot:FK,RedoDotIcon:FK,RedoIcon:fS,RefreshCcw:BK,RefreshCcwDot:zK,RefreshCcwDotIcon:zK,RefreshCcwIcon:BK,RefreshCw:ql,RefreshCwIcon:ql,RefreshCwOff:$K,RefreshCwOffIcon:$K,Refrigerator:UK,RefrigeratorIcon:UK,Regex:qK,RegexIcon:qK,RemoveFormatting:VK,RemoveFormattingIcon:VK,Repeat:GK,Repeat1:HK,Repeat1Icon:HK,Repeat2:WK,Repeat2Icon:WK,RepeatIcon:GK,Replace:ZK,ReplaceAll:KK,ReplaceAllIcon:KK,ReplaceIcon:ZK,Reply:qT,ReplyAll:YK,ReplyAllIcon:YK,ReplyIcon:qT,Rewind:XK,RewindIcon:XK,Ribbon:QK,RibbonIcon:QK,Rocket:_g,RocketIcon:_g,RockingChair:JK,RockingChairIcon:JK,RollerCoaster:eZ,RollerCoasterIcon:eZ,Rotate3D:nb,Rotate3DIcon:nb,Rotate3d:nb,Rotate3dIcon:nb,RotateCcw:pS,RotateCcwIcon:pS,RotateCcwSquare:tZ,RotateCcwSquareIcon:tZ,RotateCw:VT,RotateCwIcon:VT,RotateCwSquare:rZ,RotateCwSquareIcon:rZ,Route:sZ,RouteIcon:sZ,RouteOff:nZ,RouteOffIcon:nZ,Router:iZ,RouterIcon:iZ,Rows:sb,Rows2:sb,Rows2Icon:sb,Rows3:ib,Rows3Icon:ib,Rows4:aZ,Rows4Icon:aZ,RowsIcon:sb,Rss:oZ,RssIcon:oZ,Ruler:lZ,RulerIcon:lZ,RussianRuble:cZ,RussianRubleIcon:cZ,Sailboat:dZ,SailboatIcon:dZ,Salad:uZ,SaladIcon:uZ,Sandwich:hZ,SandwichIcon:hZ,Satellite:pZ,SatelliteDish:fZ,SatelliteDishIcon:fZ,SatelliteIcon:pZ,Save:bg,SaveAll:mZ,SaveAllIcon:mZ,SaveIcon:bg,SaveOff:gZ,SaveOffIcon:gZ,Scale:xZ,Scale3D:ab,Scale3DIcon:ab,Scale3d:ab,Scale3dIcon:ab,ScaleIcon:xZ,Scaling:yZ,ScalingIcon:yZ,Scan:SZ,ScanBarcode:vZ,ScanBarcodeIcon:vZ,ScanEye:_Z,ScanEyeIcon:_Z,ScanFace:bZ,ScanFaceIcon:bZ,ScanIcon:SZ,ScanLine:wZ,ScanLineIcon:wZ,ScanQrCode:jZ,ScanQrCodeIcon:jZ,ScanSearch:kZ,ScanSearchIcon:kZ,ScanText:NZ,ScanTextIcon:NZ,ScatterChart:F_,ScatterChartIcon:F_,School:CZ,School2:hw,School2Icon:hw,SchoolIcon:CZ,Scissors:TZ,ScissorsIcon:TZ,ScissorsLineDashed:MZ,ScissorsLineDashedIcon:MZ,ScissorsSquare:Qb,ScissorsSquareDashedBottom:kb,ScissorsSquareDashedBottomIcon:kb,ScissorsSquareIcon:Qb,ScreenShare:EZ,ScreenShareIcon:EZ,ScreenShareOff:AZ,ScreenShareOffIcon:AZ,Scroll:PZ,ScrollIcon:PZ,ScrollText:IZ,ScrollTextIcon:IZ,Search:Mi,SearchCheck:LZ,SearchCheckIcon:LZ,SearchCode:OZ,SearchCodeIcon:OZ,SearchIcon:Mi,SearchSlash:DZ,SearchSlashIcon:DZ,SearchX:RZ,SearchXIcon:RZ,Section:FZ,SectionIcon:FZ,Send:Lo,SendHorizonal:ob,SendHorizonalIcon:ob,SendHorizontal:ob,SendHorizontalIcon:ob,SendIcon:Lo,SendToBack:zZ,SendToBackIcon:zZ,SeparatorHorizontal:BZ,SeparatorHorizontalIcon:BZ,SeparatorVertical:$Z,SeparatorVerticalIcon:$Z,Server:HZ,ServerCog:UZ,ServerCogIcon:UZ,ServerCrash:qZ,ServerCrashIcon:qZ,ServerIcon:HZ,ServerOff:VZ,ServerOffIcon:VZ,Settings:hd,Settings2:WZ,Settings2Icon:WZ,SettingsIcon:hd,Shapes:GZ,ShapesIcon:GZ,Share:HT,Share2:dc,Share2Icon:dc,ShareIcon:HT,Sheet:KZ,SheetIcon:KZ,Shell:ZZ,ShellIcon:ZZ,Shield:Gf,ShieldAlert:YZ,ShieldAlertIcon:YZ,ShieldBan:XZ,ShieldBanIcon:XZ,ShieldCheck:WT,ShieldCheckIcon:WT,ShieldClose:lb,ShieldCloseIcon:lb,ShieldEllipsis:QZ,ShieldEllipsisIcon:QZ,ShieldHalf:JZ,ShieldHalfIcon:JZ,ShieldIcon:Gf,ShieldMinus:eY,ShieldMinusIcon:eY,ShieldOff:tY,ShieldOffIcon:tY,ShieldPlus:rY,ShieldPlusIcon:rY,ShieldQuestion:nY,ShieldQuestionIcon:nY,ShieldX:lb,ShieldXIcon:lb,Ship:iY,ShipIcon:iY,ShipWheel:sY,ShipWheelIcon:sY,Shirt:aY,ShirtIcon:aY,ShoppingBag:wg,ShoppingBagIcon:wg,ShoppingBasket:oY,ShoppingBasketIcon:oY,ShoppingCart:dh,ShoppingCartIcon:dh,Shovel:lY,ShovelIcon:lY,ShowerHead:cY,ShowerHeadIcon:cY,Shrink:dY,ShrinkIcon:dY,Shrub:uY,ShrubIcon:uY,Shuffle:hY,ShuffleIcon:hY,Sidebar:X2,SidebarClose:K2,SidebarCloseIcon:K2,SidebarIcon:X2,SidebarOpen:Y2,SidebarOpenIcon:Y2,Sigma:fY,SigmaIcon:fY,SigmaSquare:Jb,SigmaSquareIcon:Jb,Signal:yY,SignalHigh:pY,SignalHighIcon:pY,SignalIcon:yY,SignalLow:mY,SignalLowIcon:mY,SignalMedium:gY,SignalMediumIcon:gY,SignalZero:xY,SignalZeroIcon:xY,Signature:vY,SignatureIcon:vY,Signpost:bY,SignpostBig:_Y,SignpostBigIcon:_Y,SignpostIcon:bY,Siren:wY,SirenIcon:wY,SkipBack:jY,SkipBackIcon:jY,SkipForward:kY,SkipForwardIcon:kY,Skull:NY,SkullIcon:NY,Slack:SY,SlackIcon:SY,Slash:CY,SlashIcon:CY,SlashSquare:ew,SlashSquareIcon:ew,Slice:MY,SliceIcon:MY,Sliders:cb,SlidersHorizontal:GT,SlidersHorizontalIcon:GT,SlidersIcon:cb,SlidersVertical:cb,SlidersVerticalIcon:cb,Smartphone:gm,SmartphoneCharging:TY,SmartphoneChargingIcon:TY,SmartphoneIcon:gm,SmartphoneNfc:AY,SmartphoneNfcIcon:AY,Smile:IY,SmileIcon:IY,SmilePlus:EY,SmilePlusIcon:EY,Snail:PY,SnailIcon:PY,Snowflake:$0,SnowflakeIcon:$0,Sofa:LY,SofaIcon:LY,SortAsc:y_,SortAscIcon:y_,SortDesc:m_,SortDescIcon:m_,Soup:OY,SoupIcon:OY,Space:DY,SpaceIcon:DY,Spade:RY,SpadeIcon:RY,Sparkle:FY,SparkleIcon:FY,Sparkles:Ss,SparklesIcon:Ss,Speaker:zY,SpeakerIcon:zY,Speech:BY,SpeechIcon:BY,SpellCheck:UY,SpellCheck2:$Y,SpellCheck2Icon:$Y,SpellCheckIcon:UY,Spline:qY,SplineIcon:qY,Split:VY,SplitIcon:VY,SplitSquareHorizontal:tw,SplitSquareHorizontalIcon:tw,SplitSquareVertical:rw,SplitSquareVerticalIcon:rw,SprayCan:HY,SprayCanIcon:HY,Sprout:WY,SproutIcon:WY,Square:xm,SquareActivity:db,SquareActivityIcon:db,SquareArrowDown:fb,SquareArrowDownIcon:fb,SquareArrowDownLeft:ub,SquareArrowDownLeftIcon:ub,SquareArrowDownRight:hb,SquareArrowDownRightIcon:hb,SquareArrowLeft:pb,SquareArrowLeftIcon:pb,SquareArrowOutDownLeft:mb,SquareArrowOutDownLeftIcon:mb,SquareArrowOutDownRight:gb,SquareArrowOutDownRightIcon:gb,SquareArrowOutUpLeft:xb,SquareArrowOutUpLeftIcon:xb,SquareArrowOutUpRight:yb,SquareArrowOutUpRightIcon:yb,SquareArrowRight:vb,SquareArrowRightIcon:vb,SquareArrowUp:wb,SquareArrowUpIcon:wb,SquareArrowUpLeft:_b,SquareArrowUpLeftIcon:_b,SquareArrowUpRight:bb,SquareArrowUpRightIcon:bb,SquareAsterisk:jb,SquareAsteriskIcon:jb,SquareBottomDashedScissors:kb,SquareBottomDashedScissorsIcon:kb,SquareChartGantt:Qm,SquareChartGanttIcon:Qm,SquareCheck:Nb,SquareCheckBig:p0,SquareCheckBigIcon:p0,SquareCheckIcon:Nb,SquareChevronDown:Sb,SquareChevronDownIcon:Sb,SquareChevronLeft:Cb,SquareChevronLeftIcon:Cb,SquareChevronRight:Mb,SquareChevronRightIcon:Mb,SquareChevronUp:Tb,SquareChevronUpIcon:Tb,SquareCode:Ab,SquareCodeIcon:Ab,SquareDashed:Pb,SquareDashedBottom:KY,SquareDashedBottomCode:GY,SquareDashedBottomCodeIcon:GY,SquareDashedBottomIcon:KY,SquareDashedIcon:Pb,SquareDashedKanban:Eb,SquareDashedKanbanIcon:Eb,SquareDashedMousePointer:Ib,SquareDashedMousePointerIcon:Ib,SquareDivide:Lb,SquareDivideIcon:Lb,SquareDot:Ob,SquareDotIcon:Ob,SquareEqual:Db,SquareEqualIcon:Db,SquareFunction:Rb,SquareFunctionIcon:Rb,SquareGanttChart:Qm,SquareGanttChartIcon:Qm,SquareIcon:xm,SquareKanban:Fb,SquareKanbanIcon:Fb,SquareLibrary:zb,SquareLibraryIcon:zb,SquareM:Bb,SquareMIcon:Bb,SquareMenu:$b,SquareMenuIcon:$b,SquareMinus:Ub,SquareMinusIcon:Ub,SquareMousePointer:qb,SquareMousePointerIcon:qb,SquareParking:Hb,SquareParkingIcon:Hb,SquareParkingOff:Vb,SquareParkingOffIcon:Vb,SquarePen:rc,SquarePenIcon:rc,SquarePercent:Wb,SquarePercentIcon:Wb,SquarePi:Gb,SquarePiIcon:Gb,SquarePilcrow:Kb,SquarePilcrowIcon:Kb,SquarePlay:Zb,SquarePlayIcon:Zb,SquarePlus:Yb,SquarePlusIcon:Yb,SquarePower:Xb,SquarePowerIcon:Xb,SquareRadical:ZY,SquareRadicalIcon:ZY,SquareScissors:Qb,SquareScissorsIcon:Qb,SquareSigma:Jb,SquareSigmaIcon:Jb,SquareSlash:ew,SquareSlashIcon:ew,SquareSplitHorizontal:tw,SquareSplitHorizontalIcon:tw,SquareSplitVertical:rw,SquareSplitVerticalIcon:rw,SquareSquare:YY,SquareSquareIcon:YY,SquareStack:XY,SquareStackIcon:XY,SquareTerminal:nw,SquareTerminalIcon:nw,SquareUser:iw,SquareUserIcon:iw,SquareUserRound:sw,SquareUserRoundIcon:sw,SquareX:aw,SquareXIcon:aw,Squircle:QY,SquircleIcon:QY,Squirrel:JY,SquirrelIcon:JY,Stamp:eX,StampIcon:eX,Star:vs,StarHalf:tX,StarHalfIcon:tX,StarIcon:vs,StarOff:rX,StarOffIcon:rX,Stars:Ss,StarsIcon:Ss,StepBack:nX,StepBackIcon:nX,StepForward:sX,StepForwardIcon:sX,Stethoscope:iX,StethoscopeIcon:iX,Sticker:aX,StickerIcon:aX,StickyNote:oX,StickyNoteIcon:oX,StopCircle:o2,StopCircleIcon:o2,Store:lX,StoreIcon:lX,StretchHorizontal:cX,StretchHorizontalIcon:cX,StretchVertical:dX,StretchVerticalIcon:dX,Strikethrough:uX,StrikethroughIcon:uX,Subscript:hX,SubscriptIcon:hX,Subtitles:S_,SubtitlesIcon:S_,Sun:y1,SunDim:fX,SunDimIcon:fX,SunIcon:y1,SunMedium:pX,SunMediumIcon:pX,SunMoon:mX,SunMoonIcon:mX,SunSnow:gX,SunSnowIcon:gX,Sunrise:xX,SunriseIcon:xX,Sunset:yX,SunsetIcon:yX,Superscript:vX,SuperscriptIcon:vX,SwatchBook:_X,SwatchBookIcon:_X,SwissFranc:bX,SwissFrancIcon:bX,SwitchCamera:wX,SwitchCameraIcon:wX,Sword:jX,SwordIcon:jX,Swords:kX,SwordsIcon:kX,Syringe:NX,SyringeIcon:NX,Table:IX,Table2:KT,Table2Icon:KT,TableCellsMerge:SX,TableCellsMergeIcon:SX,TableCellsSplit:CX,TableCellsSplitIcon:CX,TableColumnsSplit:MX,TableColumnsSplitIcon:MX,TableIcon:IX,TableOfContents:TX,TableOfContentsIcon:TX,TableProperties:AX,TablePropertiesIcon:AX,TableRowsSplit:EX,TableRowsSplitIcon:EX,Tablet:LX,TabletIcon:LX,TabletSmartphone:PX,TabletSmartphoneIcon:PX,Tablets:OX,TabletsIcon:OX,Tag:Hx,TagIcon:Hx,Tags:DX,TagsIcon:DX,Tally1:RX,Tally1Icon:RX,Tally2:FX,Tally2Icon:FX,Tally3:zX,Tally3Icon:zX,Tally4:BX,Tally4Icon:BX,Tally5:$X,Tally5Icon:$X,Tangent:UX,TangentIcon:UX,Target:Wx,TargetIcon:Wx,Telescope:qX,TelescopeIcon:qX,Tent:HX,TentIcon:HX,TentTree:VX,TentTreeIcon:VX,Terminal:WX,TerminalIcon:WX,TerminalSquare:nw,TerminalSquareIcon:nw,TestTube:GX,TestTube2:ow,TestTube2Icon:ow,TestTubeDiagonal:ow,TestTubeDiagonalIcon:ow,TestTubeIcon:GX,TestTubes:KX,TestTubesIcon:KX,Text:JX,TextCursor:YX,TextCursorIcon:YX,TextCursorInput:ZX,TextCursorInputIcon:ZX,TextIcon:JX,TextQuote:XX,TextQuoteIcon:XX,TextSearch:QX,TextSearchIcon:QX,TextSelect:lw,TextSelectIcon:lw,TextSelection:lw,TextSelectionIcon:lw,Theater:eQ,TheaterIcon:eQ,Thermometer:nQ,ThermometerIcon:nQ,ThermometerSnowflake:tQ,ThermometerSnowflakeIcon:tQ,ThermometerSun:rQ,ThermometerSunIcon:rQ,ThumbsDown:ZT,ThumbsDownIcon:ZT,ThumbsUp:Od,ThumbsUpIcon:Od,Ticket:YT,TicketCheck:sQ,TicketCheckIcon:sQ,TicketIcon:YT,TicketMinus:iQ,TicketMinusIcon:iQ,TicketPercent:aQ,TicketPercentIcon:aQ,TicketPlus:oQ,TicketPlusIcon:oQ,TicketSlash:lQ,TicketSlashIcon:lQ,TicketX:cQ,TicketXIcon:cQ,Tickets:uQ,TicketsIcon:uQ,TicketsPlane:dQ,TicketsPlaneIcon:dQ,Timer:pQ,TimerIcon:pQ,TimerOff:hQ,TimerOffIcon:hQ,TimerReset:fQ,TimerResetIcon:fQ,ToggleLeft:mQ,ToggleLeftIcon:mQ,ToggleRight:gQ,ToggleRightIcon:gQ,Toilet:xQ,ToiletIcon:xQ,Tornado:yQ,TornadoIcon:yQ,Torus:vQ,TorusIcon:vQ,Touchpad:bQ,TouchpadIcon:bQ,TouchpadOff:_Q,TouchpadOffIcon:_Q,TowerControl:wQ,TowerControlIcon:wQ,ToyBrick:jQ,ToyBrickIcon:jQ,Tractor:kQ,TractorIcon:kQ,TrafficCone:NQ,TrafficConeIcon:NQ,Train:cw,TrainFront:CQ,TrainFrontIcon:CQ,TrainFrontTunnel:SQ,TrainFrontTunnelIcon:SQ,TrainIcon:cw,TrainTrack:MQ,TrainTrackIcon:MQ,TramFront:cw,TramFrontIcon:cw,Trash:TQ,Trash2:Zn,Trash2Icon:Zn,TrashIcon:TQ,TreeDeciduous:AQ,TreeDeciduousIcon:AQ,TreePalm:dw,TreePalmIcon:dw,TreePine:v1,TreePineIcon:v1,Trees:EQ,TreesIcon:EQ,Trello:IQ,TrelloIcon:IQ,TrendingDown:_1,TrendingDownIcon:_1,TrendingUp:Kf,TrendingUpDown:PQ,TrendingUpDownIcon:PQ,TrendingUpIcon:Kf,Triangle:OQ,TriangleAlert:zh,TriangleAlertIcon:zh,TriangleIcon:OQ,TriangleRight:LQ,TriangleRightIcon:LQ,Trophy:Ha,TrophyIcon:Ha,Truck:XT,TruckIcon:XT,Turtle:DQ,TurtleIcon:DQ,Tv:FQ,Tv2:uw,Tv2Icon:uw,TvIcon:FQ,TvMinimal:uw,TvMinimalIcon:uw,TvMinimalPlay:RQ,TvMinimalPlayIcon:RQ,Twitch:zQ,TwitchIcon:zQ,Twitter:BQ,TwitterIcon:BQ,Type:UQ,TypeIcon:UQ,TypeOutline:$Q,TypeOutlineIcon:$Q,Umbrella:VQ,UmbrellaIcon:VQ,UmbrellaOff:qQ,UmbrellaOffIcon:qQ,Underline:HQ,UnderlineIcon:HQ,Undo:mS,Undo2:WQ,Undo2Icon:WQ,UndoDot:GQ,UndoDotIcon:GQ,UndoIcon:mS,UnfoldHorizontal:KQ,UnfoldHorizontalIcon:KQ,UnfoldVertical:ZQ,UnfoldVerticalIcon:ZQ,Ungroup:YQ,UngroupIcon:YQ,University:hw,UniversityIcon:hw,Unlink:QT,Unlink2:XQ,Unlink2Icon:XQ,UnlinkIcon:QT,Unlock:B2,UnlockIcon:B2,UnlockKeyhole:z2,UnlockKeyholeIcon:z2,Unplug:QQ,UnplugIcon:QQ,Upload:go,UploadCloud:f2,UploadCloudIcon:f2,UploadIcon:go,Usb:JQ,UsbIcon:JQ,User:Cc,User2:yw,User2Icon:yw,UserCheck:vj,UserCheck2:fw,UserCheck2Icon:fw,UserCheckIcon:vj,UserCircle:c2,UserCircle2:l2,UserCircle2Icon:l2,UserCircleIcon:c2,UserCog:JT,UserCog2:pw,UserCog2Icon:pw,UserCogIcon:JT,UserIcon:Cc,UserMinus:eJ,UserMinus2:mw,UserMinus2Icon:mw,UserMinusIcon:eJ,UserPen:tJ,UserPenIcon:tJ,UserPlus:Qh,UserPlus2:gw,UserPlus2Icon:gw,UserPlusIcon:Qh,UserRound:yw,UserRoundCheck:fw,UserRoundCheckIcon:fw,UserRoundCog:pw,UserRoundCogIcon:pw,UserRoundIcon:yw,UserRoundMinus:mw,UserRoundMinusIcon:mw,UserRoundPen:rJ,UserRoundPenIcon:rJ,UserRoundPlus:gw,UserRoundPlusIcon:gw,UserRoundSearch:nJ,UserRoundSearchIcon:nJ,UserRoundX:xw,UserRoundXIcon:xw,UserSearch:sJ,UserSearchIcon:sJ,UserSquare:iw,UserSquare2:sw,UserSquare2Icon:sw,UserSquareIcon:iw,UserX:iJ,UserX2:xw,UserX2Icon:xw,UserXIcon:iJ,Users:Kn,Users2:vw,Users2Icon:vw,UsersIcon:Kn,UsersRound:vw,UsersRoundIcon:vw,Utensils:bw,UtensilsCrossed:_w,UtensilsCrossedIcon:_w,UtensilsIcon:bw,UtilityPole:aJ,UtilityPoleIcon:aJ,Variable:eA,VariableIcon:eA,Vault:oJ,VaultIcon:oJ,Vegan:lJ,VeganIcon:lJ,VenetianMask:cJ,VenetianMaskIcon:cJ,Verified:b_,VerifiedIcon:b_,Vibrate:uJ,VibrateIcon:uJ,VibrateOff:dJ,VibrateOffIcon:dJ,Video:Fi,VideoIcon:Fi,VideoOff:hJ,VideoOffIcon:hJ,Videotape:fJ,VideotapeIcon:fJ,View:pJ,ViewIcon:pJ,Voicemail:mJ,VoicemailIcon:mJ,Volleyball:gJ,VolleyballIcon:gJ,Volume:bJ,Volume1:xJ,Volume1Icon:xJ,Volume2:yJ,Volume2Icon:yJ,VolumeIcon:bJ,VolumeOff:vJ,VolumeOffIcon:vJ,VolumeX:_J,VolumeXIcon:_J,Vote:wJ,VoteIcon:wJ,Wallet:kJ,Wallet2:ww,Wallet2Icon:ww,WalletCards:jJ,WalletCardsIcon:jJ,WalletIcon:kJ,WalletMinimal:ww,WalletMinimalIcon:ww,Wallpaper:NJ,WallpaperIcon:NJ,Wand:SJ,Wand2:jw,Wand2Icon:jw,WandIcon:SJ,WandSparkles:jw,WandSparklesIcon:jw,Warehouse:CJ,WarehouseIcon:CJ,WashingMachine:MJ,WashingMachineIcon:MJ,Watch:TJ,WatchIcon:TJ,Waves:AJ,WavesIcon:AJ,Waypoints:EJ,WaypointsIcon:EJ,Webcam:IJ,WebcamIcon:IJ,Webhook:LJ,WebhookIcon:LJ,WebhookOff:PJ,WebhookOffIcon:PJ,Weight:OJ,WeightIcon:OJ,Wheat:RJ,WheatIcon:RJ,WheatOff:DJ,WheatOffIcon:DJ,WholeWord:FJ,WholeWordIcon:FJ,Wifi:qJ,WifiHigh:zJ,WifiHighIcon:zJ,WifiIcon:qJ,WifiLow:BJ,WifiLowIcon:BJ,WifiOff:$J,WifiOffIcon:$J,WifiZero:UJ,WifiZeroIcon:UJ,Wind:HJ,WindArrowDown:VJ,WindArrowDownIcon:VJ,WindIcon:HJ,Wine:GJ,WineIcon:GJ,WineOff:WJ,WineOffIcon:WJ,Workflow:KJ,WorkflowIcon:KJ,Worm:ZJ,WormIcon:ZJ,WrapText:YJ,WrapTextIcon:YJ,Wrench:Gx,WrenchIcon:Gx,X:Ts,XCircle:zc,XCircleIcon:zc,XIcon:Ts,XOctagon:H2,XOctagonIcon:H2,XSquare:aw,XSquareIcon:aw,Youtube:XJ,YoutubeIcon:XJ,Zap:jg,ZapIcon:jg,ZapOff:QJ,ZapOffIcon:QJ,ZoomIn:gS,ZoomInIcon:gS,ZoomOut:xS,ZoomOutIcon:xS,createLucideIcon:U,icons:wZe},Symbol.toStringTag,{value:"Module"})),Wme="-",jZe=e=>{const t=NZe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const a=l.split(Wme);return a[0]===""&&a.length!==1&&a.shift(),MAe(a,t)||kZe(l)},getConflictingClassGroupIds:(l,a)=>{const h=n[l]||[];return a&&s[l]?[...h,...s[l]]:h}}},MAe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),i=s?MAe(e.slice(1),s):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Wme);return(l=t.validators.find(({validator:a})=>a(o)))==null?void 0:l.classGroupId},Ybe=/^\[(.+)\]$/,kZe=e=>{if(Ybe.test(e)){const t=Ybe.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},NZe=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return CZe(Object.entries(e.classGroups),n).forEach(([o,l])=>{uue(l,s,o,t)}),s},uue=(e,t,n,s)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:Xbe(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(SZe(i)){uue(i(s),t,n,s);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,l])=>{uue(l,Xbe(t,o),n,s)})})},Xbe=(e,t)=>{let n=e;return t.split(Wme).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},SZe=e=>e.isThemeGetter,CZe=(e,t)=>t?e.map(([n,s])=>{const i=s.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,a])=>[t+l,a])):o);return[n,i]}):e,MZe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const i=(o,l)=>{n.set(o,l),t++,t>e&&(t=0,s=n,n=new Map)};return{get(o){let l=n.get(o);if(l!==void 0)return l;if((l=s.get(o))!==void 0)return i(o,l),l},set(o,l){n.has(o)?n.set(o,l):i(o,l)}}},TAe="!",TZe=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,i=t[0],o=t.length,l=a=>{const h=[];let p=0,x=0,y;for(let A=0;Ax?y-x:void 0;return{modifiers:h,hasImportantModifier:j,baseClassName:S,maybePostfixModifierPosition:C}};return n?a=>n({className:a,parseClassName:l}):l},AZe=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},EZe=e=>({cache:MZe(e.cacheSize),parseClassName:TZe(e),...jZe(e)}),IZe=/\s+/,PZe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=t,o=[],l=e.trim().split(IZe);let a="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{modifiers:x,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:j}=n(p);let S=!!j,C=s(S?w.substring(0,j):w);if(!C){if(!S){a=p+(a.length>0?" "+a:a);continue}if(C=s(w),!C){a=p+(a.length>0?" "+a:a);continue}S=!1}const A=AZe(x).join(":"),E=y?A+TAe:A,T=E+C;if(o.includes(T))continue;o.push(T);const O=i(C,S);for(let z=0;z0?" "+a:a)}return a};function LZe(){let e=0,t,n,s="";for(;e{if(typeof e=="string")return e;let t,n="";for(let s=0;sy(x),e());return n=EZe(p),s=n.cache.get,i=n.cache.set,o=a,a(h)}function a(h){const p=s(h);if(p)return p;const x=PZe(h,n);return i(h,x),x}return function(){return o(LZe.apply(null,arguments))}}const ll=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},EAe=/^\[(?:([a-z-]+):)?(.+)\]$/i,DZe=/^\d+\/\d+$/,RZe=new Set(["px","full","screen"]),FZe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zZe=/\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$/,BZe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,$Ze=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UZe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ux=e=>yS(e)||RZe.has(e)||DZe.test(e),t0=e=>XC(e,"length",YZe),yS=e=>!!e&&!Number.isNaN(Number(e)),vle=e=>XC(e,"number",yS),AM=e=>!!e&&Number.isInteger(Number(e)),qZe=e=>e.endsWith("%")&&yS(e.slice(0,-1)),ta=e=>EAe.test(e),r0=e=>FZe.test(e),VZe=new Set(["length","size","percentage"]),HZe=e=>XC(e,VZe,IAe),WZe=e=>XC(e,"position",IAe),GZe=new Set(["image","url"]),KZe=e=>XC(e,GZe,QZe),ZZe=e=>XC(e,"",XZe),EM=()=>!0,XC=(e,t,n)=>{const s=EAe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},YZe=e=>zZe.test(e)&&!BZe.test(e),IAe=()=>!1,XZe=e=>$Ze.test(e),QZe=e=>UZe.test(e),JZe=()=>{const e=ll("colors"),t=ll("spacing"),n=ll("blur"),s=ll("brightness"),i=ll("borderColor"),o=ll("borderRadius"),l=ll("borderSpacing"),a=ll("borderWidth"),h=ll("contrast"),p=ll("grayscale"),x=ll("hueRotate"),y=ll("invert"),w=ll("gap"),j=ll("gradientColorStops"),S=ll("gradientColorStopPositions"),C=ll("inset"),A=ll("margin"),E=ll("opacity"),T=ll("padding"),O=ll("saturate"),z=ll("scale"),F=ll("sepia"),q=ll("skew"),H=ll("space"),K=ll("translate"),Z=()=>["auto","contain","none"],re=()=>["auto","hidden","clip","visible","scroll"],ue=()=>["auto",ta,t],he=()=>[ta,t],be=()=>["",ux,t0],ne=()=>["auto",yS,ta],ye=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>["start","end","center","between","around","evenly","stretch"],_e=()=>["","0",ta],Ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ke=()=>[yS,ta];return{cacheSize:500,separator:":",theme:{colors:[EM],spacing:[ux,t0],blur:["none","",r0,ta],brightness:ke(),borderColor:[e],borderRadius:["none","","full",r0,ta],borderSpacing:he(),borderWidth:be(),contrast:ke(),grayscale:_e(),hueRotate:ke(),invert:_e(),gap:he(),gradientColorStops:[e],gradientColorStopPositions:[qZe,t0],inset:ue(),margin:ue(),opacity:ke(),padding:he(),saturate:ke(),scale:ke(),sepia:_e(),skew:ke(),space:he(),translate:he()},classGroups:{aspect:[{aspect:["auto","square","video",ta]}],container:["container"],columns:[{columns:[r0]}],"break-after":[{"break-after":Ee()}],"break-before":[{"break-before":Ee()}],"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:[...ye(),ta]}],overflow:[{overflow:re()}],"overflow-x":[{"overflow-x":re()}],"overflow-y":[{"overflow-y":re()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",AM,ta]}],basis:[{basis:ue()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ta]}],grow:[{grow:_e()}],shrink:[{shrink:_e()}],order:[{order:["first","last","none",AM,ta]}],"grid-cols":[{"grid-cols":[EM]}],"col-start-end":[{col:["auto",{span:["full",AM,ta]},ta]}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":[EM]}],"row-start-end":[{row:["auto",{span:[AM,ta]},ta]}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ta]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ta]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...de()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...de(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...de(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[A]}],mx:[{mx:[A]}],my:[{my:[A]}],ms:[{ms:[A]}],me:[{me:[A]}],mt:[{mt:[A]}],mr:[{mr:[A]}],mb:[{mb:[A]}],ml:[{ml:[A]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ta,t]}],"min-w":[{"min-w":[ta,t,"min","max","fit"]}],"max-w":[{"max-w":[ta,t,"none","full","min","max","fit","prose",{screen:[r0]},r0]}],h:[{h:[ta,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ta,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ta,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ta,t,"auto","min","max","fit"]}],"font-size":[{text:["base",r0,t0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",vle]}],"font-family":[{font:[EM]}],"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",ta]}],"line-clamp":[{"line-clamp":["none",yS,vle]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ux,ta]}],"list-image":[{"list-image":["none",ta]}],"list-style-type":[{list:["none","disc","decimal",ta]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ux,t0]}],"underline-offset":[{"underline-offset":["auto",ux,ta]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:he()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ta]}],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",ta]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ye(),WZe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",HZe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},KZe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],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:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:ie()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[ux,ta]}],"outline-w":[{outline:[ux,t0]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[ux,t0]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",r0,ZZe]}],"shadow-color":[{shadow:[EM]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",r0,ta]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[y]}],saturate:[{saturate:[O]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[O]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ta]}],duration:[{duration:ke()}],ease:[{ease:["linear","in","out","in-out",ta]}],delay:[{delay:ke()}],animate:[{animate:["none","spin","ping","pulse","bounce",ta]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[AM,ta]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[q]}],"skew-y":[{"skew-y":[q]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ta]}],accent:[{accent:["auto",e]}],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",ta]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":he()}],"scroll-mx":[{"scroll-mx":he()}],"scroll-my":[{"scroll-my":he()}],"scroll-ms":[{"scroll-ms":he()}],"scroll-me":[{"scroll-me":he()}],"scroll-mt":[{"scroll-mt":he()}],"scroll-mr":[{"scroll-mr":he()}],"scroll-mb":[{"scroll-mb":he()}],"scroll-ml":[{"scroll-ml":he()}],"scroll-p":[{"scroll-p":he()}],"scroll-px":[{"scroll-px":he()}],"scroll-py":[{"scroll-py":he()}],"scroll-ps":[{"scroll-ps":he()}],"scroll-pe":[{"scroll-pe":he()}],"scroll-pt":[{"scroll-pt":he()}],"scroll-pr":[{"scroll-pr":he()}],"scroll-pb":[{"scroll-pb":he()}],"scroll-pl":[{"scroll-pl":he()}],"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"]}],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",ta]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ux,t0,vle]}],stroke:[{stroke:[e,"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"]}}},eYe=OZe(JZe);function $t(...e){return eYe(ra(e))}function Td(e,t=!1){return t&&e>=1e6?`$${(e/1e6).toFixed(1)}M`:t&&e>=1e3?`$${(e/1e3).toFixed(0)}K`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function Qbe(e){const t=new Date(e);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}function Ane(e){return e?e.replace(/<[^>]*>/g,""):""}const tYe=vZe,PAe=P.forwardRef(({className:e,...t},n)=>r.jsx(yAe,{ref:n,className:$t("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));PAe.displayName=yAe.displayName;const rYe=YC("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"}}),LAe=P.forwardRef(({className:e,variant:t,...n},s)=>r.jsx(vAe,{ref:s,className:$t(rYe({variant:t}),e),...n}));LAe.displayName=vAe.displayName;const nYe=P.forwardRef(({className:e,...t},n)=>r.jsx(wAe,{ref:n,className:$t("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",e),...t}));nYe.displayName=wAe.displayName;const OAe=P.forwardRef(({className:e,...t},n)=>r.jsx(jAe,{ref:n,className:$t("absolute right-2 top-2 rounded-md p-1 text-foreground/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",e),"toast-close":"",...t,children:r.jsx(Ts,{className:"h-4 w-4"})}));OAe.displayName=jAe.displayName;const DAe=P.forwardRef(({className:e,...t},n)=>r.jsx(_Ae,{ref:n,className:$t("text-sm font-semibold",e),...t}));DAe.displayName=_Ae.displayName;const RAe=P.forwardRef(({className:e,...t},n)=>r.jsx(bAe,{ref:n,className:$t("text-sm opacity-90",e),...t}));RAe.displayName=bAe.displayName;function sYe(){const{toasts:e}=pa();return r.jsxs(tYe,{children:[e.map(function({id:t,title:n,description:s,action:i,...o}){return r.jsxs(LAe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(DAe,{children:n}),s&&r.jsx(RAe,{children:s})]}),i,r.jsx(OAe,{})]},t)}),r.jsx(PAe,{})]})}var Jbe=["light","dark"],iYe="(prefers-color-scheme: dark)",aYe=P.createContext(void 0),oYe={setTheme:e=>{},themes:[]},lYe=()=>{var e;return(e=P.useContext(aYe))!=null?e:oYe};P.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:s,enableColorScheme:i,defaultTheme:o,value:l,attrs:a,nonce:h})=>{let p=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(S=>`'${S}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,y=i?Jbe.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",w=(S,C=!1,A=!0)=>{let E=l?l[S]:S,T=C?S+"|| ''":`'${E}'`,O="";return i&&A&&!C&&Jbe.includes(S)&&(O+=`d.style.colorScheme = '${S}';`),n==="class"?C||E?O+=`c.add(${T})`:O+="null":E&&(O+=`d[s](n,${T})`),O},j=e?`!function(){${x}${w(e)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${p})){var t='${iYe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${w("dark")}}else{${w("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${w(l?"x[e]":"e",!0)}}${p?"":"else{"+w(o,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${t}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${w(l?"x[e]":"e",!0)}}else{${w(o,!1,!1)};}${y}}catch(t){}}();`;return P.createElement("script",{nonce:h,dangerouslySetInnerHTML:{__html:j}})});var cYe=e=>{switch(e){case"success":return hYe;case"info":return pYe;case"warning":return fYe;case"error":return mYe;default:return null}},dYe=Array(12).fill(0),uYe=({visible:e,className:t})=>rt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},rt.createElement("div",{className:"sonner-spinner"},dYe.map((n,s)=>rt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),hYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},rt.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"})),fYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},rt.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"})),pYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},rt.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"})),mYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},rt.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"})),gYe=rt.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"},rt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),rt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xYe=()=>{let[e,t]=rt.useState(document.hidden);return rt.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},hue=1,yYe=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:hue++,o=this.toasts.find(a=>a.id===i),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(a=>a.id===i?(this.publish({...a,...e,id:i,title:n}),{...a,...e,id:i,dismissible:l,title:n}):a):this.addToast({title:n,...s,dismissible:l,id:i}),i},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),i=n!==void 0,o,l=s.then(async h=>{if(o=["resolve",h],rt.isValidElement(h))i=!1,this.create({id:n,type:"default",message:h});else if(_Ye(h)&&!h.ok){i=!1;let p=typeof t.error=="function"?await t.error(`HTTP error! status: ${h.status}`):t.error,x=typeof t.description=="function"?await t.description(`HTTP error! status: ${h.status}`):t.description;this.create({id:n,type:"error",message:p,description:x})}else if(t.success!==void 0){i=!1;let p=typeof t.success=="function"?await t.success(h):t.success,x=typeof t.description=="function"?await t.description(h):t.description;this.create({id:n,type:"success",message:p,description:x})}}).catch(async h=>{if(o=["reject",h],t.error!==void 0){i=!1;let p=typeof t.error=="function"?await t.error(h):t.error,x=typeof t.description=="function"?await t.description(h):t.description;this.create({id:n,type:"error",message:p,description:x})}}).finally(()=>{var h;i&&(this.dismiss(n),n=void 0),(h=t.finally)==null||h.call(t)}),a=()=>new Promise((h,p)=>l.then(()=>o[0]==="reject"?p(o[1]):h(o[1])).catch(p));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||hue++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ih=new yYe,vYe=(e,t)=>{let n=(t==null?void 0:t.id)||hue++;return ih.addToast({title:e,...t,id:n}),n},_Ye=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",bYe=vYe,wYe=()=>ih.toasts,jYe=()=>ih.getActiveToasts(),ze=Object.assign(bYe,{success:ih.success,info:ih.info,warning:ih.warning,error:ih.error,custom:ih.custom,message:ih.message,promise:ih.promise,dismiss:ih.dismiss,loading:ih.loading},{getHistory:wYe,getToasts:jYe});function kYe(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}kYe(`: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;left: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}: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%);--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%)} `);function nL(e){return e.label!==void 0}var NYe=3,SYe="32px",CYe="16px",ewe=4e3,MYe=356,TYe=14,AYe=20,EYe=200;function Bp(...e){return e.filter(Boolean).join(" ")}function IYe(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var PYe=e=>{var t,n,s,i,o,l,a,h,p,x,y;let{invert:w,toast:j,unstyled:S,interacting:C,setHeights:A,visibleToasts:E,heights:T,index:O,toasts:z,expanded:F,removeToast:q,defaultRichColors:H,closeButton:K,style:Z,cancelButtonStyle:re,actionButtonStyle:ue,className:he="",descriptionClassName:be="",duration:ne,position:ye,gap:ie,loadingIcon:fe,expandByDefault:de,classNames:_e,icons:Ee,closeButtonAriaLabel:ke="Close toast",pauseWhenPageIsHidden:pe}=e,[ae,ge]=rt.useState(null),[Me,Ue]=rt.useState(null),[Ie,Ke]=rt.useState(!1),[Re,Ce]=rt.useState(!1),[Je,Te]=rt.useState(!1),[Ye,xe]=rt.useState(!1),[mt,et]=rt.useState(!1),[nt,Ae]=rt.useState(0),[pt,Be]=rt.useState(0),Qe=rt.useRef(j.duration||ne||ewe),tt=rt.useRef(null),ht=rt.useRef(null),wt=O===0,Ct=O+1<=E,It=j.type,jt=j.dismissible!==!1,rr=j.className||"",Ar=j.descriptionClassName||"",gn=rt.useMemo(()=>T.findIndex(ks=>ks.toastId===j.id)||0,[T,j.id]),kn=rt.useMemo(()=>{var ks;return(ks=j.closeButton)!=null?ks:K},[j.closeButton,K]),Jr=rt.useMemo(()=>j.duration||ne||ewe,[j.duration,ne]),zn=rt.useRef(0),js=rt.useRef(0),fr=rt.useRef(0),xs=rt.useRef(null),[bi,mi]=ye.split("-"),La=rt.useMemo(()=>T.reduce((ks,Ei,Ii)=>Ii>=gn?ks:ks+Ei.height,0),[T,gn]),da=xYe(),tl=j.invert||w,rl=It==="loading";js.current=rt.useMemo(()=>gn*ie+La,[gn,La]),rt.useEffect(()=>{Qe.current=Jr},[Jr]),rt.useEffect(()=>{Ke(!0)},[]),rt.useEffect(()=>{let ks=ht.current;if(ks){let Ei=ks.getBoundingClientRect().height;return Be(Ei),A(Ii=>[{toastId:j.id,height:Ei,position:j.position},...Ii]),()=>A(Ii=>Ii.filter(Oo=>Oo.toastId!==j.id))}},[A,j.id]),rt.useLayoutEffect(()=>{if(!Ie)return;let ks=ht.current,Ei=ks.style.height;ks.style.height="auto";let Ii=ks.getBoundingClientRect().height;ks.style.height=Ei,Be(Ii),A(Oo=>Oo.find(ir=>ir.toastId===j.id)?Oo.map(ir=>ir.toastId===j.id?{...ir,height:Ii}:ir):[{toastId:j.id,height:Ii,position:j.position},...Oo])},[Ie,j.title,j.description,A,j.id]);let Ws=rt.useCallback(()=>{Ce(!0),Ae(js.current),A(ks=>ks.filter(Ei=>Ei.toastId!==j.id)),setTimeout(()=>{q(j)},EYe)},[j,q,A,js]);rt.useEffect(()=>{if(j.promise&&It==="loading"||j.duration===1/0||j.type==="loading")return;let ks;return F||C||pe&&da?(()=>{if(fr.current{var Ei;(Ei=j.onAutoClose)==null||Ei.call(j,j),Ws()},Qe.current)),()=>clearTimeout(ks)},[F,C,j,It,pe,da,Ws]),rt.useEffect(()=>{j.delete&&Ws()},[Ws,j.delete]);function Zi(){var ks,Ei,Ii;return Ee!=null&&Ee.loading?rt.createElement("div",{className:Bp(_e==null?void 0:_e.loader,(ks=j==null?void 0:j.classNames)==null?void 0:ks.loader,"sonner-loader"),"data-visible":It==="loading"},Ee.loading):fe?rt.createElement("div",{className:Bp(_e==null?void 0:_e.loader,(Ei=j==null?void 0:j.classNames)==null?void 0:Ei.loader,"sonner-loader"),"data-visible":It==="loading"},fe):rt.createElement(uYe,{className:Bp(_e==null?void 0:_e.loader,(Ii=j==null?void 0:j.classNames)==null?void 0:Ii.loader),visible:It==="loading"})}return rt.createElement("li",{tabIndex:0,ref:ht,className:Bp(he,rr,_e==null?void 0:_e.toast,(t=j==null?void 0:j.classNames)==null?void 0:t.toast,_e==null?void 0:_e.default,_e==null?void 0:_e[It],(n=j==null?void 0:j.classNames)==null?void 0:n[It]),"data-sonner-toast":"","data-rich-colors":(s=j.richColors)!=null?s:H,"data-styled":!(j.jsx||j.unstyled||S),"data-mounted":Ie,"data-promise":!!j.promise,"data-swiped":mt,"data-removed":Re,"data-visible":Ct,"data-y-position":bi,"data-x-position":mi,"data-index":O,"data-front":wt,"data-swiping":Je,"data-dismissible":jt,"data-type":It,"data-invert":tl,"data-swipe-out":Ye,"data-swipe-direction":Me,"data-expanded":!!(F||de&&Ie),style:{"--index":O,"--toasts-before":O,"--z-index":z.length-O,"--offset":`${Re?nt:js.current}px`,"--initial-height":de?"auto":`${pt}px`,...Z,...j.style},onDragEnd:()=>{Te(!1),ge(null),xs.current=null},onPointerDown:ks=>{rl||!jt||(tt.current=new Date,Ae(js.current),ks.target.setPointerCapture(ks.pointerId),ks.target.tagName!=="BUTTON"&&(Te(!0),xs.current={x:ks.clientX,y:ks.clientY}))},onPointerUp:()=>{var ks,Ei,Ii,Oo;if(Ye||!jt)return;xs.current=null;let ir=Number(((ks=ht.current)==null?void 0:ks.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),xo=Number(((Ei=ht.current)==null?void 0:Ei.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Tc=new Date().getTime()-((Ii=tt.current)==null?void 0:Ii.getTime()),yo=ae==="x"?ir:xo,ss=Math.abs(yo)/Tc;if(Math.abs(yo)>=AYe||ss>.11){Ae(js.current),(Oo=j.onDismiss)==null||Oo.call(j,j),Ue(ae==="x"?ir>0?"right":"left":xo>0?"down":"up"),Ws(),xe(!0),et(!1);return}Te(!1),ge(null)},onPointerMove:ks=>{var Ei,Ii,Oo,ir;if(!xs.current||!jt||((Ei=window.getSelection())==null?void 0:Ei.toString().length)>0)return;let xo=ks.clientY-xs.current.y,Tc=ks.clientX-xs.current.x,yo=(Ii=e.swipeDirections)!=null?Ii:IYe(ye);!ae&&(Math.abs(Tc)>1||Math.abs(xo)>1)&&ge(Math.abs(Tc)>Math.abs(xo)?"x":"y");let ss={x:0,y:0};ae==="y"?(yo.includes("top")||yo.includes("bottom"))&&(yo.includes("top")&&xo<0||yo.includes("bottom")&&xo>0)&&(ss.y=xo):ae==="x"&&(yo.includes("left")||yo.includes("right"))&&(yo.includes("left")&&Tc<0||yo.includes("right")&&Tc>0)&&(ss.x=Tc),(Math.abs(ss.x)>0||Math.abs(ss.y)>0)&&et(!0),(Oo=ht.current)==null||Oo.style.setProperty("--swipe-amount-x",`${ss.x}px`),(ir=ht.current)==null||ir.style.setProperty("--swipe-amount-y",`${ss.y}px`)}},kn&&!j.jsx?rt.createElement("button",{"aria-label":ke,"data-disabled":rl,"data-close-button":!0,onClick:rl||!jt?()=>{}:()=>{var ks;Ws(),(ks=j.onDismiss)==null||ks.call(j,j)},className:Bp(_e==null?void 0:_e.closeButton,(i=j==null?void 0:j.classNames)==null?void 0:i.closeButton)},(o=Ee==null?void 0:Ee.close)!=null?o:gYe):null,j.jsx||P.isValidElement(j.title)?j.jsx?j.jsx:typeof j.title=="function"?j.title():j.title:rt.createElement(rt.Fragment,null,It||j.icon||j.promise?rt.createElement("div",{"data-icon":"",className:Bp(_e==null?void 0:_e.icon,(l=j==null?void 0:j.classNames)==null?void 0:l.icon)},j.promise||j.type==="loading"&&!j.icon?j.icon||Zi():null,j.type!=="loading"?j.icon||(Ee==null?void 0:Ee[It])||cYe(It):null):null,rt.createElement("div",{"data-content":"",className:Bp(_e==null?void 0:_e.content,(a=j==null?void 0:j.classNames)==null?void 0:a.content)},rt.createElement("div",{"data-title":"",className:Bp(_e==null?void 0:_e.title,(h=j==null?void 0:j.classNames)==null?void 0:h.title)},typeof j.title=="function"?j.title():j.title),j.description?rt.createElement("div",{"data-description":"",className:Bp(be,Ar,_e==null?void 0:_e.description,(p=j==null?void 0:j.classNames)==null?void 0:p.description)},typeof j.description=="function"?j.description():j.description):null),P.isValidElement(j.cancel)?j.cancel:j.cancel&&nL(j.cancel)?rt.createElement("button",{"data-button":!0,"data-cancel":!0,style:j.cancelButtonStyle||re,onClick:ks=>{var Ei,Ii;nL(j.cancel)&&jt&&((Ii=(Ei=j.cancel).onClick)==null||Ii.call(Ei,ks),Ws())},className:Bp(_e==null?void 0:_e.cancelButton,(x=j==null?void 0:j.classNames)==null?void 0:x.cancelButton)},j.cancel.label):null,P.isValidElement(j.action)?j.action:j.action&&nL(j.action)?rt.createElement("button",{"data-button":!0,"data-action":!0,style:j.actionButtonStyle||ue,onClick:ks=>{var Ei,Ii;nL(j.action)&&((Ii=(Ei=j.action).onClick)==null||Ii.call(Ei,ks),!ks.defaultPrevented&&Ws())},className:Bp(_e==null?void 0:_e.actionButton,(y=j==null?void 0:j.classNames)==null?void 0:y.actionButton)},j.action.label):null))};function twe(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function LYe(e,t){let n={};return[e,t].forEach((s,i)=>{let o=i===1,l=o?"--mobile-offset":"--offset",a=o?CYe:SYe;function h(p){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof p=="number"?`${p}px`:p})}typeof s=="number"||typeof s=="string"?h(s):typeof s=="object"?["top","right","bottom","left"].forEach(p=>{s[p]===void 0?n[`${l}-${p}`]=a:n[`${l}-${p}`]=typeof s[p]=="number"?`${s[p]}px`:s[p]}):h(a)}),n}var OYe=P.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:l,className:a,offset:h,mobileOffset:p,theme:x="light",richColors:y,duration:w,style:j,visibleToasts:S=NYe,toastOptions:C,dir:A=twe(),gap:E=TYe,loadingIcon:T,icons:O,containerAriaLabel:z="Notifications",pauseWhenPageIsHidden:F}=e,[q,H]=rt.useState([]),K=rt.useMemo(()=>Array.from(new Set([s].concat(q.filter(pe=>pe.position).map(pe=>pe.position)))),[q,s]),[Z,re]=rt.useState([]),[ue,he]=rt.useState(!1),[be,ne]=rt.useState(!1),[ye,ie]=rt.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),fe=rt.useRef(null),de=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),_e=rt.useRef(null),Ee=rt.useRef(!1),ke=rt.useCallback(pe=>{H(ae=>{var ge;return(ge=ae.find(Me=>Me.id===pe.id))!=null&&ge.delete||ih.dismiss(pe.id),ae.filter(({id:Me})=>Me!==pe.id)})},[]);return rt.useEffect(()=>ih.subscribe(pe=>{if(pe.dismiss){H(ae=>ae.map(ge=>ge.id===pe.id?{...ge,delete:!0}:ge));return}setTimeout(()=>{Bme.flushSync(()=>{H(ae=>{let ge=ae.findIndex(Me=>Me.id===pe.id);return ge!==-1?[...ae.slice(0,ge),{...ae[ge],...pe},...ae.slice(ge+1)]:[pe,...ae]})})})}),[]),rt.useEffect(()=>{if(x!=="system"){ie(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ie("dark"):ie("light")),typeof window>"u")return;let pe=window.matchMedia("(prefers-color-scheme: dark)");try{pe.addEventListener("change",({matches:ae})=>{ie(ae?"dark":"light")})}catch{pe.addListener(({matches:ge})=>{try{ie(ge?"dark":"light")}catch(Me){console.error(Me)}})}},[x]),rt.useEffect(()=>{q.length<=1&&he(!1)},[q]),rt.useEffect(()=>{let pe=ae=>{var ge,Me;i.every(Ue=>ae[Ue]||ae.code===Ue)&&(he(!0),(ge=fe.current)==null||ge.focus()),ae.code==="Escape"&&(document.activeElement===fe.current||(Me=fe.current)!=null&&Me.contains(document.activeElement))&&he(!1)};return document.addEventListener("keydown",pe),()=>document.removeEventListener("keydown",pe)},[i]),rt.useEffect(()=>{if(fe.current)return()=>{_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null,Ee.current=!1)}},[fe.current]),rt.createElement("section",{ref:t,"aria-label":`${z} ${de}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},K.map((pe,ae)=>{var ge;let[Me,Ue]=pe.split("-");return q.length?rt.createElement("ol",{key:pe,dir:A==="auto"?twe():A,tabIndex:-1,ref:fe,className:a,"data-sonner-toaster":!0,"data-theme":ye,"data-y-position":Me,"data-lifted":ue&&q.length>1&&!o,"data-x-position":Ue,style:{"--front-toast-height":`${((ge=Z[0])==null?void 0:ge.height)||0}px`,"--width":`${MYe}px`,"--gap":`${E}px`,...j,...LYe(h,p)},onBlur:Ie=>{Ee.current&&!Ie.currentTarget.contains(Ie.relatedTarget)&&(Ee.current=!1,_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null))},onFocus:Ie=>{Ie.target instanceof HTMLElement&&Ie.target.dataset.dismissible==="false"||Ee.current||(Ee.current=!0,_e.current=Ie.relatedTarget)},onMouseEnter:()=>he(!0),onMouseMove:()=>he(!0),onMouseLeave:()=>{be||he(!1)},onDragEnd:()=>he(!1),onPointerDown:Ie=>{Ie.target instanceof HTMLElement&&Ie.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},q.filter(Ie=>!Ie.position&&ae===0||Ie.position===pe).map((Ie,Ke)=>{var Re,Ce;return rt.createElement(PYe,{key:Ie.id,icons:O,index:Ke,toast:Ie,defaultRichColors:y,duration:(Re=C==null?void 0:C.duration)!=null?Re:w,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:n,visibleToasts:S,closeButton:(Ce=C==null?void 0:C.closeButton)!=null?Ce:l,interacting:be,position:pe,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,removeToast:ke,toasts:q.filter(Je=>Je.position==Ie.position),heights:Z.filter(Je=>Je.position==Ie.position),setHeights:re,expandByDefault:o,gap:E,loadingIcon:T,expanded:ue,pauseWhenPageIsHidden:F,swipeDirections:e.swipeDirections})})):null}))});const DYe=({...e})=>{const{theme:t="system"}=lYe();return r.jsx(OYe,{theme:t,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",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var RYe=Zpe[" useId ".trim().toString()]||(()=>{}),FYe=0;function Vc(e){const[t,n]=P.useState(RYe());return Yl(()=>{n(s=>s??String(FYe++))},[e]),t?`radix-${t}`:""}const zYe=["top","right","bottom","left"],O1=Math.min,Bh=Math.max,$ee=Math.round,sL=Math.floor,kg=e=>({x:e,y:e}),BYe={left:"right",right:"left",bottom:"top",top:"bottom"},$Ye={start:"end",end:"start"};function fue(e,t,n){return Bh(e,O1(t,n))}function sy(e,t){return typeof e=="function"?e(t):e}function iy(e){return e.split("-")[0]}function QC(e){return e.split("-")[1]}function Gme(e){return e==="x"?"y":"x"}function Kme(e){return e==="y"?"height":"width"}const UYe=new Set(["top","bottom"]);function ug(e){return UYe.has(iy(e))?"y":"x"}function Zme(e){return Gme(ug(e))}function qYe(e,t,n){n===void 0&&(n=!1);const s=QC(e),i=Zme(e),o=Kme(i);let l=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Uee(l)),[l,Uee(l)]}function VYe(e){const t=Uee(e);return[pue(e),t,pue(t)]}function pue(e){return e.replace(/start|end/g,t=>$Ye[t])}const rwe=["left","right"],nwe=["right","left"],HYe=["top","bottom"],WYe=["bottom","top"];function GYe(e,t,n){switch(e){case"top":case"bottom":return n?t?nwe:rwe:t?rwe:nwe;case"left":case"right":return t?HYe:WYe;default:return[]}}function KYe(e,t,n,s){const i=QC(e);let o=GYe(iy(e),n==="start",s);return i&&(o=o.map(l=>l+"-"+i),t&&(o=o.concat(o.map(pue)))),o}function Uee(e){return e.replace(/left|right|bottom|top/g,t=>BYe[t])}function ZYe(e){return{top:0,right:0,bottom:0,left:0,...e}}function FAe(e){return typeof e!="number"?ZYe(e):{top:e,right:e,bottom:e,left:e}}function qee(e){const{x:t,y:n,width:s,height:i}=e;return{width:s,height:i,top:n,left:t,right:t+s,bottom:n+i,x:t,y:n}}function swe(e,t,n){let{reference:s,floating:i}=e;const o=ug(t),l=Zme(t),a=Kme(l),h=iy(t),p=o==="y",x=s.x+s.width/2-i.width/2,y=s.y+s.height/2-i.height/2,w=s[a]/2-i[a]/2;let j;switch(h){case"top":j={x,y:s.y-i.height};break;case"bottom":j={x,y:s.y+s.height};break;case"right":j={x:s.x+s.width,y};break;case"left":j={x:s.x-i.width,y};break;default:j={x:s.x,y:s.y}}switch(QC(t)){case"start":j[l]-=w*(n&&p?-1:1);break;case"end":j[l]+=w*(n&&p?-1:1);break}return j}const YYe=async(e,t,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,a=o.filter(Boolean),h=await(l.isRTL==null?void 0:l.isRTL(t));let p=await l.getElementRects({reference:e,floating:t,strategy:i}),{x,y}=swe(p,s,h),w=s,j={},S=0;for(let C=0;C({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:i,rects:o,platform:l,elements:a,middlewareData:h}=t,{element:p,padding:x=0}=sy(e,t)||{};if(p==null)return{};const y=FAe(x),w={x:n,y:s},j=Zme(i),S=Kme(j),C=await l.getDimensions(p),A=j==="y",E=A?"top":"left",T=A?"bottom":"right",O=A?"clientHeight":"clientWidth",z=o.reference[S]+o.reference[j]-w[j]-o.floating[S],F=w[j]-o.reference[j],q=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let H=q?q[O]:0;(!H||!await(l.isElement==null?void 0:l.isElement(q)))&&(H=a.floating[O]||o.floating[S]);const K=z/2-F/2,Z=H/2-C[S]/2-1,re=O1(y[E],Z),ue=O1(y[T],Z),he=re,be=H-C[S]-ue,ne=H/2-C[S]/2+K,ye=fue(he,ne,be),ie=!h.arrow&&QC(i)!=null&&ne!==ye&&o.reference[S]/2-(nene<=0)){var ue,he;const ne=(((ue=o.flip)==null?void 0:ue.index)||0)+1,ye=H[ne];if(ye&&(!(y==="alignment"?T!==ug(ye):!1)||re.every(de=>de.overflows[0]>0&&ug(de.placement)===T)))return{data:{index:ne,overflows:re},reset:{placement:ye}};let ie=(he=re.filter(fe=>fe.overflows[0]<=0).sort((fe,de)=>fe.overflows[1]-de.overflows[1])[0])==null?void 0:he.placement;if(!ie)switch(j){case"bestFit":{var be;const fe=(be=re.filter(de=>{if(q){const _e=ug(de.placement);return _e===T||_e==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(_e=>_e>0).reduce((_e,Ee)=>_e+Ee,0)]).sort((de,_e)=>de[1]-_e[1])[0])==null?void 0:be[0];fe&&(ie=fe);break}case"initialPlacement":ie=a;break}if(i!==ie)return{reset:{placement:ie}}}return{}}}};function iwe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function awe(e){return zYe.some(t=>e[t]>=0)}const JYe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...i}=sy(e,t);switch(s){case"referenceHidden":{const o=await UA(t,{...i,elementContext:"reference"}),l=iwe(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:awe(l)}}}case"escaped":{const o=await UA(t,{...i,altBoundary:!0}),l=iwe(o,n.floating);return{data:{escapedOffsets:l,escaped:awe(l)}}}default:return{}}}}},zAe=new Set(["left","top"]);async function eXe(e,t){const{placement:n,platform:s,elements:i}=e,o=await(s.isRTL==null?void 0:s.isRTL(i.floating)),l=iy(n),a=QC(n),h=ug(n)==="y",p=zAe.has(l)?-1:1,x=o&&h?-1:1,y=sy(t,e);let{mainAxis:w,crossAxis:j,alignmentAxis:S}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return a&&typeof S=="number"&&(j=a==="end"?S*-1:S),h?{x:j*x,y:w*p}:{x:w*p,y:j*x}}const tXe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:i,y:o,placement:l,middlewareData:a}=t,h=await eXe(t,e);return l===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+h.x,y:o+h.y,data:{...h,placement:l}}}}},rXe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:a={fn:A=>{let{x:E,y:T}=A;return{x:E,y:T}}},...h}=sy(e,t),p={x:n,y:s},x=await UA(t,h),y=ug(iy(i)),w=Gme(y);let j=p[w],S=p[y];if(o){const A=w==="y"?"top":"left",E=w==="y"?"bottom":"right",T=j+x[A],O=j-x[E];j=fue(T,j,O)}if(l){const A=y==="y"?"top":"left",E=y==="y"?"bottom":"right",T=S+x[A],O=S-x[E];S=fue(T,S,O)}const C=a.fn({...t,[w]:j,[y]:S});return{...C,data:{x:C.x-n,y:C.y-s,enabled:{[w]:o,[y]:l}}}}}},nXe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:i,rects:o,middlewareData:l}=t,{offset:a=0,mainAxis:h=!0,crossAxis:p=!0}=sy(e,t),x={x:n,y:s},y=ug(i),w=Gme(y);let j=x[w],S=x[y];const C=sy(a,t),A=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(h){const O=w==="y"?"height":"width",z=o.reference[w]-o.floating[O]+A.mainAxis,F=o.reference[w]+o.reference[O]-A.mainAxis;jF&&(j=F)}if(p){var E,T;const O=w==="y"?"width":"height",z=zAe.has(iy(i)),F=o.reference[y]-o.floating[O]+(z&&((E=l.offset)==null?void 0:E[y])||0)+(z?0:A.crossAxis),q=o.reference[y]+o.reference[O]+(z?0:((T=l.offset)==null?void 0:T[y])||0)-(z?A.crossAxis:0);Sq&&(S=q)}return{[w]:j,[y]:S}}}},sXe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:i,rects:o,platform:l,elements:a}=t,{apply:h=()=>{},...p}=sy(e,t),x=await UA(t,p),y=iy(i),w=QC(i),j=ug(i)==="y",{width:S,height:C}=o.floating;let A,E;y==="top"||y==="bottom"?(A=y,E=w===(await(l.isRTL==null?void 0:l.isRTL(a.floating))?"start":"end")?"left":"right"):(E=y,A=w==="end"?"top":"bottom");const T=C-x.top-x.bottom,O=S-x.left-x.right,z=O1(C-x[A],T),F=O1(S-x[E],O),q=!t.middlewareData.shift;let H=z,K=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(K=O),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(H=T),q&&!w){const re=Bh(x.left,0),ue=Bh(x.right,0),he=Bh(x.top,0),be=Bh(x.bottom,0);j?K=S-2*(re!==0||ue!==0?re+ue:Bh(x.left,x.right)):H=C-2*(he!==0||be!==0?he+be:Bh(x.top,x.bottom))}await h({...t,availableWidth:K,availableHeight:H});const Z=await l.getDimensions(a.floating);return S!==Z.width||C!==Z.height?{reset:{rects:!0}}:{}}}};function Ene(){return typeof window<"u"}function JC(e){return BAe(e)?(e.nodeName||"").toLowerCase():"#document"}function Jh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Dg(e){var t;return(t=(BAe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function BAe(e){return Ene()?e instanceof Node||e instanceof Jh(e).Node:!1}function bm(e){return Ene()?e instanceof Element||e instanceof Jh(e).Element:!1}function Ag(e){return Ene()?e instanceof HTMLElement||e instanceof Jh(e).HTMLElement:!1}function owe(e){return!Ene()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jh(e).ShadowRoot}const iXe=new Set(["inline","contents"]);function lI(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=wm(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!iXe.has(i)}const aXe=new Set(["table","td","th"]);function oXe(e){return aXe.has(JC(e))}const lXe=[":popover-open",":modal"];function Ine(e){return lXe.some(t=>{try{return e.matches(t)}catch{return!1}})}const cXe=["transform","translate","scale","rotate","perspective"],dXe=["transform","translate","scale","rotate","perspective","filter"],uXe=["paint","layout","strict","content"];function Yme(e){const t=Xme(),n=bm(e)?wm(e):e;return cXe.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||dXe.some(s=>(n.willChange||"").includes(s))||uXe.some(s=>(n.contain||"").includes(s))}function hXe(e){let t=D1(e);for(;Ag(t)&&!rC(t);){if(Yme(t))return t;if(Ine(t))return null;t=D1(t)}return null}function Xme(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const fXe=new Set(["html","body","#document"]);function rC(e){return fXe.has(JC(e))}function wm(e){return Jh(e).getComputedStyle(e)}function Pne(e){return bm(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function D1(e){if(JC(e)==="html")return e;const t=e.assignedSlot||e.parentNode||owe(e)&&e.host||Dg(e);return owe(t)?t.host:t}function $Ae(e){const t=D1(e);return rC(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ag(t)&&lI(t)?t:$Ae(t)}function qA(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=$Ae(e),o=i===((s=e.ownerDocument)==null?void 0:s.body),l=Jh(i);if(o){const a=mue(l);return t.concat(l,l.visualViewport||[],lI(i)?i:[],a&&n?qA(a):[])}return t.concat(i,qA(i,[],n))}function mue(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function UAe(e){const t=wm(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=Ag(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:s,a=$ee(n)!==o||$ee(s)!==l;return a&&(n=o,s=l),{width:n,height:s,$:a}}function Qme(e){return bm(e)?e:e.contextElement}function vS(e){const t=Qme(e);if(!Ag(t))return kg(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:o}=UAe(t);let l=(o?$ee(n.width):n.width)/s,a=(o?$ee(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const pXe=kg(0);function qAe(e){const t=Jh(e);return!Xme()||!t.visualViewport?pXe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mXe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Jh(e)?!1:t}function Ij(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Qme(e);let l=kg(1);t&&(s?bm(s)&&(l=vS(s)):l=vS(e));const a=mXe(o,n,s)?qAe(o):kg(0);let h=(i.left+a.x)/l.x,p=(i.top+a.y)/l.y,x=i.width/l.x,y=i.height/l.y;if(o){const w=Jh(o),j=s&&bm(s)?Jh(s):s;let S=w,C=mue(S);for(;C&&s&&j!==S;){const A=vS(C),E=C.getBoundingClientRect(),T=wm(C),O=E.left+(C.clientLeft+parseFloat(T.paddingLeft))*A.x,z=E.top+(C.clientTop+parseFloat(T.paddingTop))*A.y;h*=A.x,p*=A.y,x*=A.x,y*=A.y,h+=O,p+=z,S=Jh(C),C=mue(S)}}return qee({width:x,height:y,x:h,y:p})}function Jme(e,t){const n=Pne(e).scrollLeft;return t?t.left+n:Ij(Dg(e)).left+n}function VAe(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=s.left+t.scrollLeft-(n?0:Jme(e,s)),o=s.top+t.scrollTop;return{x:i,y:o}}function gXe(e){let{elements:t,rect:n,offsetParent:s,strategy:i}=e;const o=i==="fixed",l=Dg(s),a=t?Ine(t.floating):!1;if(s===l||a&&o)return n;let h={scrollLeft:0,scrollTop:0},p=kg(1);const x=kg(0),y=Ag(s);if((y||!y&&!o)&&((JC(s)!=="body"||lI(l))&&(h=Pne(s)),Ag(s))){const j=Ij(s);p=vS(s),x.x=j.x+s.clientLeft,x.y=j.y+s.clientTop}const w=l&&!y&&!o?VAe(l,h,!0):kg(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+x.x+w.x,y:n.y*p.y-h.scrollTop*p.y+x.y+w.y}}function xXe(e){return Array.from(e.getClientRects())}function yXe(e){const t=Dg(e),n=Pne(e),s=e.ownerDocument.body,i=Bh(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=Bh(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+Jme(e);const a=-n.scrollTop;return wm(s).direction==="rtl"&&(l+=Bh(t.clientWidth,s.clientWidth)-i),{width:i,height:o,x:l,y:a}}function vXe(e,t){const n=Jh(e),s=Dg(e),i=n.visualViewport;let o=s.clientWidth,l=s.clientHeight,a=0,h=0;if(i){o=i.width,l=i.height;const p=Xme();(!p||p&&t==="fixed")&&(a=i.offsetLeft,h=i.offsetTop)}return{width:o,height:l,x:a,y:h}}const _Xe=new Set(["absolute","fixed"]);function bXe(e,t){const n=Ij(e,!0,t==="fixed"),s=n.top+e.clientTop,i=n.left+e.clientLeft,o=Ag(e)?vS(e):kg(1),l=e.clientWidth*o.x,a=e.clientHeight*o.y,h=i*o.x,p=s*o.y;return{width:l,height:a,x:h,y:p}}function lwe(e,t,n){let s;if(t==="viewport")s=vXe(e,n);else if(t==="document")s=yXe(Dg(e));else if(bm(t))s=bXe(t,n);else{const i=qAe(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return qee(s)}function HAe(e,t){const n=D1(e);return n===t||!bm(n)||rC(n)?!1:wm(n).position==="fixed"||HAe(n,t)}function wXe(e,t){const n=t.get(e);if(n)return n;let s=qA(e,[],!1).filter(a=>bm(a)&&JC(a)!=="body"),i=null;const o=wm(e).position==="fixed";let l=o?D1(e):e;for(;bm(l)&&!rC(l);){const a=wm(l),h=Yme(l);!h&&a.position==="fixed"&&(i=null),(o?!h&&!i:!h&&a.position==="static"&&!!i&&_Xe.has(i.position)||lI(l)&&!h&&HAe(e,l))?s=s.filter(x=>x!==l):i=a,l=D1(l)}return t.set(e,s),s}function jXe(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const l=[...n==="clippingAncestors"?Ine(t)?[]:wXe(t,this._c):[].concat(n),s],a=l[0],h=l.reduce((p,x)=>{const y=lwe(t,x,i);return p.top=Bh(y.top,p.top),p.right=O1(y.right,p.right),p.bottom=O1(y.bottom,p.bottom),p.left=Bh(y.left,p.left),p},lwe(t,a,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function kXe(e){const{width:t,height:n}=UAe(e);return{width:t,height:n}}function NXe(e,t,n){const s=Ag(t),i=Dg(t),o=n==="fixed",l=Ij(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const h=kg(0);function p(){h.x=Jme(i)}if(s||!s&&!o)if((JC(t)!=="body"||lI(i))&&(a=Pne(t)),s){const j=Ij(t,!0,o,t);h.x=j.x+t.clientLeft,h.y=j.y+t.clientTop}else i&&p();o&&!s&&i&&p();const x=i&&!s&&!o?VAe(i,a):kg(0),y=l.left+a.scrollLeft-h.x-x.x,w=l.top+a.scrollTop-h.y-x.y;return{x:y,y:w,width:l.width,height:l.height}}function _le(e){return wm(e).position==="static"}function cwe(e,t){if(!Ag(e)||wm(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Dg(e)===n&&(n=n.ownerDocument.body),n}function WAe(e,t){const n=Jh(e);if(Ine(e))return n;if(!Ag(e)){let i=D1(e);for(;i&&!rC(i);){if(bm(i)&&!_le(i))return i;i=D1(i)}return n}let s=cwe(e,t);for(;s&&oXe(s)&&_le(s);)s=cwe(s,t);return s&&rC(s)&&_le(s)&&!Yme(s)?n:s||hXe(e)||n}const SXe=async function(e){const t=this.getOffsetParent||WAe,n=this.getDimensions,s=await n(e.floating);return{reference:NXe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function CXe(e){return wm(e).direction==="rtl"}const MXe={convertOffsetParentRelativeRectToViewportRelativeRect:gXe,getDocumentElement:Dg,getClippingRect:jXe,getOffsetParent:WAe,getElementRects:SXe,getClientRects:xXe,getDimensions:kXe,getScale:vS,isElement:bm,isRTL:CXe};function GAe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function TXe(e,t){let n=null,s;const i=Dg(e);function o(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function l(a,h){a===void 0&&(a=!1),h===void 0&&(h=1),o();const p=e.getBoundingClientRect(),{left:x,top:y,width:w,height:j}=p;if(a||t(),!w||!j)return;const S=sL(y),C=sL(i.clientWidth-(x+w)),A=sL(i.clientHeight-(y+j)),E=sL(x),O={rootMargin:-S+"px "+-C+"px "+-A+"px "+-E+"px",threshold:Bh(0,O1(1,h))||1};let z=!0;function F(q){const H=q[0].intersectionRatio;if(H!==h){if(!z)return l();H?l(!1,H):s=setTimeout(()=>{l(!1,1e-7)},1e3)}H===1&&!GAe(p,e.getBoundingClientRect())&&l(),z=!1}try{n=new IntersectionObserver(F,{...O,root:i.ownerDocument})}catch{n=new IntersectionObserver(F,O)}n.observe(e)}return l(!0),o}function AXe(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=Qme(e),x=i||o?[...p?qA(p):[],...qA(t)]:[];x.forEach(E=>{i&&E.addEventListener("scroll",n,{passive:!0}),o&&E.addEventListener("resize",n)});const y=p&&a?TXe(p,n):null;let w=-1,j=null;l&&(j=new ResizeObserver(E=>{let[T]=E;T&&T.target===p&&j&&(j.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var O;(O=j)==null||O.observe(t)})),n()}),p&&!h&&j.observe(p),j.observe(t));let S,C=h?Ij(e):null;h&&A();function A(){const E=Ij(e);C&&!GAe(C,E)&&n(),C=E,S=requestAnimationFrame(A)}return n(),()=>{var E;x.forEach(T=>{i&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),y==null||y(),(E=j)==null||E.disconnect(),j=null,h&&cancelAnimationFrame(S)}}const EXe=tXe,IXe=rXe,PXe=QYe,LXe=sXe,OXe=JYe,dwe=XYe,DXe=nXe,RXe=(e,t,n)=>{const s=new Map,i={platform:MXe,...n},o={...i.platform,_c:s};return YYe(e,t,{...i,platform:o})};var FXe=typeof document<"u",zXe=function(){},JJ=FXe?P.useLayoutEffect:zXe;function Vee(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Vee(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=n;s--!==0;){const o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!Vee(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function KAe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uwe(e,t){const n=KAe(e);return Math.round(t*n)/n}function ble(e){const t=P.useRef(e);return JJ(()=>{t.current=e}),t}function BXe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:o,floating:l}={},transform:a=!0,whileElementsMounted:h,open:p}=e,[x,y]=P.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[w,j]=P.useState(s);Vee(w,s)||j(s);const[S,C]=P.useState(null),[A,E]=P.useState(null),T=P.useCallback(de=>{de!==q.current&&(q.current=de,C(de))},[]),O=P.useCallback(de=>{de!==H.current&&(H.current=de,E(de))},[]),z=o||S,F=l||A,q=P.useRef(null),H=P.useRef(null),K=P.useRef(x),Z=h!=null,re=ble(h),ue=ble(i),he=ble(p),be=P.useCallback(()=>{if(!q.current||!H.current)return;const de={placement:t,strategy:n,middleware:w};ue.current&&(de.platform=ue.current),RXe(q.current,H.current,de).then(_e=>{const Ee={..._e,isPositioned:he.current!==!1};ne.current&&!Vee(K.current,Ee)&&(K.current=Ee,hy.flushSync(()=>{y(Ee)}))})},[w,t,n,ue,he]);JJ(()=>{p===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,y(de=>({...de,isPositioned:!1})))},[p]);const ne=P.useRef(!1);JJ(()=>(ne.current=!0,()=>{ne.current=!1}),[]),JJ(()=>{if(z&&(q.current=z),F&&(H.current=F),z&&F){if(re.current)return re.current(z,F,be);be()}},[z,F,be,re,Z]);const ye=P.useMemo(()=>({reference:q,floating:H,setReference:T,setFloating:O}),[T,O]),ie=P.useMemo(()=>({reference:z,floating:F}),[z,F]),fe=P.useMemo(()=>{const de={position:n,left:0,top:0};if(!ie.floating)return de;const _e=uwe(ie.floating,x.x),Ee=uwe(ie.floating,x.y);return a?{...de,transform:"translate("+_e+"px, "+Ee+"px)",...KAe(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_e,top:Ee}},[n,a,ie.floating,x.x,x.y]);return P.useMemo(()=>({...x,update:be,refs:ye,elements:ie,floatingStyles:fe}),[x,be,ye,ie,fe])}const $Xe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:i}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?dwe({element:s.current,padding:i}).fn(n):{}:s?dwe({element:s,padding:i}).fn(n):{}}}},UXe=(e,t)=>({...EXe(e),options:[e,t]}),qXe=(e,t)=>({...IXe(e),options:[e,t]}),VXe=(e,t)=>({...DXe(e),options:[e,t]}),HXe=(e,t)=>({...PXe(e),options:[e,t]}),WXe=(e,t)=>({...LXe(e),options:[e,t]}),GXe=(e,t)=>({...OXe(e),options:[e,t]}),KXe=(e,t)=>({...$Xe(e),options:[e,t]});var ZXe="Arrow",ZAe=P.forwardRef((e,t)=>{const{children:n,width:s=10,height:i=5,...o}=e;return r.jsx(Rn.svg,{...o,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});ZAe.displayName=ZXe;var YXe=ZAe;function cI(e){const[t,n]=P.useState(void 0);return Yl(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,a;if("borderBoxSize"in o){const h=o.borderBoxSize,p=Array.isArray(h)?h[0]:h;l=p.inlineSize,a=p.blockSize}else l=e.offsetWidth,a=e.offsetHeight;n({width:l,height:a})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var ege="Popper",[YAe,Rg]=Ql(ege),[XXe,XAe]=YAe(ege),QAe=e=>{const{__scopePopper:t,children:n}=e,[s,i]=P.useState(null);return r.jsx(XXe,{scope:t,anchor:s,onAnchorChange:i,children:n})};QAe.displayName=ege;var JAe="PopperAnchor",eEe=P.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...i}=e,o=XAe(JAe,n),l=P.useRef(null),a=ei(t,l);return P.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||l.current)}),s?null:r.jsx(Rn.div,{...i,ref:a})});eEe.displayName=JAe;var tge="PopperContent",[QXe,JXe]=YAe(tge),tEe=P.forwardRef((e,t)=>{var Ie,Ke,Re,Ce,Je,Te;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:w=!1,updatePositionStrategy:j="optimized",onPlaced:S,...C}=e,A=XAe(tge,n),[E,T]=P.useState(null),O=ei(t,Ye=>T(Ye)),[z,F]=P.useState(null),q=cI(z),H=(q==null?void 0:q.width)??0,K=(q==null?void 0:q.height)??0,Z=s+(o!=="center"?"-"+o:""),re=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ue=Array.isArray(p)?p:[p],he=ue.length>0,be={padding:re,boundary:ue.filter(tQe),altBoundary:he},{refs:ne,floatingStyles:ye,placement:ie,isPositioned:fe,middlewareData:de}=BXe({strategy:"fixed",placement:Z,whileElementsMounted:(...Ye)=>AXe(...Ye,{animationFrame:j==="always"}),elements:{reference:A.anchor},middleware:[UXe({mainAxis:i+K,alignmentAxis:l}),h&&qXe({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?VXe():void 0,...be}),h&&HXe({...be}),WXe({...be,apply:({elements:Ye,rects:xe,availableWidth:mt,availableHeight:et})=>{const{width:nt,height:Ae}=xe.reference,pt=Ye.floating.style;pt.setProperty("--radix-popper-available-width",`${mt}px`),pt.setProperty("--radix-popper-available-height",`${et}px`),pt.setProperty("--radix-popper-anchor-width",`${nt}px`),pt.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),z&&KXe({element:z,padding:a}),rQe({arrowWidth:H,arrowHeight:K}),w&&GXe({strategy:"referenceHidden",...be})]}),[_e,Ee]=sEe(ie),ke=Gl(S);Yl(()=>{fe&&(ke==null||ke())},[fe,ke]);const pe=(Ie=de.arrow)==null?void 0:Ie.x,ae=(Ke=de.arrow)==null?void 0:Ke.y,ge=((Re=de.arrow)==null?void 0:Re.centerOffset)!==0,[Me,Ue]=P.useState();return Yl(()=>{E&&Ue(window.getComputedStyle(E).zIndex)},[E]),r.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...ye,transform:fe?ye.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(Ce=de.transformOrigin)==null?void 0:Ce.x,(Je=de.transformOrigin)==null?void 0:Je.y].join(" "),...((Te=de.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(QXe,{scope:n,placedSide:_e,onArrowChange:F,arrowX:pe,arrowY:ae,shouldHideArrow:ge,children:r.jsx(Rn.div,{"data-side":_e,"data-align":Ee,...C,ref:O,style:{...C.style,animation:fe?void 0:"none"}})})})});tEe.displayName=tge;var rEe="PopperArrow",eQe={top:"bottom",right:"left",bottom:"top",left:"right"},nEe=P.forwardRef(function(t,n){const{__scopePopper:s,...i}=t,o=JXe(rEe,s),l=eQe[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]: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:r.jsx(YXe,{...i,ref:n,style:{...i.style,display:"block"}})})});nEe.displayName=rEe;function tQe(e){return e!==null}var rQe=e=>({name:"transformOrigin",options:e,fn(t){var A,E,T;const{placement:n,rects:s,middlewareData:i}=t,l=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[p,x]=sEe(n),y={start:"0%",center:"50%",end:"100%"}[x],w=(((E=i.arrow)==null?void 0:E.x)??0)+a/2,j=(((T=i.arrow)==null?void 0:T.y)??0)+h/2;let S="",C="";return p==="bottom"?(S=l?y:`${w}px`,C=`${-h}px`):p==="top"?(S=l?y:`${w}px`,C=`${s.floating.height+h}px`):p==="right"?(S=`${-h}px`,C=l?y:`${j}px`):p==="left"&&(S=`${s.floating.width+h}px`,C=l?y:`${j}px`),{data:{x:S,y:C}}}});function sEe(e){const[t,n="center"]=e.split("-");return[t,n]}var dI=QAe,e3=eEe,uI=tEe,hI=nEe,[Lne]=Ql("Tooltip",[Rg]),One=Rg(),iEe="TooltipProvider",nQe=700,gue="tooltip.open",[sQe,rge]=Lne(iEe),aEe=e=>{const{__scopeTooltip:t,delayDuration:n=nQe,skipDelayDuration:s=300,disableHoverableContent:i=!1,children:o}=e,l=P.useRef(!0),a=P.useRef(!1),h=P.useRef(0);return P.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),r.jsx(sQe,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:P.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:P.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:a,onPointerInTransitChange:P.useCallback(p=>{a.current=p},[]),disableHoverableContent:i,children:o})};aEe.displayName=iEe;var VA="Tooltip",[iQe,Dne]=Lne(VA),oEe=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:i,onOpenChange:o,disableHoverableContent:l,delayDuration:a}=e,h=rge(VA,e.__scopeTooltip),p=One(t),[x,y]=P.useState(null),w=Vc(),j=P.useRef(0),S=l??h.disableHoverableContent,C=a??h.delayDuration,A=P.useRef(!1),[E,T]=Lu({prop:s,defaultProp:i??!1,onChange:H=>{H?(h.onOpen(),document.dispatchEvent(new CustomEvent(gue))):h.onClose(),o==null||o(H)},caller:VA}),O=P.useMemo(()=>E?A.current?"delayed-open":"instant-open":"closed",[E]),z=P.useCallback(()=>{window.clearTimeout(j.current),j.current=0,A.current=!1,T(!0)},[T]),F=P.useCallback(()=>{window.clearTimeout(j.current),j.current=0,T(!1)},[T]),q=P.useCallback(()=>{window.clearTimeout(j.current),j.current=window.setTimeout(()=>{A.current=!0,T(!0),j.current=0},C)},[C,T]);return P.useEffect(()=>()=>{j.current&&(window.clearTimeout(j.current),j.current=0)},[]),r.jsx(dI,{...p,children:r.jsx(iQe,{scope:t,contentId:w,open:E,stateAttribute:O,trigger:x,onTriggerChange:y,onTriggerEnter:P.useCallback(()=>{h.isOpenDelayedRef.current?q():z()},[h.isOpenDelayedRef,q,z]),onTriggerLeave:P.useCallback(()=>{S?F():(window.clearTimeout(j.current),j.current=0)},[F,S]),onOpen:z,onClose:F,disableHoverableContent:S,children:n})})};oEe.displayName=VA;var xue="TooltipTrigger",lEe=P.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=Dne(xue,n),o=rge(xue,n),l=One(n),a=P.useRef(null),h=ei(t,a,i.onTriggerChange),p=P.useRef(!1),x=P.useRef(!1),y=P.useCallback(()=>p.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),r.jsx(e3,{asChild:!0,...l,children:r.jsx(Rn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:h,onPointerMove:cn(e.onPointerMove,w=>{w.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),x.current=!0)}),onPointerLeave:cn(e.onPointerLeave,()=>{i.onTriggerLeave(),x.current=!1}),onPointerDown:cn(e.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:cn(e.onFocus,()=>{p.current||i.onOpen()}),onBlur:cn(e.onBlur,i.onClose),onClick:cn(e.onClick,i.onClose)})})});lEe.displayName=xue;var aQe="TooltipPortal",[BZt,oQe]=Lne(aQe,{forceMount:void 0}),nC="TooltipContent",cEe=P.forwardRef((e,t)=>{const n=oQe(nC,e.__scopeTooltip),{forceMount:s=n.forceMount,side:i="top",...o}=e,l=Dne(nC,e.__scopeTooltip);return r.jsx(fc,{present:s||l.open,children:l.disableHoverableContent?r.jsx(dEe,{side:i,...o,ref:t}):r.jsx(lQe,{side:i,...o,ref:t})})}),lQe=P.forwardRef((e,t)=>{const n=Dne(nC,e.__scopeTooltip),s=rge(nC,e.__scopeTooltip),i=P.useRef(null),o=ei(t,i),[l,a]=P.useState(null),{trigger:h,onClose:p}=n,x=i.current,{onPointerInTransitChange:y}=s,w=P.useCallback(()=>{a(null),y(!1)},[y]),j=P.useCallback((S,C)=>{const A=S.currentTarget,E={x:S.clientX,y:S.clientY},T=fQe(E,A.getBoundingClientRect()),O=pQe(E,T),z=mQe(C.getBoundingClientRect()),F=xQe([...O,...z]);a(F),y(!0)},[y]);return P.useEffect(()=>()=>w(),[w]),P.useEffect(()=>{if(h&&x){const S=A=>j(A,x),C=A=>j(A,h);return h.addEventListener("pointerleave",S),x.addEventListener("pointerleave",C),()=>{h.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",C)}}},[h,x,j,w]),P.useEffect(()=>{if(l){const S=C=>{const A=C.target,E={x:C.clientX,y:C.clientY},T=(h==null?void 0:h.contains(A))||(x==null?void 0:x.contains(A)),O=!gQe(E,l);T?w():O&&(w(),p())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[h,x,l,p,w]),r.jsx(dEe,{...e,ref:o})}),[cQe,dQe]=Lne(VA,{isInside:!1}),uQe=eAe("TooltipContent"),dEe=P.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:l,...a}=e,h=Dne(nC,n),p=One(n),{onClose:x}=h;return P.useEffect(()=>(document.addEventListener(gue,x),()=>document.removeEventListener(gue,x)),[x]),P.useEffect(()=>{if(h.trigger){const y=w=>{const j=w.target;j!=null&&j.contains(h.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[h.trigger,x]),r.jsx(X1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(uI,{"data-state":h.stateAttribute,...p,...a,ref:t,style:{...a.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:[r.jsx(uQe,{children:s}),r.jsx(cQe,{scope:n,isInside:!0,children:r.jsx(tZe,{id:h.contentId,role:"tooltip",children:i||s})})]})})});cEe.displayName=nC;var uEe="TooltipArrow",hQe=P.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=One(n);return dQe(uEe,n).isInside?null:r.jsx(hI,{...i,...s,ref:t})});hQe.displayName=uEe;function fQe(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,i,o)){case o:return"left";case i:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function pQe(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function mQe(e){const{top:t,right:n,bottom:s,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:s},{x:i,y:s}]}function gQe(e,t){const{x:n,y:s}=e;let i=!1;for(let o=0,l=t.length-1;os!=w>s&&n<(y-p)*(s-x)/(w-x)+p&&(i=!i)}return i}function xQe(e){const t=e.slice();return t.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),yQe(t)}function yQe(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const i=e[s];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vQe=aEe,_Qe=oEe,bQe=lEe,hEe=cEe;const fI=vQe,Ng=_Qe,Sg=bQe,ym=P.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(hEe,{ref:s,sideOffset:t,className:$t("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]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));ym.displayName=hEe.displayName;var t3=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Pj=typeof window>"u"||"Deno"in globalThis;function vu(){}function wQe(e,t){return typeof e=="function"?e(t):e}function yue(e){return typeof e=="number"&&e>=0&&e!==1/0}function fEe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function b1(e,t){return typeof e=="function"?e(t):e}function Ef(e,t){return typeof e=="function"?e(t):e}function hwe(e,t){const{type:n="all",exact:s,fetchStatus:i,predicate:o,queryKey:l,stale:a}=e;if(l){if(s){if(t.queryHash!==nge(l,t.options))return!1}else if(!HA(t.queryKey,l))return!1}if(n!=="all"){const h=t.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function fwe(e,t){const{exact:n,status:s,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Lj(t.options.mutationKey)!==Lj(o))return!1}else if(!HA(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||i&&!i(t))}function nge(e,t){return((t==null?void 0:t.queryKeyHashFn)||Lj)(e)}function Lj(e){return JSON.stringify(e,(t,n)=>vue(n)?Object.keys(n).sort().reduce((s,i)=>(s[i]=n[i],s),{}):n)}function HA(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>HA(e[n],t[n])):!1}function pEe(e,t){if(e===t)return e;const n=pwe(e)&&pwe(t);if(n||vue(e)&&vue(t)){const s=n?e:Object.keys(e),i=s.length,o=n?t:Object.keys(t),l=o.length,a=n?[]:{},h=new Set(s);let p=0;for(let x=0;x{setTimeout(t,e)})}function _ue(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?pEe(e,t):t}function kQe(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function NQe(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var sge=Symbol();function mEe(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===sge?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gEe(e,t){return typeof e=="function"?e(...t):!!e}var Kw,T0,RS,T5e,SQe=(T5e=class extends t3{constructor(){super();li(this,Kw);li(this,T0);li(this,RS);us(this,RS,t=>{if(!Pj&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Qt(this,T0)||this.setEventListener(Qt(this,RS))}onUnsubscribe(){var t;this.hasListeners()||((t=Qt(this,T0))==null||t.call(this),us(this,T0,void 0))}setEventListener(t){var n;us(this,RS,t),(n=Qt(this,T0))==null||n.call(this),us(this,T0,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){Qt(this,Kw)!==t&&(us(this,Kw,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof Qt(this,Kw)=="boolean"?Qt(this,Kw):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Kw=new WeakMap,T0=new WeakMap,RS=new WeakMap,T5e),ige=new SQe,FS,A0,zS,A5e,CQe=(A5e=class extends t3{constructor(){super();li(this,FS,!0);li(this,A0);li(this,zS);us(this,zS,t=>{if(!Pj&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){Qt(this,A0)||this.setEventListener(Qt(this,zS))}onUnsubscribe(){var t;this.hasListeners()||((t=Qt(this,A0))==null||t.call(this),us(this,A0,void 0))}setEventListener(t){var n;us(this,zS,t),(n=Qt(this,A0))==null||n.call(this),us(this,A0,t(this.setOnline.bind(this)))}setOnline(t){Qt(this,FS)!==t&&(us(this,FS,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return Qt(this,FS)}},FS=new WeakMap,A0=new WeakMap,zS=new WeakMap,A5e),Wee=new CQe;function bue(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function s(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{s({status:"fulfilled",value:i}),e(i)},n.reject=i=>{s({status:"rejected",reason:i}),t(i)},n}function MQe(e){return Math.min(1e3*2**e,3e4)}function xEe(e){return(e??"online")==="online"?Wee.isOnline():!0}var yEe=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wle(e){return e instanceof yEe}function vEe(e){let t=!1,n=0,s=!1,i;const o=bue(),l=C=>{var A;s||(w(new yEe(C)),(A=e.abort)==null||A.call(e))},a=()=>{t=!0},h=()=>{t=!1},p=()=>ige.isFocused()&&(e.networkMode==="always"||Wee.isOnline())&&e.canRun(),x=()=>xEe(e.networkMode)&&e.canRun(),y=C=>{var A;s||(s=!0,(A=e.onSuccess)==null||A.call(e,C),i==null||i(),o.resolve(C))},w=C=>{var A;s||(s=!0,(A=e.onError)==null||A.call(e,C),i==null||i(),o.reject(C))},j=()=>new Promise(C=>{var A;i=E=>{(s||p())&&C(E)},(A=e.onPause)==null||A.call(e)}).then(()=>{var C;i=void 0,s||(C=e.onContinue)==null||C.call(e)}),S=()=>{if(s)return;let C;const A=n===0?e.initialPromise:void 0;try{C=A??e.fn()}catch(E){C=Promise.reject(E)}Promise.resolve(C).then(y).catch(E=>{var q;if(s)return;const T=e.retry??(Pj?0:3),O=e.retryDelay??MQe,z=typeof O=="function"?O(n,E):O,F=T===!0||typeof T=="number"&&np()?void 0:j()).then(()=>{t?w(E):S()})})};return{promise:o,cancel:l,continue:()=>(i==null||i(),o),cancelRetry:a,continueRetry:h,canStart:x,start:()=>(x()?S():j().then(S),o)}}var TQe=e=>setTimeout(e,0);function AQe(){let e=[],t=0,n=a=>{a()},s=a=>{a()},i=TQe;const o=a=>{t?e.push(a):i(()=>{n(a)})},l=()=>{const a=e;e=[],a.length&&i(()=>{s(()=>{a.forEach(h=>{n(h)})})})};return{batch:a=>{let h;t++;try{h=a()}finally{t--,t||l()}return h},batchCalls:a=>(...h)=>{o(()=>{a(...h)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{i=a}}}var Bc=AQe(),Zw,E5e,_Ee=(E5e=class{constructor(){li(this,Zw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),yue(this.gcTime)&&us(this,Zw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Pj?1/0:5*60*1e3))}clearGcTimeout(){Qt(this,Zw)&&(clearTimeout(Qt(this,Zw)),us(this,Zw,void 0))}},Zw=new WeakMap,E5e),BS,Yw,Af,Xw,Wd,XE,Qw,Kp,yx,I5e,EQe=(I5e=class extends _Ee{constructor(t){super();li(this,Kp);li(this,BS);li(this,Yw);li(this,Af);li(this,Xw);li(this,Wd);li(this,XE);li(this,Qw);us(this,Qw,!1),us(this,XE,t.defaultOptions),this.setOptions(t.options),this.observers=[],us(this,Xw,t.client),us(this,Af,Qt(this,Xw).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,us(this,BS,IQe(this.options)),this.state=t.state??Qt(this,BS),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Qt(this,Wd))==null?void 0:t.promise}setOptions(t){this.options={...Qt(this,XE),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Qt(this,Af).remove(this)}setData(t,n){const s=_ue(this.state.data,t,this.options);return ia(this,Kp,yx).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){ia(this,Kp,yx).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,i;const n=(s=Qt(this,Wd))==null?void 0:s.promise;return(i=Qt(this,Wd))==null||i.cancel(t),n?n.then(vu).catch(vu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Qt(this,BS))}isActive(){return this.observers.some(t=>Ef(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sge||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>b1(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!fEe(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=Qt(this,Wd))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=Qt(this,Wd))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Qt(this,Af).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(Qt(this,Wd)&&(Qt(this,Qw)?Qt(this,Wd).cancel({revert:!0}):Qt(this,Wd).cancelRetry()),this.scheduleGc()),Qt(this,Af).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ia(this,Kp,yx).call(this,{type:"invalidate"})}fetch(t,n){var p,x,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Qt(this,Wd))return Qt(this,Wd).continueRetry(),Qt(this,Wd).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(j=>j.options.queryFn);w&&this.setOptions(w.options)}const s=new AbortController,i=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(us(this,Qw,!0),s.signal)})},o=()=>{const w=mEe(this.options,n),S=(()=>{const C={client:Qt(this,Xw),queryKey:this.queryKey,meta:this.meta};return i(C),C})();return us(this,Qw,!1),this.options.persister?this.options.persister(w,S,this):w(S)},a=(()=>{const w={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Qt(this,Xw),state:this.state,fetchFn:o};return i(w),w})();(p=this.options.behavior)==null||p.onFetch(a,this),us(this,Yw,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=a.fetchOptions)==null?void 0:x.meta))&&ia(this,Kp,yx).call(this,{type:"fetch",meta:(y=a.fetchOptions)==null?void 0:y.meta});const h=w=>{var j,S,C,A;wle(w)&&w.silent||ia(this,Kp,yx).call(this,{type:"error",error:w}),wle(w)||((S=(j=Qt(this,Af).config).onError)==null||S.call(j,w,this),(A=(C=Qt(this,Af).config).onSettled)==null||A.call(C,this.state.data,w,this)),this.scheduleGc()};return us(this,Wd,vEe({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:s.abort.bind(s),onSuccess:w=>{var j,S,C,A;if(w===void 0){h(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(w)}catch(E){h(E);return}(S=(j=Qt(this,Af).config).onSuccess)==null||S.call(j,w,this),(A=(C=Qt(this,Af).config).onSettled)==null||A.call(C,w,this.state.error,this),this.scheduleGc()},onError:h,onFail:(w,j)=>{ia(this,Kp,yx).call(this,{type:"failed",failureCount:w,error:j})},onPause:()=>{ia(this,Kp,yx).call(this,{type:"pause"})},onContinue:()=>{ia(this,Kp,yx).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),Qt(this,Wd).start()}},BS=new WeakMap,Yw=new WeakMap,Af=new WeakMap,Xw=new WeakMap,Wd=new WeakMap,XE=new WeakMap,Qw=new WeakMap,Kp=new WeakSet,yx=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...bEe(s.data,this.options),fetchMeta:t.meta??null};case"success":return us(this,Yw,void 0),{...s,data:t.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return wle(i)&&i.revert&&Qt(this,Yw)?{...Qt(this,Yw),fetchStatus:"idle"}:{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),Bc.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),Qt(this,Af).notify({query:this,type:"updated",action:t})})},I5e);function bEe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xEe(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function IQe(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var sg,P5e,PQe=(P5e=class extends t3{constructor(t={}){super();li(this,sg);this.config=t,us(this,sg,new Map)}build(t,n,s){const i=n.queryKey,o=n.queryHash??nge(i,n);let l=this.get(o);return l||(l=new EQe({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(l)),l}add(t){Qt(this,sg).has(t.queryHash)||(Qt(this,sg).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=Qt(this,sg).get(t.queryHash);n&&(t.destroy(),n===t&&Qt(this,sg).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Bc.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Qt(this,sg).get(t)}getAll(){return[...Qt(this,sg).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>hwe(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>hwe(t,s)):n}notify(t){Bc.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Bc.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Bc.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},sg=new WeakMap,P5e),ig,gu,Jw,ag,a0,L5e,LQe=(L5e=class extends _Ee{constructor(t){super();li(this,ag);li(this,ig);li(this,gu);li(this,Jw);this.mutationId=t.mutationId,us(this,gu,t.mutationCache),us(this,ig,[]),this.state=t.state||wEe(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Qt(this,ig).includes(t)||(Qt(this,ig).push(t),this.clearGcTimeout(),Qt(this,gu).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){us(this,ig,Qt(this,ig).filter(n=>n!==t)),this.scheduleGc(),Qt(this,gu).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Qt(this,ig).length||(this.state.status==="pending"?this.scheduleGc():Qt(this,gu).remove(this))}continue(){var t;return((t=Qt(this,Jw))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,a,h,p,x,y,w,j,S,C,A,E,T,O,z,F,q,H,K;const n=()=>{ia(this,ag,a0).call(this,{type:"continue"})};us(this,Jw,vEe({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(Z,re)=>{ia(this,ag,a0).call(this,{type:"failed",failureCount:Z,error:re})},onPause:()=>{ia(this,ag,a0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Qt(this,gu).canRun(this)}));const s=this.state.status==="pending",i=!Qt(this,Jw).canStart();try{if(s)n();else{ia(this,ag,a0).call(this,{type:"pending",variables:t,isPaused:i}),await((l=(o=Qt(this,gu).config).onMutate)==null?void 0:l.call(o,t,this));const re=await((h=(a=this.options).onMutate)==null?void 0:h.call(a,t));re!==this.state.context&&ia(this,ag,a0).call(this,{type:"pending",context:re,variables:t,isPaused:i})}const Z=await Qt(this,Jw).start();return await((x=(p=Qt(this,gu).config).onSuccess)==null?void 0:x.call(p,Z,t,this.state.context,this)),await((w=(y=this.options).onSuccess)==null?void 0:w.call(y,Z,t,this.state.context)),await((S=(j=Qt(this,gu).config).onSettled)==null?void 0:S.call(j,Z,null,this.state.variables,this.state.context,this)),await((A=(C=this.options).onSettled)==null?void 0:A.call(C,Z,null,t,this.state.context)),ia(this,ag,a0).call(this,{type:"success",data:Z}),Z}catch(Z){try{throw await((T=(E=Qt(this,gu).config).onError)==null?void 0:T.call(E,Z,t,this.state.context,this)),await((z=(O=this.options).onError)==null?void 0:z.call(O,Z,t,this.state.context)),await((q=(F=Qt(this,gu).config).onSettled)==null?void 0:q.call(F,void 0,Z,this.state.variables,this.state.context,this)),await((K=(H=this.options).onSettled)==null?void 0:K.call(H,void 0,Z,t,this.state.context)),Z}finally{ia(this,ag,a0).call(this,{type:"error",error:Z})}}finally{Qt(this,gu).runNext(this)}}},ig=new WeakMap,gu=new WeakMap,Jw=new WeakMap,ag=new WeakSet,a0=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Bc.batch(()=>{Qt(this,ig).forEach(s=>{s.onMutationUpdate(t)}),Qt(this,gu).notify({mutation:this,type:"updated",action:t})})},L5e);function wEe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Cx,Zp,QE,O5e,OQe=(O5e=class extends t3{constructor(t={}){super();li(this,Cx);li(this,Zp);li(this,QE);this.config=t,us(this,Cx,new Set),us(this,Zp,new Map),us(this,QE,0)}build(t,n,s){const i=new LQe({mutationCache:this,mutationId:++R6(this,QE)._,options:t.defaultMutationOptions(n),state:s});return this.add(i),i}add(t){Qt(this,Cx).add(t);const n=iL(t);if(typeof n=="string"){const s=Qt(this,Zp).get(n);s?s.push(t):Qt(this,Zp).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Qt(this,Cx).delete(t)){const n=iL(t);if(typeof n=="string"){const s=Qt(this,Zp).get(n);if(s)if(s.length>1){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}else s[0]===t&&Qt(this,Zp).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=iL(t);if(typeof n=="string"){const s=Qt(this,Zp).get(n),i=s==null?void 0:s.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var s;const n=iL(t);if(typeof n=="string"){const i=(s=Qt(this,Zp).get(n))==null?void 0:s.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bc.batch(()=>{Qt(this,Cx).forEach(t=>{this.notify({type:"removed",mutation:t})}),Qt(this,Cx).clear(),Qt(this,Zp).clear()})}getAll(){return Array.from(Qt(this,Cx))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>fwe(n,s))}findAll(t={}){return this.getAll().filter(n=>fwe(t,n))}notify(t){Bc.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Bc.batch(()=>Promise.all(t.map(n=>n.continue().catch(vu))))}},Cx=new WeakMap,Zp=new WeakMap,QE=new WeakMap,O5e);function iL(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Gee(e){return{onFetch:(t,n)=>{var x,y,w,j,S;const s=t.options,i=(w=(y=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:w.direction,o=((j=t.state.data)==null?void 0:j.pages)||[],l=((S=t.state.data)==null?void 0:S.pageParams)||[];let a={pages:[],pageParams:[]},h=0;const p=async()=>{let C=!1;const A=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(t.signal.aborted?C=!0:t.signal.addEventListener("abort",()=>{C=!0}),t.signal)})},E=mEe(t.options,t.fetchOptions),T=async(O,z,F)=>{if(C)return Promise.reject();if(z==null&&O.pages.length)return Promise.resolve(O);const H=(()=>{const ue={client:t.client,queryKey:t.queryKey,pageParam:z,direction:F?"backward":"forward",meta:t.options.meta};return A(ue),ue})(),K=await E(H),{maxPages:Z}=t.options,re=F?NQe:kQe;return{pages:re(O.pages,K,Z),pageParams:re(O.pageParams,z,Z)}};if(i&&o.length){const O=i==="backward",z=O?jEe:wue,F={pages:o,pageParams:l},q=z(s,F);a=await T(F,q,O)}else{const O=e??o.length;do{const z=h===0?l[0]??s.initialPageParam:wue(s,a);if(h>0&&z==null)break;a=await T(a,z),h++}while(h{var C,A;return(A=(C=t.options).persister)==null?void 0:A.call(C,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=p}}}function wue(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function jEe(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}function DQe(e,t){return t?wue(e,t)!=null:!1}function RQe(e,t){return!t||!e.getPreviousPageParam?!1:jEe(e,t)!=null}var $l,E0,I0,$S,US,P0,qS,VS,D5e,FQe=(D5e=class{constructor(e={}){li(this,$l);li(this,E0);li(this,I0);li(this,$S);li(this,US);li(this,P0);li(this,qS);li(this,VS);us(this,$l,e.queryCache||new PQe),us(this,E0,e.mutationCache||new OQe),us(this,I0,e.defaultOptions||{}),us(this,$S,new Map),us(this,US,new Map),us(this,P0,0)}mount(){R6(this,P0)._++,Qt(this,P0)===1&&(us(this,qS,ige.subscribe(async e=>{e&&(await this.resumePausedMutations(),Qt(this,$l).onFocus())})),us(this,VS,Wee.subscribe(async e=>{e&&(await this.resumePausedMutations(),Qt(this,$l).onOnline())})))}unmount(){var e,t;R6(this,P0)._--,Qt(this,P0)===0&&((e=Qt(this,qS))==null||e.call(this),us(this,qS,void 0),(t=Qt(this,VS))==null||t.call(this),us(this,VS,void 0))}isFetching(e){return Qt(this,$l).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Qt(this,E0).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Qt(this,$l).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=Qt(this,$l).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(b1(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return Qt(this,$l).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),i=Qt(this,$l).get(s.queryHash),o=i==null?void 0:i.state.data,l=wQe(t,o);if(l!==void 0)return Qt(this,$l).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return Bc.batch(()=>Qt(this,$l).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Qt(this,$l).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=Qt(this,$l);Bc.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=Qt(this,$l);return Bc.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=Bc.batch(()=>Qt(this,$l).findAll(e).map(i=>i.cancel(n)));return Promise.all(s).then(vu).catch(vu)}invalidateQueries(e,t={}){return Bc.batch(()=>(Qt(this,$l).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=Bc.batch(()=>Qt(this,$l).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(vu)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(vu)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=Qt(this,$l).build(this,t);return n.isStaleByTime(b1(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(vu).catch(vu)}fetchInfiniteQuery(e){return e.behavior=Gee(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(vu).catch(vu)}ensureInfiniteQueryData(e){return e.behavior=Gee(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Wee.isOnline()?Qt(this,E0).resumePausedMutations():Promise.resolve()}getQueryCache(){return Qt(this,$l)}getMutationCache(){return Qt(this,E0)}getDefaultOptions(){return Qt(this,I0)}setDefaultOptions(e){us(this,I0,e)}setQueryDefaults(e,t){Qt(this,$S).set(Lj(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Qt(this,$S).values()],n={};return t.forEach(s=>{HA(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){Qt(this,US).set(Lj(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Qt(this,US).values()],n={};return t.forEach(s=>{HA(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Qt(this,I0).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=nge(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===sge&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Qt(this,I0).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Qt(this,$l).clear(),Qt(this,E0).clear()}},$l=new WeakMap,E0=new WeakMap,I0=new WeakMap,$S=new WeakMap,US=new WeakMap,P0=new WeakMap,qS=new WeakMap,VS=new WeakMap,D5e),rh,Fa,JE,xu,ej,HS,L0,O0,eI,WS,GS,tj,rj,D0,KS,mo,aT,jue,kue,Nue,Sue,Cue,Mue,Tue,NEe,R5e,kEe=(R5e=class extends t3{constructor(t,n){super();li(this,mo);li(this,rh);li(this,Fa);li(this,JE);li(this,xu);li(this,ej);li(this,HS);li(this,L0);li(this,O0);li(this,eI);li(this,WS);li(this,GS);li(this,tj);li(this,rj);li(this,D0);li(this,KS,new Set);this.options=n,us(this,rh,t),us(this,O0,null),us(this,L0,bue()),this.options.experimental_prefetchInRender||Qt(this,L0).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Qt(this,Fa).addObserver(this),gwe(Qt(this,Fa),this.options)?ia(this,mo,aT).call(this):this.updateResult(),ia(this,mo,Sue).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Aue(Qt(this,Fa),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Aue(Qt(this,Fa),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ia(this,mo,Cue).call(this),ia(this,mo,Mue).call(this),Qt(this,Fa).removeObserver(this)}setOptions(t){const n=this.options,s=Qt(this,Fa);if(this.options=Qt(this,rh).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ef(this.options.enabled,Qt(this,Fa))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ia(this,mo,Tue).call(this),Qt(this,Fa).setOptions(this.options),n._defaulted&&!Hee(this.options,n)&&Qt(this,rh).getQueryCache().notify({type:"observerOptionsUpdated",query:Qt(this,Fa),observer:this});const i=this.hasListeners();i&&xwe(Qt(this,Fa),s,this.options,n)&&ia(this,mo,aT).call(this),this.updateResult(),i&&(Qt(this,Fa)!==s||Ef(this.options.enabled,Qt(this,Fa))!==Ef(n.enabled,Qt(this,Fa))||b1(this.options.staleTime,Qt(this,Fa))!==b1(n.staleTime,Qt(this,Fa)))&&ia(this,mo,jue).call(this);const o=ia(this,mo,kue).call(this);i&&(Qt(this,Fa)!==s||Ef(this.options.enabled,Qt(this,Fa))!==Ef(n.enabled,Qt(this,Fa))||o!==Qt(this,D0))&&ia(this,mo,Nue).call(this,o)}getOptimisticResult(t){const n=Qt(this,rh).getQueryCache().build(Qt(this,rh),t),s=this.createResult(n,t);return BQe(this,s)&&(us(this,xu,s),us(this,HS,this.options),us(this,ej,Qt(this,Fa).state)),s}getCurrentResult(){return Qt(this,xu)}trackResult(t,n){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),n==null||n(i),Reflect.get(s,i))})}trackProp(t){Qt(this,KS).add(t)}getCurrentQuery(){return Qt(this,Fa)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=Qt(this,rh).defaultQueryOptions(t),s=Qt(this,rh).getQueryCache().build(Qt(this,rh),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return ia(this,mo,aT).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Qt(this,xu)))}createResult(t,n){var Z;const s=Qt(this,Fa),i=this.options,o=Qt(this,xu),l=Qt(this,ej),a=Qt(this,HS),p=t!==s?t.state:Qt(this,JE),{state:x}=t;let y={...x},w=!1,j;if(n._optimisticResults){const re=this.hasListeners(),ue=!re&&gwe(t,n),he=re&&xwe(t,s,n,i);(ue||he)&&(y={...y,...bEe(x.data,t.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:S,errorUpdatedAt:C,status:A}=y;j=y.data;let E=!1;if(n.placeholderData!==void 0&&j===void 0&&A==="pending"){let re;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(re=o.data,E=!0):re=typeof n.placeholderData=="function"?n.placeholderData((Z=Qt(this,GS))==null?void 0:Z.state.data,Qt(this,GS)):n.placeholderData,re!==void 0&&(A="success",j=_ue(o==null?void 0:o.data,re,n),w=!0)}if(n.select&&j!==void 0&&!E)if(o&&j===(l==null?void 0:l.data)&&n.select===Qt(this,eI))j=Qt(this,WS);else try{us(this,eI,n.select),j=n.select(j),j=_ue(o==null?void 0:o.data,j,n),us(this,WS,j),us(this,O0,null)}catch(re){us(this,O0,re)}Qt(this,O0)&&(S=Qt(this,O0),j=Qt(this,WS),C=Date.now(),A="error");const T=y.fetchStatus==="fetching",O=A==="pending",z=A==="error",F=O&&T,q=j!==void 0,K={status:A,fetchStatus:y.fetchStatus,isPending:O,isSuccess:A==="success",isError:z,isInitialLoading:F,isLoading:F,data:j,dataUpdatedAt:y.dataUpdatedAt,error:S,errorUpdatedAt:C,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:T,isRefetching:T&&!O,isLoadingError:z&&!q,isPaused:y.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:z&&q,isStale:age(t,n),refetch:this.refetch,promise:Qt(this,L0),isEnabled:Ef(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const re=be=>{K.status==="error"?be.reject(K.error):K.data!==void 0&&be.resolve(K.data)},ue=()=>{const be=us(this,L0,K.promise=bue());re(be)},he=Qt(this,L0);switch(he.status){case"pending":t.queryHash===s.queryHash&&re(he);break;case"fulfilled":(K.status==="error"||K.data!==he.value)&&ue();break;case"rejected":(K.status!=="error"||K.error!==he.reason)&&ue();break}}return K}updateResult(){const t=Qt(this,xu),n=this.createResult(Qt(this,Fa),this.options);if(us(this,ej,Qt(this,Fa).state),us(this,HS,this.options),Qt(this,ej).data!==void 0&&us(this,GS,Qt(this,Fa)),Hee(n,t))return;us(this,xu,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!Qt(this,KS).size)return!0;const l=new Set(o??Qt(this,KS));return this.options.throwOnError&&l.add("error"),Object.keys(Qt(this,xu)).some(a=>{const h=a;return Qt(this,xu)[h]!==t[h]&&l.has(h)})};ia(this,mo,NEe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ia(this,mo,Sue).call(this)}},rh=new WeakMap,Fa=new WeakMap,JE=new WeakMap,xu=new WeakMap,ej=new WeakMap,HS=new WeakMap,L0=new WeakMap,O0=new WeakMap,eI=new WeakMap,WS=new WeakMap,GS=new WeakMap,tj=new WeakMap,rj=new WeakMap,D0=new WeakMap,KS=new WeakMap,mo=new WeakSet,aT=function(t){ia(this,mo,Tue).call(this);let n=Qt(this,Fa).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(vu)),n},jue=function(){ia(this,mo,Cue).call(this);const t=b1(this.options.staleTime,Qt(this,Fa));if(Pj||Qt(this,xu).isStale||!yue(t))return;const s=fEe(Qt(this,xu).dataUpdatedAt,t)+1;us(this,tj,setTimeout(()=>{Qt(this,xu).isStale||this.updateResult()},s))},kue=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Qt(this,Fa)):this.options.refetchInterval)??!1},Nue=function(t){ia(this,mo,Mue).call(this),us(this,D0,t),!(Pj||Ef(this.options.enabled,Qt(this,Fa))===!1||!yue(Qt(this,D0))||Qt(this,D0)===0)&&us(this,rj,setInterval(()=>{(this.options.refetchIntervalInBackground||ige.isFocused())&&ia(this,mo,aT).call(this)},Qt(this,D0)))},Sue=function(){ia(this,mo,jue).call(this),ia(this,mo,Nue).call(this,ia(this,mo,kue).call(this))},Cue=function(){Qt(this,tj)&&(clearTimeout(Qt(this,tj)),us(this,tj,void 0))},Mue=function(){Qt(this,rj)&&(clearInterval(Qt(this,rj)),us(this,rj,void 0))},Tue=function(){const t=Qt(this,rh).getQueryCache().build(Qt(this,rh),this.options);if(t===Qt(this,Fa))return;const n=Qt(this,Fa);us(this,Fa,t),us(this,JE,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},NEe=function(t){Bc.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(Qt(this,xu))}),Qt(this,rh).getQueryCache().notify({query:Qt(this,Fa),type:"observerResultsUpdated"})})},R5e);function zQe(e,t){return Ef(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function gwe(e,t){return zQe(e,t)||e.state.data!==void 0&&Aue(e,t,t.refetchOnMount)}function Aue(e,t,n){if(Ef(t.enabled,e)!==!1&&b1(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&age(e,t)}return!1}function xwe(e,t,n,s){return(e!==t||Ef(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&age(e,n)}function age(e,t){return Ef(t.enabled,e)!==!1&&e.isStaleByTime(b1(t.staleTime,e))}function BQe(e,t){return!Hee(e.getCurrentResult(),t)}var $Qe=class extends kEe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Gee()})}getOptimisticResult(e){return e.behavior=Gee(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var S,C;const{state:n}=e,s=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:l,isRefetchError:a}=s,h=(C=(S=n.fetchMeta)==null?void 0:S.fetchMore)==null?void 0:C.direction,p=l&&h==="forward",x=i&&h==="forward",y=l&&h==="backward",w=i&&h==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:DQe(t,n.data),hasPreviousPage:RQe(t,n.data),isFetchNextPageError:p,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:w,isRefetchError:a&&!p&&!y,isRefetching:o&&!x&&!w}}},R0,F0,nh,Mx,Qx,eee,Eue,F5e,UQe=(F5e=class extends t3{constructor(n,s){super();li(this,Qx);li(this,R0);li(this,F0);li(this,nh);li(this,Mx);us(this,R0,n),this.setOptions(s),this.bindMethods(),ia(this,Qx,eee).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const s=this.options;this.options=Qt(this,R0).defaultMutationOptions(n),Hee(this.options,s)||Qt(this,R0).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Qt(this,nh),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Lj(s.mutationKey)!==Lj(this.options.mutationKey)?this.reset():((i=Qt(this,nh))==null?void 0:i.state.status)==="pending"&&Qt(this,nh).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Qt(this,nh))==null||n.removeObserver(this)}onMutationUpdate(n){ia(this,Qx,eee).call(this),ia(this,Qx,Eue).call(this,n)}getCurrentResult(){return Qt(this,F0)}reset(){var n;(n=Qt(this,nh))==null||n.removeObserver(this),us(this,nh,void 0),ia(this,Qx,eee).call(this),ia(this,Qx,Eue).call(this)}mutate(n,s){var i;return us(this,Mx,s),(i=Qt(this,nh))==null||i.removeObserver(this),us(this,nh,Qt(this,R0).getMutationCache().build(Qt(this,R0),this.options)),Qt(this,nh).addObserver(this),Qt(this,nh).execute(n)}},R0=new WeakMap,F0=new WeakMap,nh=new WeakMap,Mx=new WeakMap,Qx=new WeakSet,eee=function(){var s;const n=((s=Qt(this,nh))==null?void 0:s.state)??wEe();us(this,F0,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Eue=function(n){Bc.batch(()=>{var s,i,o,l,a,h,p,x;if(Qt(this,Mx)&&this.hasListeners()){const y=Qt(this,F0).variables,w=Qt(this,F0).context;(n==null?void 0:n.type)==="success"?((i=(s=Qt(this,Mx)).onSuccess)==null||i.call(s,n.data,y,w),(l=(o=Qt(this,Mx)).onSettled)==null||l.call(o,n.data,null,y,w)):(n==null?void 0:n.type)==="error"&&((h=(a=Qt(this,Mx)).onError)==null||h.call(a,n.error,y,w),(x=(p=Qt(this,Mx)).onSettled)==null||x.call(p,void 0,n.error,y,w))}this.listeners.forEach(y=>{y(Qt(this,F0))})})},F5e),SEe=P.createContext(void 0),Wr=e=>{const t=P.useContext(SEe);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qQe=({client:e,children:t})=>(P.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(SEe.Provider,{value:e,children:t})),CEe=P.createContext(!1),VQe=()=>P.useContext(CEe);CEe.Provider;function HQe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var WQe=P.createContext(HQe()),GQe=()=>P.useContext(WQe),KQe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ZQe=e=>{P.useEffect(()=>{e.clearReset()},[e])},YQe=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(i&&e.data===void 0||gEe(n,[e.error,s])),XQe=e=>{if(e.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>t(n(...s)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},QQe=(e,t)=>e.isLoading&&e.isFetching&&!t,JQe=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ywe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function MEe(e,t,n){var y,w,j,S,C;const s=VQe(),i=GQe(),o=Wr(),l=o.defaultQueryOptions(e);(w=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||w.call(y,l),l._optimisticResults=s?"isRestoring":"optimistic",XQe(l),KQe(l,i),ZQe(i);const a=!o.getQueryCache().get(l.queryHash),[h]=P.useState(()=>new t(o,l)),p=h.getOptimisticResult(l),x=!s&&e.subscribed!==!1;if(P.useSyncExternalStore(P.useCallback(A=>{const E=x?h.subscribe(Bc.batchCalls(A)):vu;return h.updateResult(),E},[h,x]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),P.useEffect(()=>{h.setOptions(l)},[l,h]),JQe(l,p))throw ywe(l,h,i);if(YQe({result:p,errorResetBoundary:i,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw p.error;if((S=(j=o.getDefaultOptions().queries)==null?void 0:j._experimental_afterQuery)==null||S.call(j,l,p),l.experimental_prefetchInRender&&!Pj&&QQe(p,s)){const A=a?ywe(l,h,i):(C=o.getQueryCache().get(l.queryHash))==null?void 0:C.promise;A==null||A.catch(vu).finally(()=>{h.updateResult()})}return l.notifyOnChangeProps?p:h.trackResult(p)}function Jt(e,t){return MEe(e,kEe)}function cr(e,t){const n=Wr(),[s]=P.useState(()=>new UQe(n,e));P.useEffect(()=>{s.setOptions(e)},[s,e]);const i=P.useSyncExternalStore(P.useCallback(l=>s.subscribe(Bc.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=P.useCallback((l,a)=>{s.mutate(l,a).catch(vu)},[s]);if(i.error&&gEe(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function eJe(e,t){return MEe(e,$Qe)}/** * @remix-run/router v1.23.0 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function WA(){return WA=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function TEe(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function rJe(){return Math.random().toString(36).substr(2,8)}function _we(e,t){return{usr:e.state,key:e.key,idx:t}}function Iue(e,t,n,s){return n===void 0&&(n=null),WA({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?r3(t):t,{state:n,key:t&&t.key||s||rJe()})}function Kee(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function r3(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function nJe(e,t,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:o=!1}=s,l=i.history,a=U0.Pop,h=null,p=x();p==null&&(p=0,l.replaceState(WA({},l.state,{idx:p}),""));function x(){return(l.state||{idx:null}).idx}function y(){a=U0.Pop;let A=x(),E=A==null?null:A-p;p=A,h&&h({action:a,location:C.location,delta:E})}function w(A,E){a=U0.Push;let T=Iue(C.location,A,E);p=x()+1;let O=_we(T,p),z=C.createHref(T);try{l.pushState(O,"",z)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;i.location.assign(z)}o&&h&&h({action:a,location:C.location,delta:1})}function j(A,E){a=U0.Replace;let T=Iue(C.location,A,E);p=x();let O=_we(T,p),z=C.createHref(T);l.replaceState(O,"",z),o&&h&&h({action:a,location:C.location,delta:0})}function S(A){let E=i.location.origin!=="null"?i.location.origin:i.location.href,T=typeof A=="string"?A:Kee(A);return T=T.replace(/ $/,"%20"),uc(E,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,E)}let C={get action(){return a},get location(){return e(i,l)},listen(A){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(vwe,y),h=A,()=>{i.removeEventListener(vwe,y),h=null}},createHref(A){return t(i,A)},createURL:S,encodeLocation(A){let E=S(A);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:w,replace:j,go(A){return l.go(A)}};return C}var bwe;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(bwe||(bwe={}));function sJe(e,t,n){return n===void 0&&(n="/"),iJe(e,t,n)}function iJe(e,t,n,s){let i=typeof t=="string"?r3(t):t,o=oge(i.pathname||"/",n);if(o==null)return null;let l=AEe(e);aJe(l);let a=null;for(let h=0;a==null&&h{let h={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};h.relativePath.startsWith("/")&&(uc(h.relativePath.startsWith(s),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(s.length));let p=w1([s,h.relativePath]),x=n.concat(h);o.children&&o.children.length>0&&(uc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),AEe(o.children,t,x,p)),!(o.path==null&&!o.index)&&t.push({path:p,score:fJe(p,o.index),routesMeta:x})};return e.forEach((o,l)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))i(o,l);else for(let h of EEe(o.path))i(o,l,h)}),t}function EEe(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return i?[o,""]:[o];let l=EEe(s.join("/")),a=[];return a.push(...l.map(h=>h===""?o:[o,h].join("/"))),i&&a.push(...l),a.map(h=>e.startsWith("/")&&h===""?"/":h)}function aJe(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:pJe(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const oJe=/^:[\w-]+$/,lJe=3,cJe=2,dJe=1,uJe=10,hJe=-2,wwe=e=>e==="*";function fJe(e,t){let n=e.split("/"),s=n.length;return n.some(wwe)&&(s+=hJe),t&&(s+=cJe),n.filter(i=>!wwe(i)).reduce((i,o)=>i+(oJe.test(o)?lJe:o===""?dJe:uJe),s)}function pJe(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function mJe(e,t,n){let{routesMeta:s}=e,i={},o="/",l=[];for(let a=0;a{let{paramName:w,isOptional:j}=x;if(w==="*"){let C=a[y]||"";l=o.slice(0,o.length-C.length).replace(/(.)\/+$/,"$1")}const S=a[y];return j&&!S?p[w]=void 0:p[w]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:e}}function xJe(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),TEe(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,a,h)=>(s.push({paramName:a,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function yJe(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return TEe(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function oge(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}function vJe(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:i=""}=typeof e=="string"?r3(e):e;return{pathname:n?n.startsWith("/")?n:_Je(n,t):t,search:jJe(s),hash:kJe(i)}}function _Je(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function jle(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function bJe(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function lge(e,t){let n=bJe(e);return t?n.map((s,i)=>i===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function cge(e,t,n,s){s===void 0&&(s=!1);let i;typeof e=="string"?i=r3(e):(i=WA({},e),uc(!i.pathname||!i.pathname.includes("?"),jle("?","pathname","search",i)),uc(!i.pathname||!i.pathname.includes("#"),jle("#","pathname","hash",i)),uc(!i.search||!i.search.includes("#"),jle("#","search","hash",i)));let o=e===""||i.pathname==="",l=o?"/":i.pathname,a;if(l==null)a=n;else{let y=t.length-1;if(!s&&l.startsWith("..")){let w=l.split("/");for(;w[0]==="..";)w.shift(),y-=1;i.pathname=w.join("/")}a=y>=0?t[y]:"/"}let h=vJe(i,a),p=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||x)&&(h.pathname+="/"),h}const w1=e=>e.join("/").replace(/\/\/+/g,"/"),wJe=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),jJe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,kJe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function NJe(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const IEe=["post","put","patch","delete"];new Set(IEe);const SJe=["get",...IEe];new Set(SJe);/** * React Router v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function GA(){return GA=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),P.useCallback(function(p,x){if(x===void 0&&(x={}),!a.current)return;if(typeof p=="number"){s.go(p);return}let y=cge(p,JSON.parse(l),o,x.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:w1([t,y.pathname])),(x.replace?s.replace:s.push)(y,x.state,x)},[t,s,l,o,e])}const AJe=P.createContext(null);function EJe(e){let t=P.useContext(Fg).outlet;return t&&P.createElement(AJe.Provider,{value:e},t)}function Wc(){let{matches:e}=P.useContext(Fg),t=e[e.length-1];return t?t.params:{}}function OEe(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=P.useContext(Q1),{matches:i}=P.useContext(Fg),{pathname:o}=km(),l=JSON.stringify(lge(i,s.v7_relativeSplatPath));return P.useMemo(()=>cge(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function IJe(e,t){return PJe(e,t)}function PJe(e,t,n,s){n3()||uc(!1);let{navigator:i}=P.useContext(Q1),{matches:o}=P.useContext(Fg),l=o[o.length-1],a=l?l.params:{};l&&l.pathname;let h=l?l.pathnameBase:"/";l&&l.route;let p=km(),x;if(t){var y;let A=typeof t=="string"?r3(t):t;h==="/"||(y=A.pathname)!=null&&y.startsWith(h)||uc(!1),x=A}else x=p;let w=x.pathname||"/",j=w;if(h!=="/"){let A=h.replace(/^\//,"").split("/");j="/"+w.replace(/^\//,"").split("/").slice(A.length).join("/")}let S=sJe(e,{pathname:j}),C=FJe(S&&S.map(A=>Object.assign({},A,{params:Object.assign({},a,A.params),pathname:w1([h,i.encodeLocation?i.encodeLocation(A.pathname).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?h:w1([h,i.encodeLocation?i.encodeLocation(A.pathnameBase).pathname:A.pathnameBase])})),o,n,s);return t&&C?P.createElement(Rne.Provider,{value:{location:GA({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:U0.Pop}},C):C}function LJe(){let e=UJe(),t=NJe(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return P.createElement(P.Fragment,null,P.createElement("h2",null,"Unexpected Application Error!"),P.createElement("h3",{style:{fontStyle:"italic"}},t),n?P.createElement("pre",{style:i},n):null,null)}const OJe=P.createElement(LJe,null);class DJe extends P.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?P.createElement(Fg.Provider,{value:this.props.routeContext},P.createElement(PEe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RJe(e){let{routeContext:t,match:n,children:s}=e,i=P.useContext(dge);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),P.createElement(Fg.Provider,{value:t},s)}function FJe(e,t,n,s){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=s)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,a=(i=n)==null?void 0:i.errors;if(a!=null){let x=l.findIndex(y=>y.route.id&&(a==null?void 0:a[y.route.id])!==void 0);x>=0||uc(!1),l=l.slice(0,Math.min(l.length,x+1))}let h=!1,p=-1;if(n&&s&&s.v7_partialHydration)for(let x=0;x=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((x,y,w)=>{let j,S=!1,C=null,A=null;n&&(j=a&&y.route.id?a[y.route.id]:void 0,C=y.route.errorElement||OJe,h&&(p<0&&w===0?(VJe("route-fallback"),S=!0,A=null):p===w&&(S=!0,A=y.route.hydrateFallbackElement||null)));let E=t.concat(l.slice(0,w+1)),T=()=>{let O;return j?O=C:S?O=A:y.route.Component?O=P.createElement(y.route.Component,null):y.route.element?O=y.route.element:O=x,P.createElement(RJe,{match:y,routeContext:{outlet:x,matches:E,isDataRoute:n!=null},children:O})};return n&&(y.route.ErrorBoundary||y.route.errorElement||w===0)?P.createElement(DJe,{location:n.location,revalidation:n.revalidation,component:C,error:j,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):T()},null)}var DEe=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(DEe||{}),REe=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(REe||{});function zJe(e){let t=P.useContext(dge);return t||uc(!1),t}function BJe(e){let t=P.useContext(CJe);return t||uc(!1),t}function $Je(e){let t=P.useContext(Fg);return t||uc(!1),t}function FEe(e){let t=$Je(),n=t.matches[t.matches.length-1];return n.route.id||uc(!1),n.route.id}function UJe(){var e;let t=P.useContext(PEe),n=BJe(),s=FEe();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function qJe(){let{router:e}=zJe(DEe.UseNavigateStable),t=FEe(REe.UseNavigateStable),n=P.useRef(!1);return LEe(()=>{n.current=!0}),P.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,GA({fromRouteId:t},o)))},[e,t])}const jwe={};function VJe(e,t,n){jwe[e]||(jwe[e]=!0)}function HJe(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function tee(e){let{to:t,replace:n,state:s,relative:i}=e;n3()||uc(!1);let{future:o,static:l}=P.useContext(Q1),{matches:a}=P.useContext(Fg),{pathname:h}=km(),p=ns(),x=cge(t,lge(a,o.v7_relativeSplatPath),h,i==="path"),y=JSON.stringify(x);return P.useEffect(()=>p(JSON.parse(y),{replace:n,state:s,relative:i}),[p,y,i,n,s]),null}function WJe(e){return EJe(e.context)}function an(e){uc(!1)}function GJe(e){let{basename:t="/",children:n=null,location:s,navigationType:i=U0.Pop,navigator:o,static:l=!1,future:a}=e;n3()&&uc(!1);let h=t.replace(/^\/*/,"/"),p=P.useMemo(()=>({basename:h,navigator:o,static:l,future:GA({v7_relativeSplatPath:!1},a)}),[h,a,o,l]);typeof s=="string"&&(s=r3(s));let{pathname:x="/",search:y="",hash:w="",state:j=null,key:S="default"}=s,C=P.useMemo(()=>{let A=oge(x,h);return A==null?null:{location:{pathname:A,search:y,hash:w,state:j,key:S},navigationType:i}},[h,x,y,w,j,S,i]);return C==null?null:P.createElement(Q1.Provider,{value:p},P.createElement(Rne.Provider,{children:n,value:C}))}function KJe(e){let{children:t,location:n}=e;return IJe(Pue(t),n)}new Promise(()=>{});function Pue(e,t){t===void 0&&(t=[]);let n=[];return P.Children.forEach(e,(s,i)=>{if(!P.isValidElement(s))return;let o=[...t,i];if(s.type===P.Fragment){n.push.apply(n,Pue(s.props.children,o));return}s.type!==an&&uc(!1),!s.props.index||!s.props.children||uc(!1);let l={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(l.children=Pue(s.props.children,o)),n.push(l)}),n}/** * React Router DOM v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Lue(){return Lue=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function YJe(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function XJe(e,t){return e.button===0&&(!t||t==="_self")&&!YJe(e)}function Oue(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(i=>[n,i]):[[n,s]])},[]))}function QJe(e,t){let n=Oue(e);return t&&t.forEach((s,i)=>{n.has(i)||t.getAll(i).forEach(o=>{n.append(i,o)})}),n}const JJe=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],eet="6";try{window.__reactRouterVersion=eet}catch{}const tet="startTransition",kwe=Zpe[tet];function ret(e){let{basename:t,children:n,future:s,window:i}=e,o=P.useRef();o.current==null&&(o.current=tJe({window:i,v5Compat:!0}));let l=o.current,[a,h]=P.useState({action:l.action,location:l.location}),{v7_startTransition:p}=s||{},x=P.useCallback(y=>{p&&kwe?kwe(()=>h(y)):h(y)},[h,p]);return P.useLayoutEffect(()=>l.listen(x),[l,x]),P.useEffect(()=>HJe(s),[s]),P.createElement(GJe,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:l,future:s})}const net=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",set=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,co=P.forwardRef(function(t,n){let{onClick:s,relative:i,reloadDocument:o,replace:l,state:a,target:h,to:p,preventScrollReset:x,viewTransition:y}=t,w=ZJe(t,JJe),{basename:j}=P.useContext(Q1),S,C=!1;if(typeof p=="string"&&set.test(p)&&(S=p,net))try{let O=new URL(window.location.href),z=p.startsWith("//")?new URL(O.protocol+p):new URL(p),F=oge(z.pathname,j);z.origin===O.origin&&F!=null?p=F+z.search+z.hash:C=!0}catch{}let A=MJe(p,{relative:i}),E=iet(p,{replace:l,state:a,target:h,preventScrollReset:x,relative:i,viewTransition:y});function T(O){s&&s(O),O.defaultPrevented||E(O)}return P.createElement("a",Lue({},w,{href:S||A,onClick:C||o?s:T,ref:n,target:h}))});var Nwe;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Nwe||(Nwe={}));var Swe;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Swe||(Swe={}));function iet(e,t){let{target:n,replace:s,state:i,preventScrollReset:o,relative:l,viewTransition:a}=t===void 0?{}:t,h=ns(),p=km(),x=OEe(e,{relative:l});return P.useCallback(y=>{if(XJe(y,n)){y.preventDefault();let w=s!==void 0?s:Kee(p)===Kee(x);h(e,{replace:w,state:i,preventScrollReset:o,relative:l,viewTransition:a})}},[p,h,x,s,i,n,e,o,l,a])}function Fd(e){let t=P.useRef(Oue(e)),n=P.useRef(!1),s=km(),i=P.useMemo(()=>QJe(s.search,n.current?null:t.current),[s.search]),o=ns(),l=P.useCallback((a,h)=>{const p=Oue(typeof a=="function"?a(i):a);n.current=!0,o("?"+p,h)},[o,i]);return[i,l]}var aet=typeof Element<"u",oet=typeof Map=="function",cet=typeof Set=="function",det=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function ree(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,s,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!ree(e[s],t[s]))return!1;return!0}var o;if(oet&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;for(o=e.entries();!(s=o.next()).done;)if(!ree(s.value[1],t.get(s.value[0])))return!1;return!0}if(cet&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(det&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[s]))return!1;if(aet&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((i[s]==="_owner"||i[s]==="__v"||i[s]==="__o")&&e.$$typeof)&&!ree(e[i[s]],t[i[s]]))return!1;return!0}return e!==e&&t!==t}var uet=function(t,n){try{return ree(t,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const het=za(uet);var fet=function(e,t,n,s,i,o,l,a){if(!e){var h;if(t===void 0)h=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,s,i,o,l,a],x=0;h=new Error(t.replace(/%s/g,function(){return p[x++]})),h.name="Invariant Violation"}throw h.framesToPop=1,h}},pet=fet;const Cwe=za(pet);var met=function(t,n,s,i){var o=s?s.call(i,t,n):void 0;if(o!==void 0)return!!o;if(t===n)return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var l=Object.keys(t),a=Object.keys(n);if(l.length!==a.length)return!1;for(var h=Object.prototype.hasOwnProperty.bind(n),p=0;p(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(zEe||{}),kle={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},Mwe=Object.values(zEe),uge={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},xet=Object.entries(uge).reduce((e,[t,n])=>(e[n]=t,e),{}),am="data-rh",_S={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},bS=(e,t)=>{for(let n=e.length-1;n>=0;n-=1){const s=e[n];if(Object.prototype.hasOwnProperty.call(s,t))return s[t]}return null},yet=e=>{let t=bS(e,"title");const n=bS(e,_S.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,()=>t);const s=bS(e,_S.DEFAULT_TITLE);return t||s||void 0},vet=e=>bS(e,_S.ON_CHANGE_CLIENT_STATE)||(()=>{}),Nle=(e,t)=>t.filter(n=>typeof n[e]<"u").map(n=>n[e]).reduce((n,s)=>({...n,...s}),{}),_et=(e,t)=>t.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(e),IM=(e,t,n)=>{const s={};return n.filter(i=>Array.isArray(i[e])?!0:(typeof i[e]<"u"&&bet(`Helmet: ${e} should be of type "Array". Instead found type "${typeof i[e]}"`),!1)).map(i=>i[e]).reverse().reduce((i,o)=>{const l={};o.filter(h=>{let p;const x=Object.keys(h);for(let w=0;wi.push(h));const a=Object.keys(l);for(let h=0;h{if(Array.isArray(e)&&e.length){for(let n=0;n({baseTag:_et(["href"],e),bodyAttributes:Nle("bodyAttributes",e),defer:bS(e,_S.DEFER),encode:bS(e,_S.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Nle("htmlAttributes",e),linkTags:IM("link",["rel","href"],e),metaTags:IM("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:IM("noscript",["innerHTML"],e),onChangeClientState:vet(e),scriptTags:IM("script",["src","innerHTML"],e),styleTags:IM("style",["cssText"],e),title:yet(e),titleAttributes:Nle("titleAttributes",e),prioritizeSeoTags:wet(e,_S.PRIORITIZE_SEO_TAGS)}),BEe=e=>Array.isArray(e)?e.join(""):e,ket=(e,t)=>{const n=Object.keys(e);for(let s=0;sArray.isArray(e)?e.reduce((n,s)=>(ket(s,t)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:e,priority:[]},Twe=(e,t)=>({...e,[t]:void 0}),Net=["noscript","script","style"],Due=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),$Ee=e=>Object.keys(e).reduce((t,n)=>{const s=typeof e[n]<"u"?`${n}="${e[n]}"`:`${n}`;return t?`${t} ${s}`:s},""),Cet=(e,t,n,s)=>{const i=$Ee(n),o=BEe(t);return i?`<${e} ${am}="true" ${i}>${Due(o,s)}`:`<${e} ${am}="true">${Due(o,s)}`},Met=(e,t,n=!0)=>t.reduce((s,i)=>{const o=i,l=Object.keys(o).filter(p=>!(p==="innerHTML"||p==="cssText")).reduce((p,x)=>{const y=typeof o[x]>"u"?x:`${x}="${Due(o[x],n)}"`;return p?`${p} ${y}`:y},""),a=o.innerHTML||o.cssText||"",h=Net.indexOf(e)===-1;return`${s}<${e} ${am}="true" ${l}${h?"/>":`>${a}`}`},""),UEe=(e,t={})=>Object.keys(e).reduce((n,s)=>{const i=uge[s];return n[i||s]=e[s],n},t),Tet=(e,t,n)=>{const s={key:t,[am]:!0},i=UEe(n,s);return[rt.createElement("title",i,t)]},nee=(e,t)=>t.map((n,s)=>{const i={key:s,[am]:!0};return Object.keys(n).forEach(o=>{const a=uge[o]||o;if(a==="innerHTML"||a==="cssText"){const h=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:h}}else i[a]=n[o]}),rt.createElement(e,i)}),Tf=(e,t,n=!0)=>{switch(e){case"title":return{toComponent:()=>Tet(e,t.title,t.titleAttributes),toString:()=>Cet(e,t.title,t.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>UEe(t),toString:()=>$Ee(t)};default:return{toComponent:()=>nee(e,t),toString:()=>Met(e,t,n)}}},Aet=({metaTags:e,linkTags:t,scriptTags:n,encode:s})=>{const i=Sle(e,kle.meta),o=Sle(t,kle.link),l=Sle(n,kle.script);return{priorityMethods:{toComponent:()=>[...nee("meta",i.priority),...nee("link",o.priority),...nee("script",l.priority)],toString:()=>`${Tf("meta",i.priority,s)} ${Tf("link",o.priority,s)} ${Tf("script",l.priority,s)}`},metaTags:i.default,linkTags:o.default,scriptTags:l.default}},Eet=e=>{const{baseTag:t,bodyAttributes:n,encode:s=!0,htmlAttributes:i,noscriptTags:o,styleTags:l,title:a="",titleAttributes:h,prioritizeSeoTags:p}=e;let{linkTags:x,metaTags:y,scriptTags:w}=e,j={toComponent:()=>{},toString:()=>""};return p&&({priorityMethods:j,linkTags:x,metaTags:y,scriptTags:w}=Aet(e)),{priority:j,base:Tf("base",t,s),bodyAttributes:Tf("bodyAttributes",n,s),htmlAttributes:Tf("htmlAttributes",i,s),link:Tf("link",x,s),meta:Tf("meta",y,s),noscript:Tf("noscript",o,s),script:Tf("script",w,s),style:Tf("style",l,s),title:Tf("title",{title:a,titleAttributes:h},s)}},Rue=Eet,aL=[],qEe=!!(typeof window<"u"&&window.document&&window.document.createElement),Fue=class{constructor(e,t){Wn(this,"instances",[]);Wn(this,"canUseDOM",qEe);Wn(this,"context");Wn(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?aL:this.instances,add:e=>{(this.canUseDOM?aL:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?aL:this.instances).indexOf(e);(this.canUseDOM?aL:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=Rue({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Iet={},VEe=rt.createContext(Iet),nj,HEe=(nj=class extends P.Component{constructor(n){super(n);Wn(this,"helmetData");this.helmetData=new Fue(this.props.context||{},nj.canUseDOM)}render(){return rt.createElement(VEe.Provider,{value:this.helmetData.value},this.props.children)}},Wn(nj,"canUseDOM",qEe),nj),HN=(e,t)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${e}[${am}]`),i=[].slice.call(s),o=[];let l;return t&&t.length&&t.forEach(a=>{const h=document.createElement(e);for(const p in a)if(Object.prototype.hasOwnProperty.call(a,p))if(p==="innerHTML")h.innerHTML=a.innerHTML;else if(p==="cssText")h.styleSheet?h.styleSheet.cssText=a.cssText:h.appendChild(document.createTextNode(a.cssText));else{const x=p,y=typeof a[x]>"u"?"":a[x];h.setAttribute(p,y)}h.setAttribute(am,"true"),i.some((p,x)=>(l=x,h.isEqualNode(p)))?i.splice(l,1):o.push(h)}),i.forEach(a=>{var h;return(h=a.parentNode)==null?void 0:h.removeChild(a)}),o.forEach(a=>n.appendChild(a)),{oldTags:i,newTags:o}},zue=(e,t)=>{const n=document.getElementsByTagName(e)[0];if(!n)return;const s=n.getAttribute(am),i=s?s.split(","):[],o=[...i],l=Object.keys(t);for(const a of l){const h=t[a]||"";n.getAttribute(a)!==h&&n.setAttribute(a,h),i.indexOf(a)===-1&&i.push(a);const p=o.indexOf(a);p!==-1&&o.splice(p,1)}for(let a=o.length-1;a>=0;a-=1)n.removeAttribute(o[a]);i.length===o.length?n.removeAttribute(am):n.getAttribute(am)!==l.join(",")&&n.setAttribute(am,l.join(","))},Pet=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=BEe(e)),zue("title",t)},Awe=(e,t)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:i,linkTags:o,metaTags:l,noscriptTags:a,onChangeClientState:h,scriptTags:p,styleTags:x,title:y,titleAttributes:w}=e;zue("body",s),zue("html",i),Pet(y,w);const j={baseTag:HN("base",n),linkTags:HN("link",o),metaTags:HN("meta",l),noscriptTags:HN("noscript",a),scriptTags:HN("script",p),styleTags:HN("style",x)},S={},C={};Object.keys(j).forEach(A=>{const{newTags:E,oldTags:T}=j[A];E.length&&(S[A]=E),T.length&&(C[A]=j[A].oldTags)}),t&&t(),h(e,S,C)},PM=null,Let=e=>{PM&&cancelAnimationFrame(PM),e.defer?PM=requestAnimationFrame(()=>{Awe(e,()=>{PM=null})}):(Awe(e),PM=null)},Oet=Let,Ewe=class extends P.Component{constructor(){super(...arguments);Wn(this,"rendered",!1)}shouldComponentUpdate(t){return!get(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=jet(t.get().map(o=>{const l={...o.props};return delete l.context,l}));HEe.canUseDOM?Oet(i):Rue&&(s=Rue(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},pde,np=(pde=class extends P.Component{shouldComponentUpdate(e){return!het(Twe(this.props,"helmetData"),Twe(e,"helmetData"))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case"script":case"noscript":return{innerHTML:t};case"style":return{cssText:t};default:throw new Error(`<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(e,t,n,s){return{...t,[e.type]:[...t[e.type]||[],{...n,...this.mapNestedChildrenToProps(e,s)}]}}mapObjectTypeChildren(e,t,n,s){switch(e.type){case"title":return{...t,[e.type]:s,titleAttributes:{...n}};case"body":return{...t,bodyAttributes:{...n}};case"html":return{...t,htmlAttributes:{...n}};default:return{...t,[e.type]:{...n}}}}mapArrayTypeChildrenToProps(e,t){let n={...t};return Object.keys(e).forEach(s=>{n={...n,[s]:e[s]}}),n}warnOnInvalidChildren(e,t){return Cwe(Mwe.some(n=>e.type===n),typeof e.type=="function"?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${Mwe.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),Cwe(!t||typeof t=="string"||Array.isArray(t)&&!t.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(e,t){let n={};return rt.Children.forEach(e,s=>{if(!s||!s.props)return;const{children:i,...o}=s.props,l=Object.keys(o).reduce((h,p)=>(h[xet[p]||p]=o[p],h),{});let{type:a}=s;switch(typeof a=="symbol"?a=a.toString():this.warnOnInvalidChildren(s,i),a){case"Symbol(react.fragment)":t=this.mapChildrenToProps(i,t);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,l,i);break;default:t=this.mapObjectTypeChildren(s,t,l,i);break}}),this.mapArrayTypeChildrenToProps(n,t)}render(){const{children:e,...t}=this.props;let n={...t},{helmetData:s}=t;if(e&&(n=this.mapChildrenToProps(e,n)),s&&!(s instanceof Fue)){const i=s;s=new Fue(i.context,!0),delete n.helmetData}return s?rt.createElement(Ewe,{...n,context:s.value}):rt.createElement(VEe.Consumer,null,i=>rt.createElement(Ewe,{...n,context:i}))}},Wn(pde,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),pde),Bue=function(e,t){return Bue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},Bue(e,t)};function WEe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Bue(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Df=function(){return Df=Object.assign||function(t){for(var n,s=1,i=arguments.length;s=0;a--)(l=e[a])&&(o=(i<3?l(o):i>3?l(t,n,o):l(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function KEe(e,t){return function(n,s){t(n,s,e)}}function ZEe(e,t,n,s,i,o){function l(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var a=s.kind,h=a==="getter"?"get":a==="setter"?"set":"value",p=!t&&e?s.static?e:e.prototype:null,x=t||(p?Object.getOwnPropertyDescriptor(p,s.name):{}),y,w=!1,j=n.length-1;j>=0;j--){var S={};for(var C in s)S[C]=C==="access"?{}:s[C];for(var C in s.access)S.access[C]=s.access[C];S.addInitializer=function(E){if(w)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(E||null))};var A=(0,n[j])(a==="accessor"?{get:x.get,set:x.set}:x[h],S);if(a==="accessor"){if(A===void 0)continue;if(A===null||typeof A!="object")throw new TypeError("Object expected");(y=l(A.get))&&(x.get=y),(y=l(A.set))&&(x.set=y),(y=l(A.init))&&i.unshift(y)}else(y=l(A))&&(a==="field"?i.unshift(y):x[h]=y)}p&&Object.defineProperty(p,s.name,x),w=!0}function YEe(e,t,n){for(var s=arguments.length>2,i=0;i0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function hge(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var s=n.call(e),i,o=[],l;try{for(;(t===void 0||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(a){l={error:a}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(l)throw l.error}}return o}function rIe(){for(var e=[],t=0;t1||h(j,C)})},S&&(i[j]=S(i[j])))}function h(j,S){try{p(s[j](S))}catch(C){w(o[0][3],C)}}function p(j){j.value instanceof sC?Promise.resolve(j.value.v).then(x,y):w(o[0][2],j)}function x(j){h("next",j)}function y(j){h("throw",j)}function w(j,S){j(S),o.shift(),o.length&&h(o[0][0],o[0][1])}}function iIe(e){var t,n;return t={},s("next"),s("throw",function(i){throw i}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(i,o){t[i]=e[i]?function(l){return(n=!n)?{value:sC(e[i](l)),done:!1}:o?o(l):l}:o}}function aIe(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Zee=="function"?Zee(e):e[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(o){n[o]=e[o]&&function(l){return new Promise(function(a,h){l=e[o](l),i(a,h,l.done,l.value)})}}function i(o,l,a,h){Promise.resolve(h).then(function(p){o({value:p,done:a})},l)}}function oIe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Det=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},$ue=function(e){return $ue=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},$ue(e)};function lIe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=$ue(e),s=0;s0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=Promise.allSettled(n.map(h=>{if(h=$et(h),h in Iwe)return;Iwe[h]=!0;const p=h.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${x}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":Bet,p||(y.as="script"),y.crossOrigin="",y.href=h,a&&y.setAttribute("nonce",a),document.head.appendChild(y),p)return new Promise((w,j)=>{y.addEventListener("load",w),y.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(l){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=l,window.dispatchEvent(a),!a.defaultPrevented)throw l}return i.then(l=>{for(const a of l||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})},Uet=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>tk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)};class pge extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}}class Pwe extends pge{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Lwe extends pge{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Owe extends pge{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Uue;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Uue||(Uue={}));class qet{constructor(t,{headers:n={},customFetch:s,region:i=Uue.Any}={}){this.url=t,this.headers=n,this.region=i,this.fetch=Uet(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Ps(this,arguments,void 0,function*(n,s={}){var i;try{const{headers:o,method:l,body:a,signal:h}=s;let p={},{region:x}=s;x||(x=this.region);const y=new URL(`${this.url}/${n}`);x&&x!=="any"&&(p["x-region"]=x,y.searchParams.set("forceFunctionRegion",x));let w;a&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",w=a):typeof a=="string"?(p["Content-Type"]="text/plain",w=a):typeof FormData<"u"&&a instanceof FormData?w=a:(p["Content-Type"]="application/json",w=JSON.stringify(a)):w=a;const j=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),o),body:w,signal:h}).catch(E=>{throw E.name==="AbortError"?E:new Pwe(E)}),S=j.headers.get("x-relay-error");if(S&&S==="true")throw new Lwe(j);if(!j.ok)throw new Owe(j);let C=((i=j.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),A;return C==="application/json"?A=yield j.json():C==="application/octet-stream"||C==="application/pdf"?A=yield j.blob():C==="text/event-stream"?A=j:C==="multipart/form-data"?A=yield j.formData():A=yield j.text(),{data:A,error:null,response:j}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new Pwe(o)}:{data:null,error:o,response:o instanceof Owe||o instanceof Lwe?o.context:void 0}}})}}var oh={};const i3=z5e(zet);var oL={},lL={},cL={},dL={},uL={},Vet=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},iC=Vet();const Het=iC.fetch,gIe=iC.fetch.bind(iC),xIe=iC.Headers,Wet=iC.Request,Get=iC.Response,tk=Object.freeze(Object.defineProperty({__proto__:null,Headers:xIe,Request:Wet,Response:Get,default:gIe,fetch:Het},Symbol.toStringTag,{value:"Module"})),Ket=z5e(tk);var hL={},Dwe;function yIe(){if(Dwe)return hL;Dwe=1,Object.defineProperty(hL,"__esModule",{value:!0});class e extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}}return hL.default=e,hL}var Rwe;function vIe(){if(Rwe)return uL;Rwe=1,Object.defineProperty(uL,"__esModule",{value:!0});const e=i3,t=e.__importDefault(Ket),n=e.__importDefault(yIe());class s{constructor(o){var l,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(l=o.shouldThrowOnError)!==null&&l!==void 0?l:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:typeof fetch>"u"?this.fetch=t.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,l){return this.headers=new Headers(this.headers),this.headers.set(o,l),this}then(o,l){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 a=this.fetch;let h=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async p=>{var x,y,w,j;let S=null,C=null,A=null,E=p.status,T=p.statusText;if(p.ok){if(this.method!=="HEAD"){const q=await p.text();q===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((x=this.headers.get("Accept"))===null||x===void 0)&&x.includes("application/vnd.pgrst.plan+text"))?C=q:C=JSON.parse(q))}const z=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),F=(w=p.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");z&&F&&F.length>1&&(A=parseInt(F[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(C)&&(C.length>1?(S={code:"PGRST116",details:`Results contain ${C.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},C=null,A=null,E=406,T="Not Acceptable"):C.length===1?C=C[0]:C=null)}else{const z=await p.text();try{S=JSON.parse(z),Array.isArray(S)&&p.status===404&&(C=[],S=null,E=200,T="OK")}catch{p.status===404&&z===""?(E=204,T="No Content"):S={message:z}}if(S&&this.isMaybeSingle&&(!((j=S==null?void 0:S.details)===null||j===void 0)&&j.includes("0 rows"))&&(S=null,E=200,T="OK"),S&&this.shouldThrowOnError)throw new n.default(S)}return{error:S,data:C,count:A,status:E,statusText:T}});return this.shouldThrowOnError||(h=h.catch(p=>{var x,y,w;return{error:{message:`${(x=p==null?void 0:p.name)!==null&&x!==void 0?x:"FetchError"}: ${p==null?void 0:p.message}`,details:`${(y=p==null?void 0:p.stack)!==null&&y!==void 0?y:""}`,hint:"",code:`${(w=p==null?void 0:p.code)!==null&&w!==void 0?w:""}`},data:null,count:null,status:0,statusText:""}})),h.then(o,l)}returns(){return this}overrideTypes(){return this}}return uL.default=s,uL}var Fwe;function _Ie(){if(Fwe)return dL;Fwe=1,Object.defineProperty(dL,"__esModule",{value:!0});const t=i3.__importDefault(vIe());class n extends t.default{select(i){let o=!1;const l=(i??"*").split("").map(a=>/\s/.test(a)&&!o?"":(a==='"'&&(o=!o),a)).join("");return this.url.searchParams.set("select",l),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:o=!0,nullsFirst:l,foreignTable:a,referencedTable:h=a}={}){const p=h?`${h}.order`:"order",x=this.url.searchParams.get(p);return this.url.searchParams.set(p,`${x?`${x},`:""}${i}.${o?"asc":"desc"}${l===void 0?"":l?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:o,referencedTable:l=o}={}){const a=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(a,`${i}`),this}range(i,o,{foreignTable:l,referencedTable:a=l}={}){const h=typeof a>"u"?"offset":`${a}.offset`,p=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(h,`${i}`),this.url.searchParams.set(p,`${o-i+1}`),this}abortSignal(i){return this.signal=i,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}explain({analyze:i=!1,verbose:o=!1,settings:l=!1,buffers:a=!1,wal:h=!1,format:p="text"}={}){var x;const y=[i?"analyze":null,o?"verbose":null,l?"settings":null,a?"buffers":null,h?"wal":null].filter(Boolean).join("|"),w=(x=this.headers.get("Accept"))!==null&&x!==void 0?x:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${p}; for="${w}"; options=${y};`),p==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}}return dL.default=n,dL}var zwe;function mge(){if(zwe)return cL;zwe=1,Object.defineProperty(cL,"__esModule",{value:!0});const t=i3.__importDefault(_Ie()),n=new RegExp("[,()]");class s extends t.default{eq(o,l){return this.url.searchParams.append(o,`eq.${l}`),this}neq(o,l){return this.url.searchParams.append(o,`neq.${l}`),this}gt(o,l){return this.url.searchParams.append(o,`gt.${l}`),this}gte(o,l){return this.url.searchParams.append(o,`gte.${l}`),this}lt(o,l){return this.url.searchParams.append(o,`lt.${l}`),this}lte(o,l){return this.url.searchParams.append(o,`lte.${l}`),this}like(o,l){return this.url.searchParams.append(o,`like.${l}`),this}likeAllOf(o,l){return this.url.searchParams.append(o,`like(all).{${l.join(",")}}`),this}likeAnyOf(o,l){return this.url.searchParams.append(o,`like(any).{${l.join(",")}}`),this}ilike(o,l){return this.url.searchParams.append(o,`ilike.${l}`),this}ilikeAllOf(o,l){return this.url.searchParams.append(o,`ilike(all).{${l.join(",")}}`),this}ilikeAnyOf(o,l){return this.url.searchParams.append(o,`ilike(any).{${l.join(",")}}`),this}is(o,l){return this.url.searchParams.append(o,`is.${l}`),this}in(o,l){const a=Array.from(new Set(l)).map(h=>typeof h=="string"&&n.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(o,`in.(${a})`),this}contains(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cs.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cs.{${l.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(l)}`),this}containedBy(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cd.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cd.{${l.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(l)}`),this}rangeGt(o,l){return this.url.searchParams.append(o,`sr.${l}`),this}rangeGte(o,l){return this.url.searchParams.append(o,`nxl.${l}`),this}rangeLt(o,l){return this.url.searchParams.append(o,`sl.${l}`),this}rangeLte(o,l){return this.url.searchParams.append(o,`nxr.${l}`),this}rangeAdjacent(o,l){return this.url.searchParams.append(o,`adj.${l}`),this}overlaps(o,l){return typeof l=="string"?this.url.searchParams.append(o,`ov.${l}`):this.url.searchParams.append(o,`ov.{${l.join(",")}}`),this}textSearch(o,l,{config:a,type:h}={}){let p="";h==="plain"?p="pl":h==="phrase"?p="ph":h==="websearch"&&(p="w");const x=a===void 0?"":`(${a})`;return this.url.searchParams.append(o,`${p}fts${x}.${l}`),this}match(o){return Object.entries(o).forEach(([l,a])=>{this.url.searchParams.append(l,`eq.${a}`)}),this}not(o,l,a){return this.url.searchParams.append(o,`not.${l}.${a}`),this}or(o,{foreignTable:l,referencedTable:a=l}={}){const h=a?`${a}.or`:"or";return this.url.searchParams.append(h,`(${o})`),this}filter(o,l,a){return this.url.searchParams.append(o,`${l}.${a}`),this}}return cL.default=s,cL}var Bwe;function bIe(){if(Bwe)return lL;Bwe=1,Object.defineProperty(lL,"__esModule",{value:!0});const t=i3.__importDefault(mge());class n{constructor(i,{headers:o={},schema:l,fetch:a}){this.url=i,this.headers=new Headers(o),this.schema=l,this.fetch=a}select(i,o){const{head:l=!1,count:a}=o??{},h=l?"HEAD":"GET";let p=!1;const x=(i??"*").split("").map(y=>/\s/.test(y)&&!p?"":(y==='"'&&(p=!p),y)).join("");return this.url.searchParams.set("select",x),a&&this.headers.append("Prefer",`count=${a}`),new t.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(i,{count:o,defaultToNull:l=!0}={}){var a;const h="POST";if(o&&this.headers.append("Prefer",`count=${o}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const p=i.reduce((x,y)=>x.concat(Object.keys(y)),[]);if(p.length>0){const x=[...new Set(p)].map(y=>`"${y}"`);this.url.searchParams.set("columns",x.join(","))}}return new t.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(i,{onConflict:o,ignoreDuplicates:l=!1,count:a,defaultToNull:h=!0}={}){var p;const x="POST";if(this.headers.append("Prefer",`resolution=${l?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),a&&this.headers.append("Prefer",`count=${a}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const y=i.reduce((w,j)=>w.concat(Object.keys(j)),[]);if(y.length>0){const w=[...new Set(y)].map(j=>`"${j}"`);this.url.searchParams.set("columns",w.join(","))}}return new t.default({method:x,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(p=this.fetch)!==null&&p!==void 0?p:fetch})}update(i,{count:o}={}){var l;const a="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new t.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}delete({count:i}={}){var o;const l="DELETE";return i&&this.headers.append("Prefer",`count=${i}`),new t.default({method:l,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}}return lL.default=n,lL}var $we;function Zet(){if($we)return oL;$we=1,Object.defineProperty(oL,"__esModule",{value:!0});const e=i3,t=e.__importDefault(bIe()),n=e.__importDefault(mge());class s{constructor(o,{headers:l={},schema:a,fetch:h}={}){this.url=o,this.headers=new Headers(l),this.schemaName=a,this.fetch=h}from(o){const l=new URL(`${this.url}/${o}`);return new t.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new s(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:a=!1,get:h=!1,count:p}={}){var x;let y;const w=new URL(`${this.url}/rpc/${o}`);let j;a||h?(y=a?"HEAD":"GET",Object.entries(l).filter(([C,A])=>A!==void 0).map(([C,A])=>[C,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([C,A])=>{w.searchParams.append(C,A)})):(y="POST",j=l);const S=new Headers(this.headers);return p&&S.set("Prefer",`count=${p}`),new n.default({method:y,url:w,headers:S,schema:this.schemaName,body:j,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return oL.default=s,oL}Object.defineProperty(oh,"__esModule",{value:!0});var wIe=oh.PostgrestError=IIe=oh.PostgrestBuilder=AIe=oh.PostgrestTransformBuilder=MIe=oh.PostgrestFilterBuilder=SIe=oh.PostgrestQueryBuilder=kIe=oh.PostgrestClient=void 0;const a3=i3,jIe=a3.__importDefault(Zet());var kIe=oh.PostgrestClient=jIe.default;const NIe=a3.__importDefault(bIe());var SIe=oh.PostgrestQueryBuilder=NIe.default;const CIe=a3.__importDefault(mge());var MIe=oh.PostgrestFilterBuilder=CIe.default;const TIe=a3.__importDefault(_Ie());var AIe=oh.PostgrestTransformBuilder=TIe.default;const EIe=a3.__importDefault(vIe());var IIe=oh.PostgrestBuilder=EIe.default;const PIe=a3.__importDefault(yIe());wIe=oh.PostgrestError=PIe.default;var LIe=oh.default={PostgrestClient:jIe.default,PostgrestQueryBuilder:NIe.default,PostgrestFilterBuilder:CIe.default,PostgrestTransformBuilder:TIe.default,PostgrestBuilder:EIe.default,PostgrestError:PIe.default};const Yet=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return IIe},get PostgrestClient(){return kIe},get PostgrestError(){return wIe},get PostgrestFilterBuilder(){return MIe},get PostgrestQueryBuilder(){return SIe},get PostgrestTransformBuilder(){return AIe},default:LIe},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:Xet,PostgrestQueryBuilder:UZt,PostgrestFilterBuilder:qZt,PostgrestTransformBuilder:VZt,PostgrestBuilder:HZt,PostgrestError:WZt}=LIe||Yet;class Qet{static detectEnvironment(){var t;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"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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 n=process.versions;if(n&&n.node){const s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: import ws from "ws" new 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 t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=` Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const s=this.getWebSocketConstructor();return new s(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Jet="2.78.0",ett=`realtime-js/${Jet}`,ttt="1.0.0",que=1e4,rtt=1e3,ntt=100;var tA;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(tA||(tA={}));var Oc;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Oc||(Oc={}));var Xp;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(Xp||(Xp={}));var Vue;(function(e){e.websocket="websocket"})(Vue||(Vue={}));var Tw;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Tw||(Tw={}));class stt{constructor(){this.HEADER_LENGTH=1}decode(t,n){return t.constructor===ArrayBuffer?n(this._binaryDecode(t)):n(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const n=new DataView(t),s=new TextDecoder;return this._decodeBroadcast(t,n,s)}_decodeBroadcast(t,n,s){const i=n.getUint8(1),o=n.getUint8(2);let l=this.HEADER_LENGTH+2;const a=s.decode(t.slice(l,l+i));l=l+i;const h=s.decode(t.slice(l,l+o));l=l+o;const p=JSON.parse(s.decode(t.slice(l,t.byteLength)));return{ref:null,topic:a,event:h,payload:p}}}class OIe{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}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 Ho;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Ho||(Ho={}));const Uwe=(e,t,n={})=>{var s;const i=(s=n.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((o,l)=>(o[l]=itt(l,e,t,i),o),{}):{}},itt=(e,t,n,s)=>{const i=t.find(a=>a.name===e),o=i==null?void 0:i.type,l=n[e];return o&&!s.includes(o)?DIe(o,l):Hue(l)},DIe=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return ctt(t,n)}switch(e){case Ho.bool:return att(t);case Ho.float4:case Ho.float8:case Ho.int2:case Ho.int4:case Ho.int8:case Ho.numeric:case Ho.oid:return ott(t);case Ho.json:case Ho.jsonb:return ltt(t);case Ho.timestamp:return dtt(t);case Ho.abstime:case Ho.date:case Ho.daterange:case Ho.int4range:case Ho.int8range:case Ho.money:case Ho.reltime:case Ho.text:case Ho.time:case Ho.timestamptz:case Ho.timetz:case Ho.tsrange:case Ho.tstzrange:return Hue(t);default:return Hue(t)}},Hue=e=>e,att=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},ott=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},ltt=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},ctt=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,s=e[n];if(e[0]==="{"&&s==="}"){let o;const l=e.slice(1,n);try{o=JSON.parse("["+l+"]")}catch{o=l?l.split(","):[]}return o.map(a=>DIe(t,a))}return e},dtt=e=>typeof e=="string"?e.replace(" ","T"):e,RIe=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class Cle{constructor(t,n,s={},i=que){this.channel=t,this.event=n,this.payload=s,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,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(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var s;return this._hasReceived(t)&&n((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var qwe;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(qwe||(qwe={}));class rA{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},i=>{const{onJoin:o,onLeave:l,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=rA.syncState(this.state,i,o,l),this.pendingDiffs.forEach(h=>{this.state=rA.syncDiff(this.state,h,o,l)}),this.pendingDiffs=[],a()}),this.channel._on(s.diff,{},i=>{const{onJoin:o,onLeave:l,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=rA.syncDiff(this.state,i,o,l),a())}),this.onJoin((i,o,l)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:o,newPresences:l})}),this.onLeave((i,o,l)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:o,leftPresences:l})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,s,i){const o=this.cloneDeep(t),l=this.transformState(n),a={},h={};return this.map(o,(p,x)=>{l[p]||(h[p]=x)}),this.map(l,(p,x)=>{const y=o[p];if(y){const w=x.map(A=>A.presence_ref),j=y.map(A=>A.presence_ref),S=x.filter(A=>j.indexOf(A.presence_ref)<0),C=y.filter(A=>w.indexOf(A.presence_ref)<0);S.length>0&&(a[p]=S),C.length>0&&(h[p]=C)}else a[p]=x}),this.syncDiff(o,{joins:a,leaves:h},s,i)}static syncDiff(t,n,s,i){const{joins:o,leaves:l}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),i||(i=()=>{}),this.map(o,(a,h)=>{var p;const x=(p=t[a])!==null&&p!==void 0?p:[];if(t[a]=this.cloneDeep(h),x.length>0){const y=t[a].map(j=>j.presence_ref),w=x.filter(j=>y.indexOf(j.presence_ref)<0);t[a].unshift(...w)}s(a,x,h)}),this.map(l,(a,h)=>{let p=t[a];if(!p)return;const x=h.map(y=>y.presence_ref);p=p.filter(y=>x.indexOf(y.presence_ref)<0),t[a]=p,i(a,p,h),p.length===0&&delete t[a]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(s=>n(s,t[s]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,s)=>{const i=t[s];return"metas"in i?n[s]=i.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[s]=i,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Vwe;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Vwe||(Vwe={}));var nA;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(nA||(nA={}));var bx;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(bx||(bx={}));class gge{constructor(t,n={config:{}},s){var i,o;if(this.topic=t,this.params=n,this.socket=s,this.bindings={},this.state=Oc.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new Cle(this,Xp.join,this.params,this.timeout),this.rejoinTimer=new OIe(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Oc.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Oc.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Oc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Oc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Oc.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Xp.reply,{},(l,a)=>{this._trigger(this._replyEventName(a),l)}),this.presence=new rA(this),this.broadcastEndpointURL=RIe(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var s,i,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Oc.closed){const{config:{broadcast:l,presence:a,private:h}}=this.params,p=(i=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(j=>j.filter))!==null&&i!==void 0?i:[],x=!!this.bindings[nA.PRESENCE]&&this.bindings[nA.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,y={},w={broadcast:l,presence:Object.assign(Object.assign({},a),{enabled:x}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(j=>t==null?void 0:t(bx.CHANNEL_ERROR,j)),this._onClose(()=>t==null?void 0:t(bx.CLOSED)),this.updateJoinPayload(Object.assign({config:w},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:j})=>{var S;if(this.socket.setAuth(),j===void 0){t==null||t(bx.SUBSCRIBED);return}else{const C=this.bindings.postgres_changes,A=(S=C==null?void 0:C.length)!==null&&S!==void 0?S:0,E=[];for(let T=0;T{this.state=Oc.errored,t==null||t(bx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(j).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(bx.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,s){return this.state===Oc.joined&&t===nA.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(t,n,s)}async httpSend(t,n,s={}){var i;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(n==null)return Promise.reject("Payload is required for httpSend()");const l={method:"POST",headers:{Authorization:o,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(i=s.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let h=a.statusText;try{const p=await a.json();h=p.error||p.message||h}catch{}return Promise.reject(new Error(h))}async send(t,n={}){var s,i;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:l}=t,h={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:l,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((i=p.body)===null||i===void 0?void 0:i.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var l,a,h;const p=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((h=(a=(l=this.params)===null||l===void 0?void 0:l.config)===null||a===void 0?void 0:a.broadcast)===null||h===void 0)&&h.ack)&&o("ok"),p.receive("ok",()=>o("ok")),p.receive("error",()=>o("error")),p.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Oc.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Xp.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(i=>{s=new Cle(this,Xp.leave,{},t),s.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Oc.closed,this.bindings={}}async _fetchWithTimeout(t,n,s){const i=new AbortController,o=setTimeout(()=>i.abort(),s),l=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(o),l}_push(t,n,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Cle(this,t,n,s);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>ntt){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,s){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,s){var i,o;const l=t.toLocaleLowerCase(),{close:a,error:h,leave:p,join:x}=Xp;if(s&&[a,h,p,x].indexOf(l)>=0&&s!==this._joinRef())return;let w=this._onMessage(l,n,s);if(n&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(l)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(j=>{var S,C,A;return((S=j.filter)===null||S===void 0?void 0:S.event)==="*"||((A=(C=j.filter)===null||C===void 0?void 0:C.event)===null||A===void 0?void 0:A.toLocaleLowerCase())===l}).map(j=>j.callback(w,s)):(o=this.bindings[l])===null||o===void 0||o.filter(j=>{var S,C,A,E,T,O;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in j){const z=j.id,F=(S=j.filter)===null||S===void 0?void 0:S.event;return z&&((C=n.ids)===null||C===void 0?void 0:C.includes(z))&&(F==="*"||(F==null?void 0:F.toLocaleLowerCase())===((A=n.data)===null||A===void 0?void 0:A.type.toLocaleLowerCase()))}else{const z=(T=(E=j==null?void 0:j.filter)===null||E===void 0?void 0:E.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return z==="*"||z===((O=n==null?void 0:n.event)===null||O===void 0?void 0:O.toLocaleLowerCase())}else return j.type.toLocaleLowerCase()===l}).map(j=>{if(typeof w=="object"&&"ids"in w){const S=w.data,{schema:C,table:A,commit_timestamp:E,type:T,errors:O}=S;w=Object.assign(Object.assign({},{schema:C,table:A,commit_timestamp:E,eventType:T,new:{},old:{},errors:O}),this._getPayloadRecords(S))}j.callback(w,s)})}_isClosed(){return this.state===Oc.closed}_isJoined(){return this.state===Oc.joined}_isJoining(){return this.state===Oc.joining}_isLeaving(){return this.state===Oc.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,s){const i=t.toLocaleLowerCase(),o={type:i,filter:n,callback:s};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this}_off(t,n){const s=t.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(i=>{var o;return!(((o=i.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===s&&gge.isEqual(i.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const s in t)if(t[s]!==n[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Xp.close,{},t)}_onError(t){this._on(Xp.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Oc.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Uwe(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Uwe(t.columns,t.old_record)),n}}const Mle=()=>{},fL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},utt=[1e3,2e3,5e3,1e4],htt=1e4,ftt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class ptt{constructor(t,n){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=que,this.transport=null,this.heartbeatIntervalMs=fL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Mle,this.ref=0,this.reconnectTimer=null,this.logger=Mle,this.conn=null,this.sendBuffer=[],this.serializer=new stt,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>{let o;return i?o=i:typeof fetch>"u"?o=(...l)=>s3(async()=>{const{default:a}=await Promise.resolve().then(()=>tk);return{default:a}},void 0).then(({default:a})=>a(...l)).catch(a=>{throw new Error(`Failed to load @supabase/node-fetch: ${a.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...l)=>o(...l)},!(!((s=n==null?void 0:n.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${Vue.websocket}`,this.httpEndpoint=RIe(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Qet.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:ttt}))}disconnect(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},t?this.conn.close(t,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,s){this.logger(t,n,s)}connectionState(){switch(this.conn&&this.conn.readyState){case tA.connecting:return Tw.Connecting;case tA.open:return Tw.Open;case tA.closing:return Tw.Closing;default:return Tw.Closed}}isConnected(){return this.connectionState()===Tw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const s=`realtime:${t}`,i=this.getChannels().find(o=>o.topic===s);if(i)return i;{const o=new gge(`realtime:${t}`,n,this);return this.channels.push(o),o}}push(t){const{topic:n,event:s,payload:i,ref:o}=t,l=()=>{this.encode(t,a=>{var h;(h=this.conn)===null||h===void 0||h.send(a)})};this.log("push",`${n} ${s} (${o})`,i),this.isConnected()?l():this.sendBuffer.push(l)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(rtt,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},fL.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(s=>s.topic===t&&(s._isJoined()||s._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(p){this.log("error","error in heartbeat callback",p)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:i,payload:o,ref:l}=n,a=l?`(${l})`:"",h=o.status||"";this.log("receive",`${h} ${s} ${i} ${a}`.trim(),o),this.channels.filter(p=>p._isMember(s)).forEach(p=>p._trigger(i,o,l)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.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=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),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 t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(Xp.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const s=t.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${t}${s}${i}`}_workerObjectUrl(t){let n;if(t)n=t;else{const s=new Blob([ftt],{type:"application/javascript"});n=URL.createObjectURL(s)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n;t?n=t:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:ett};n&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(Xp.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(s=>{try{s(n)}catch(i){this.log("error",`error in ${t} callback`,i)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new OIe(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},fL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,s,i,o,l,a,h,p,x;if(this.transport=(n=t==null?void 0:t.transport)!==null&&n!==void 0?n:null,this.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:que,this.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:fL.HEARTBEAT_INTERVAL,this.worker=(o=t==null?void 0:t.worker)!==null&&o!==void 0?o:!1,this.accessToken=(l=t==null?void 0:t.accessToken)!==null&&l!==void 0?l:null,this.heartbeatCallback=(a=t==null?void 0:t.heartbeatCallback)!==null&&a!==void 0?a:Mle,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(h=t==null?void 0:t.reconnectAfterMs)!==null&&h!==void 0?h:y=>utt[y-1]||htt,this.encode=(p=t==null?void 0:t.encode)!==null&&p!==void 0?p:(y,w)=>w(JSON.stringify(y)),this.decode=(x=t==null?void 0:t.decode)!==null&&x!==void 0?x:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}class xge extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Tl(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class mtt extends xge{constructor(t,n,s){super(t),this.name="StorageApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Wue extends xge{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}const yge=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>tk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},gtt=()=>Ps(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield s3(()=>Promise.resolve().then(()=>tk),void 0)).Response:Response}),Gue=e=>{if(Array.isArray(e))return e.map(n=>Gue(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,s])=>{const i=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[i]=Gue(s)}),t},xtt=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Tle=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},ytt=(e,t,n)=>Ps(void 0,void 0,void 0,function*(){const s=yield gtt();e instanceof s&&!(n!=null&&n.noResolveJson)?e.json().then(i=>{const o=e.status||500,l=(i==null?void 0:i.statusCode)||o+"";t(new mtt(Tle(i),o,l))}).catch(i=>{t(new Wue(Tle(i),i))}):t(new Wue(Tle(e),e))}),vtt=(e,t,n,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!s?i:(xtt(s)?(i.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(s)):i.body=s,t!=null&&t.duplex&&(i.duplex=t.duplex),Object.assign(Object.assign({},i),n))};function pI(e,t,n,s,i,o){return Ps(this,void 0,void 0,function*(){return new Promise((l,a)=>{e(n,vtt(t,s,i,o)).then(h=>{if(!h.ok)throw h;return s!=null&&s.noResolveJson?h:h.json()}).then(h=>l(h)).catch(h=>ytt(h,a,s))})})}function KA(e,t,n,s){return Ps(this,void 0,void 0,function*(){return pI(e,"GET",t,n,s)})}function Gp(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return pI(e,"POST",t,s,i,n)})}function Kue(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return pI(e,"PUT",t,s,i,n)})}function _tt(e,t,n,s){return Ps(this,void 0,void 0,function*(){return pI(e,"HEAD",t,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function vge(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return pI(e,"DELETE",t,s,i,n)})}class btt{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n}then(t,n){return this.execute().then(t,n)}execute(){return Ps(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Tl(t))return{data:null,error:t};throw t}})}}var FIe;class wtt{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n,this[FIe]="BlobDownloadBuilder",this.promise=null}asStream(){return new btt(this.downloadFn,this.shouldThrowOnError)}then(t,n){return this.getPromise().then(t,n)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return Ps(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Tl(t))return{data:null,error:t};throw t}})}}FIe=Symbol.toStringTag;const jtt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Hwe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ktt{constructor(t,n={},s,i){this.shouldThrowOnError=!1,this.url=t,this.headers=n,this.bucketId=s,this.fetch=yge(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,n,s,i){return Ps(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},Hwe),i);let a=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(l.upsert)});const h=l.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h))):(o=s,a["cache-control"]=`max-age=${l.cacheControl}`,a["content-type"]=l.contentType,h&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(h)))),i!=null&&i.headers&&(a=Object.assign(Object.assign({},a),i.headers));const p=this._removeEmptyFolders(n),x=this._getFinalPath(p),y=yield(t=="PUT"?Kue:Gp)(this.fetch,`${this.url}/object/${x}`,o,Object.assign({headers:a},l!=null&&l.duplex?{duplex:l.duplex}:{}));return{data:{path:p,id:y.Id,fullPath:y.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(Tl(o))return{data:null,error:o};throw o}})}upload(t,n,s){return Ps(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,s)})}uploadToSignedUrl(t,n,s,i){return Ps(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(t),l=this._getFinalPath(o),a=new URL(this.url+`/object/upload/sign/${l}`);a.searchParams.set("token",n);try{let h;const p=Object.assign({upsert:Hwe.upsert},i),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(p.upsert)});typeof Blob<"u"&&s instanceof Blob?(h=new FormData,h.append("cacheControl",p.cacheControl),h.append("",s)):typeof FormData<"u"&&s instanceof FormData?(h=s,h.append("cacheControl",p.cacheControl)):(h=s,x["cache-control"]=`max-age=${p.cacheControl}`,x["content-type"]=p.contentType);const y=yield Kue(this.fetch,a.toString(),h,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(h){if(this.shouldThrowOnError)throw h;if(Tl(h))return{data:null,error:h};throw h}})}createSignedUploadUrl(t,n){return Ps(this,void 0,void 0,function*(){try{let s=this._getFinalPath(t);const i=Object.assign({},this.headers);n!=null&&n.upsert&&(i["x-upsert"]="true");const o=yield Gp(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:i}),l=new URL(this.url+o.url),a=l.searchParams.get("token");if(!a)throw new xge("No token returned by API");return{data:{signedUrl:l.toString(),path:t,token:a},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}update(t,n,s){return Ps(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,s)})}move(t,n,s){return Ps(this,void 0,void 0,function*(){try{return{data:yield Gp(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}copy(t,n,s){return Ps(this,void 0,void 0,function*(){try{return{data:{path:(yield Gp(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}createSignedUrl(t,n,s){return Ps(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),o=yield Gp(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:n},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const l=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${l}`)},{data:o,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}createSignedUrls(t,n,s){return Ps(this,void 0,void 0,function*(){try{const i=yield Gp(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:t},{headers:this.headers}),o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:i.map(l=>Object.assign(Object.assign({},l),{signedUrl:l.signedURL?encodeURI(`${this.url}${l.signedURL}${o}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}download(t,n){const i=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),l=o?`?${o}`:"",a=this._getFinalPath(t),h=()=>KA(this.fetch,`${this.url}/${i}/${a}${l}`,{headers:this.headers,noResolveJson:!0});return new wtt(h,this.shouldThrowOnError)}info(t){return Ps(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{const s=yield KA(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Gue(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}exists(t){return Ps(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{return yield _tt(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s)&&s instanceof Wue){const i=s.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:s}}throw s}})}getPublicUrl(t,n){const s=this._getFinalPath(t),i=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&i.push(o);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",h=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});h!==""&&i.push(h);let p=i.join("&");return p!==""&&(p=`?${p}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${s}${p}`)}}}remove(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield vge(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}list(t,n,s){return Ps(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},jtt),n),{prefix:t||""});return{data:yield Gp(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},s),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}listV2(t,n){return Ps(this,void 0,void 0,function*(){try{const s=Object.assign({},t);return{data:yield Gp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}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 n=[];return t.width&&n.push(`width=${t.width}`),t.height&&n.push(`height=${t.height}`),t.resize&&n.push(`resize=${t.resize}`),t.format&&n.push(`format=${t.format}`),t.quality&&n.push(`quality=${t.quality}`),n.join("&")}}const zIe="2.78.0",BIe={"X-Client-Info":`storage-js/${zIe}`};class Ntt{constructor(t,n={},s,i){this.shouldThrowOnError=!1;const o=new URL(t);i!=null&&i.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},BIe),n),this.fetch=yge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return Ps(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(t);return{data:yield KA(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}getBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield KA(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}createBucket(t){return Ps(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield Gp(this.fetch,`${this.url}/bucket`,{id:n,name:n,type:s.type,public:s.public,file_size_limit:s.fileSizeLimit,allowed_mime_types:s.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}updateBucket(t,n){return Ps(this,void 0,void 0,function*(){try{return{data:yield Kue(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}emptyBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Gp(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield vge(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}listBucketOptionsToQueryString(t){const n={};return t&&("limit"in t&&(n.limit=String(t.limit)),"offset"in t&&(n.offset=String(t.offset)),t.search&&(n.search=t.search),t.sortColumn&&(n.sortColumn=t.sortColumn),t.sortOrder&&(n.sortOrder=t.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}}class Stt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},BIe),n),this.fetch=yge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Gp(this.fetch,`${this.url}/bucket`,{name:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}listBuckets(t){return Ps(this,void 0,void 0,function*(){try{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const s=n.toString(),i=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield KA(this.fetch,i,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield vge(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}}const _ge={"X-Client-Info":`storage-js/${zIe}`,"Content-Type":"application/json"};class $Ie extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function $h(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class Ale extends $Ie{constructor(t,n,s){super(t),this.name="StorageVectorsApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Ctt extends $Ie{constructor(t,n){super(t),this.name="StorageVectorsUnknownError",this.originalError=n}}var Wwe;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Wwe||(Wwe={}));const bge=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>tk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},Mtt=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Gwe=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Ttt=(e,t,n)=>Ps(void 0,void 0,void 0,function*(){if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(n!=null&&n.noResolveJson)){const i=e.status||500,o=e;if(typeof o.json=="function")o.json().then(l=>{const a=(l==null?void 0:l.statusCode)||(l==null?void 0:l.code)||i+"";t(new Ale(Gwe(l),i,a))}).catch(()=>{const l=i+"",a=o.statusText||`HTTP ${i} error`;t(new Ale(a,i,l))});else{const l=i+"",a=o.statusText||`HTTP ${i} error`;t(new Ale(a,i,l))}}else t(new Ctt(Gwe(e),e))}),Att=(e,t,n,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return s?(Mtt(s)?(i.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(s)):i.body=s,Object.assign(Object.assign({},i),n)):i};function Ett(e,t,n,s,i,o){return Ps(this,void 0,void 0,function*(){return new Promise((l,a)=>{e(n,Att(t,s,i,o)).then(h=>{if(!h.ok)throw h;if(s!=null&&s.noResolveJson)return h;const p=h.headers.get("content-type");return!p||!p.includes("application/json")?{}:h.json()}).then(h=>l(h)).catch(h=>Ttt(h,a,s))})})}function Uh(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return Ett(e,"POST",t,s,i,n)})}class Itt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},_ge),n),this.fetch=bge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return Ps(this,void 0,void 0,function*(){try{return{data:(yield Uh(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}getIndex(t,n){return Ps(this,void 0,void 0,function*(){try{return{data:yield Uh(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if($h(s))return{data:null,error:s};throw s}})}listIndexes(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Uh(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}deleteIndex(t,n){return Ps(this,void 0,void 0,function*(){try{return{data:(yield Uh(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if($h(s))return{data:null,error:s};throw s}})}}class Ptt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},_ge),n),this.fetch=bge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return Ps(this,void 0,void 0,function*(){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:(yield Uh(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}getVectors(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Uh(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}listVectors(t){return Ps(this,void 0,void 0,function*(){try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(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:yield Uh(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}queryVectors(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Uh(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}deleteVectors(t){return Ps(this,void 0,void 0,function*(){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:(yield Uh(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}}class Ltt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},_ge),n),this.fetch=bge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:(yield Uh(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}getBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Uh(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}listBuckets(){return Ps(this,arguments,void 0,function*(t={}){try{return{data:yield Uh(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:(yield Uh(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if($h(n))return{data:null,error:n};throw n}})}}class Ott extends Ltt{constructor(t,n={}){super(t,n.headers||{},n.fetch)}from(t){return new Dtt(this.url,this.headers,t,this.fetch)}}class Dtt extends Itt{constructor(t,n,s,i){super(t,n,i),this.vectorBucketName=s}createIndex(t){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Ps(this,void 0,void 0,function*(){return n.createIndex.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const t=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Ps(this,arguments,void 0,function*(n={}){return t.listIndexes.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName}))})}getIndex(t){const n=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Ps(this,void 0,void 0,function*(){return n.getIndex.call(this,this.vectorBucketName,t)})}deleteIndex(t){const n=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Ps(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new Rtt(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class Rtt extends Ptt{constructor(t,n,s,i,o){super(t,n,o),this.vectorBucketName=s,this.indexName=i}putVectors(t){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Ps(this,void 0,void 0,function*(){return n.putVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(t){const n=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Ps(this,void 0,void 0,function*(){return n.getVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const t=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Ps(this,arguments,void 0,function*(n={}){return t.listVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(t){const n=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Ps(this,void 0,void 0,function*(){return n.queryVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(t){const n=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Ps(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class Ftt extends Ntt{constructor(t,n={},s,i){super(t,n,s,i)}from(t){return new ktt(this.url,this.headers,t,this.fetch)}get vectors(){return new Ott(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Stt(this.url+"/iceberg",this.headers,this.fetch)}}const ztt="2.78.0";let oT="";typeof Deno<"u"?oT="deno":typeof document<"u"?oT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?oT="react-native":oT="node";const Btt={"X-Client-Info":`supabase-js-${oT}/${ztt}`},$tt={headers:Btt},Utt={schema:"public"},qtt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Vtt={},Htt=e=>{let t;return e?t=e:typeof fetch>"u"?t=gIe:t=fetch,(...n)=>t(...n)},Wtt=()=>typeof Headers>"u"?xIe:Headers,Gtt=(e,t,n)=>{const s=Htt(n),i=Wtt();return async(o,l)=>{var a;const h=(a=await t())!==null&&a!==void 0?a:e;let p=new i(l==null?void 0:l.headers);return p.has("apikey")||p.set("apikey",e),p.has("Authorization")||p.set("Authorization",`Bearer ${h}`),s(o,Object.assign(Object.assign({},l),{headers:p}))}};function Ktt(e){return e.endsWith("/")?e:e+"/"}function Ztt(e,t){var n,s;const{db:i,auth:o,realtime:l,global:a}=e,{db:h,auth:p,realtime:x,global:y}=t,w={db:Object.assign(Object.assign({},h),i),auth:Object.assign(Object.assign({},p),o),realtime:Object.assign(Object.assign({},x),l),storage:{},global:Object.assign(Object.assign(Object.assign({},y),a),{headers:Object.assign(Object.assign({},(n=y==null?void 0:y.headers)!==null&&n!==void 0?n:{}),(s=a==null?void 0:a.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return e.accessToken?w.accessToken=e.accessToken:delete w.accessToken,w}function Ytt(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Ktt(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const UIe="2.78.0",p4=30*1e3,Zue=3,Ele=Zue*p4,Xtt="http://localhost:9999",Qtt="supabase.auth.token",Jtt={"X-Client-Info":`gotrue-js/${UIe}`},Yue="X-Supabase-Api-Version",qIe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},ert=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,trt=10*60*1e3;class ZA extends Error{constructor(t,n,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function Js(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class rrt extends ZA{constructor(t,n,s){super(t,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function nrt(e){return Js(e)&&e.name==="AuthApiError"}class Aw extends ZA{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class ev extends ZA{constructor(t,n,s,i){super(t,s,i),this.name=n,this.status=s}}class Up extends ev{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function srt(e){return Js(e)&&e.name==="AuthSessionMissingError"}class WN extends ev{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class pL extends ev{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class mL extends ev{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function irt(e){return Js(e)&&e.name==="AuthImplicitGrantRedirectError"}class Kwe extends ev{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Xue extends ev{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Ile(e){return Js(e)&&e.name==="AuthRetryableFetchError"}class Zwe extends ev{constructor(t,n,s){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class Que extends ev{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Yee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Ywe=` \r=`.split(""),art=(()=>{const e=new Array(128);for(let t=0;t=6;){const s=t.queue>>t.queuedBits-6&63;n(Yee[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;n(Yee[s]),t.queuedBits-=6}}function VIe(e,t,n){const s=art[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function Qwe(e){const t=[],n=l=>{t.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},o=l=>{crt(l,s,n)};for(let l=0;l>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function lrt(e,t){for(let n=0;n55295&&s<=56319){const i=(s-55296)*1024&65535;s=(e.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}ort(s,t)}}function crt(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let s=1;s<6;s+=1)if(!(e>>7-s&1)){t.utf8seq=s;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function wS(e){const t=[],n={queue:0,queuedBits:0},s=i=>{t.push(i)};for(let i=0;it.push(n)),new Uint8Array(t)}function Rw(e){const t=[],n={queue:0,queuedBits:0},s=i=>{t.push(i)};return e.forEach(i=>Xwe(i,n,s)),Xwe(null,n,s),t.join("")}function urt(e){return Math.round(Date.now()/1e3)+e}function hrt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const mu=()=>typeof window<"u"&&typeof document<"u",r_={tested:!1,writable:!1},HIe=()=>{if(!mu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(r_.tested)return r_.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),r_.tested=!0,r_.writable=!0}catch{r_.tested=!0,r_.writable=!1}return r_.writable};function frt(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,o)=>{t[o]=i})}catch{}return n.searchParams.forEach((s,i)=>{t[i]=s}),t}const WIe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>s3(async()=>{const{default:s}=await Promise.resolve().then(()=>tk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},prt=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",m4=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},n_=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},n0=async(e,t)=>{await e.removeItem(t)};class zne{constructor(){this.promise=new zne.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}zne.promiseConstructor=Promise;function Ple(e){const t=e.split(".");if(t.length!==3)throw new Que("Invalid JWT structure");for(let s=0;s{setTimeout(()=>t(null),e)})}function grt(e,t){return new Promise((s,i)=>{(async()=>{for(let o=0;o<1/0;o++)try{const l=await e(o);if(!t(o,null,l)){s(l);return}}catch(l){if(!t(o,l)){i(l);return}}})()})}function xrt(e){return("0"+e.toString(16)).substr(-2)}function yrt(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let i="";for(let o=0;o<56;o++)i+=n.charAt(Math.floor(Math.random()*s));return i}return crypto.getRandomValues(t),Array.from(t,xrt).join("")}async function vrt(e){const n=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(s);return Array.from(i).map(o=>String.fromCharCode(o)).join("")}async function _rt(e){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."),e;const n=await vrt(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function GN(e,t,n=!1){const s=yrt();let i=s;n&&(i+="/PASSWORD_RECOVERY"),await m4(e,`${t}-code-verifier`,i);const o=await _rt(s);return[o,s===o?"plain":"s256"]}const brt=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function wrt(e){const t=e.headers.get(Yue);if(!t||!t.match(brt))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function jrt(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function krt(e){switch(e){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 Nrt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function KN(e){if(!Nrt.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Lle(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Srt(e,t){return new Proxy(e,{get:(n,s,i)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const o=s.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,s,i)}return!t.value&&typeof s=="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."),t.value=!0),Reflect.get(n,s,i)}})}function Jwe(e){return JSON.parse(JSON.stringify(e))}const kw=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Crt=[502,503,504];async function eje(e){var t;if(!prt(e))throw new Xue(kw(e),0);if(Crt.includes(e.status))throw new Xue(kw(e),e.status);let n;try{n=await e.json()}catch(o){throw new Aw(kw(o),o)}let s;const i=wrt(e);if(i&&i.getTime()>=qIe["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?s=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(s=n.error_code),s){if(s==="weak_password")throw new Zwe(kw(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new Up}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,l)=>o&&typeof l=="string",!0))throw new Zwe(kw(n),e.status,n.weak_password.reasons);throw new rrt(kw(n),e.status||500,s)}const Mrt=(e,t,n,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),n))};async function Si(e,t,n,s){var i;const o=Object.assign({},s==null?void 0:s.headers);o[Yue]||(o[Yue]=qIe["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const l=(i=s==null?void 0:s.query)!==null&&i!==void 0?i:{};s!=null&&s.redirectTo&&(l.redirect_to=s.redirectTo);const a=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",h=await Trt(e,t,n+a,{headers:o,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(h):{data:Object.assign({},h),error:null}}async function Trt(e,t,n,s,i,o){const l=Mrt(t,s,i,o);let a;try{a=await e(n,Object.assign({},l))}catch(h){throw console.error(h),new Xue(kw(h),0)}if(a.ok||await eje(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(h){await eje(h)}}function qp(e){var t;let n=null;Irt(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=urt(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:s},error:null}}function tje(e){const t=qp(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,s)=>n&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function N0(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Art(e){return{data:e,error:null}}function Ert(e){const{action_link:t,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o}=e,l=J1(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o},h=Object.assign({},l);return{data:{properties:a,user:h},error:null}}function rje(e){return e}function Irt(e){return e.access_token&&e.refresh_token&&e.expires_in}const Ole=["global","local","others"];class Prt{constructor({url:t="",headers:n={},fetch:s}){this.url=t,this.headers=n,this.fetch=WIe(s),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)}}async signOut(t,n=Ole[0]){if(Ole.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ole.join(", ")}`);try{return await Si(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,n={}){try{return await Si(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:N0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:n}=t,s=J1(t,["options"]),i=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(i.new_email=s==null?void 0:s.newEmail,delete i.newEmail),await Si(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:Ert,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Js(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Si(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:N0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,s,i,o,l,a,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Si(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:rje});if(x.error)throw x.error;const y=await x.json(),w=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(a=x.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(S=>{const C=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(S.split(";")[1].split("=")[1]);p[`${A}Page`]=C}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{users:[]},error:p};throw p}}async getUserById(t){KN(t);try{return await Si(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:N0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){KN(t);try{return await Si(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:N0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,n=!1){KN(t);try{return await Si(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:N0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){KN(t.userId);try{const{data:n,error:s}=await Si(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:s}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _deleteFactor(t){KN(t.userId),KN(t.id);try{return{data:await Si(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,s,i,o,l,a,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Si(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:rje});if(x.error)throw x.error;const y=await x.json(),w=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(a=x.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(S=>{const C=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(S.split(";")[1].split("=")[1]);p[`${A}Page`]=C}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(t){try{return await Si(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Si(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Si(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{return await Si(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Si(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}}function nje(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const ZN={debug:!!(globalThis&&HIe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class GIe extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class Lrt extends GIe{}async function Ort(e,t,n){ZN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;return t>0&&setTimeout(()=>{s.abort(),ZN.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async i=>{if(i){ZN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{ZN.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw ZN.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new Lrt(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(ZN.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 n()}}))}function Drt(){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 KIe(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Rrt(e){return parseInt(e,16)}function Frt(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function zrt(e){var t;const{chainId:n,domain:s,expirationTime:i,issuedAt:o=new Date,nonce:l,notBefore:a,requestId:h,resources:p,scheme:x,uri:y,version:w}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(l&&l.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${l}`);if(!y)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const j=KIe(e.address),S=x?`${x}://${s}`:s,C=e.statement?`${e.statement} `:"",A=`${S} wants you to sign in with your Ethereum account: ${j} ${C}`;let E=`URI: ${y} Version: ${w} Chain ID: ${n}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(i&&(E+=` Expiration Time: ${i.toISOString()}`),a&&(E+=` Not Before: ${a.toISOString()}`),h&&(E+=` Request ID: ${h}`),p){let T=` Resources:`;for(const O of p){if(!O||typeof O!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${O}`);T+=` - ${O}`}E+=T}return`${A} ${E}`}class bc extends Error{constructor({message:t,code:n,cause:s,name:i}){var o;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(o=i??(s instanceof Error?s.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class Xee extends bc{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Brt({error:e,options:t}){var n,s,i;const{publicKey:o}=t;if(!o)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new bc({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new bc({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new bc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((i=o.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new bc({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new bc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new bc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new bc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new bc({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const l=window.location.hostname;if(ZIe(l)){if(o.rp.id!==l)return new bc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new bc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new bc({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new bc({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new bc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function $rt({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new bc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new bc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(ZIe(s)){if(n.rpId!==s)return new bc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new bc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new bc({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new bc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Urt{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const qrt=new Urt;function Vrt(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:s}=e,i=J1(e,["challenge","user","excludeCredentials"]),o=wS(t).buffer,l=Object.assign(Object.assign({},n),{id:wS(n.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:o,user:l});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let h=0;h0){o.allowCredentials=new Array(n.length);for(let l=0;li!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),s={};for(const i of e)if(i)for(const o in i){const l=i[o];if(l!==void 0)if(Array.isArray(l))s[o]=l;else if(n(l))s[o]=l;else if(t(l)){const a=s[o];t(a)?s[o]=Qee(a,l):s[o]=Qee(l)}else s[o]=l}return s}function Qrt(e,t){return Qee(Yrt,e,t||{})}function Jrt(e,t){return Qee(Xrt,e,t||{})}class ent{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:s,signal:i},o){try{const{data:l,error:a}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:a};const h=i??qrt.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:p}=l.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${s}`),p.displayName||(p.displayName=p.name)}switch(l.webauthn.type){case"create":{const p=Qrt(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Krt({publicKey:p,signal:h});return x?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}case"request":{const p=Jrt(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Zrt(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:p,signal:h}));return x?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Aw("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:n,webauthn:s}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:s})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i}},o){if(!n)return{data:null,error:new ZA("rpId is required for WebAuthn authentication")};try{if(!sje())return{data:null,error:new Aw("Browser does not support WebAuthn",null)};const{data:l,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:s},signal:i},{request:o});if(!l)return{data:null,error:a};const{webauthn:h}=l;return this._verify({factorId:t,challengeId:l.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:s,credential_response:h.credential_response}})}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Aw("Unexpected error in authenticate",l)}}}async _register({friendlyName:t,rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i},o){if(!n)return{data:null,error:new ZA("rpId is required for WebAuthn registration")};try{if(!sje())return{data:null,error:new Aw("Browser does not support WebAuthn",null)};const{data:l,error:a}=await this._enroll({friendlyName:t});if(!l)return await this.client.mfa.listFactors().then(x=>{var y;return(y=x.data)===null||y===void 0?void 0:y.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===t&&w.status!=="unverified")}).then(x=>x?this.client.mfa.unenroll({factorId:x==null?void 0:x.id}):void 0),{data:null,error:a};const{data:h,error:p}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:i},{create:o});return h?this._verify({factorId:l.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:s,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:p}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Aw("Unexpected error in register",l)}}}}Drt();const tnt={url:Xtt,storageKey:Qtt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Jtt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function ije(e,t,n){return await n()}const YN={};class YA{get jwks(){var t,n;return(n=(t=YN[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){YN[this.storageKey]=Object.assign(Object.assign({},YN[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=YN[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){YN[this.storageKey]=Object.assign(Object.assign({},YN[this.storageKey]),{cachedAt:t})}constructor(t){var 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,this.instanceID=YA.nextInstanceID,YA.nextInstanceID+=1,this.instanceID>0&&mu()&&console.warn("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.");const i=Object.assign(Object.assign({},tnt),t);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new Prt({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=WIe(i.fetch),this.lock=i.lock||ije,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:mu()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Ort:this.lock=ije,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 ent(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:HIe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=nje(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=nje(this.memoryStorage)),mu()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${UIe}) ${new Date().toISOString()}`,...t),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 t;try{const n=frt(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),mu()&&this.detectSessionInUrl&&s!=="none"){const{data:i,error:o}=await this._getSessionFromURL(n,s);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),irt(o)){const h=(t=o.details)===null||t===void 0?void 0:t.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:l,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",l,"redirect type",a),await this._saveSession(l),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",l):await this._notifyAllSubscribers("SIGNED_IN",l)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Js(n)?{error:n}:{error:new Aw("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,s,i;try{const o=await Si(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(i=t==null?void 0:t.options)===null||i===void 0?void 0:i.captchaToken}},xform:qp}),{data:l,error:a}=o;if(a||!l)return{data:{user:null,session:null},error:a};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(t){var n,s,i;try{let o;if("email"in t){const{email:x,password:y,options:w}=t;let j=null,S=null;this.flowType==="pkce"&&([j,S]=await GN(this.storage,this.storageKey)),o=await Si(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w==null?void 0:w.emailRedirectTo,body:{email:x,password:y,data:(n=w==null?void 0:w.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken},code_challenge:j,code_challenge_method:S},xform:qp})}else if("phone"in t){const{phone:x,password:y,options:w}=t;o=await Si(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:y,data:(s=w==null?void 0:w.data)!==null&&s!==void 0?s:{},channel:(i=w==null?void 0:w.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken}},xform:qp})}else throw new pL("You must provide either an email or phone number and a password");const{data:l,error:a}=o;if(a||!l)return{data:{user:null,session:null},error:a};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(t){try{let n;if("email"in t){const{email:o,password:l,options:a}=t;n=await Si(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:l,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:tje})}else if("phone"in t){const{phone:o,password:l,options:a}=t;n=await Si(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:l,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:tje})}else throw new pL("You must provide either an email or phone number and a password");const{data:s,error:i}=n;return i?{data:{user:null,session:null},error:i}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new WN}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:i})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,s,i,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.scopes,queryParams:(i=t.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,s,i,o,l,a,h,p,x,y,w;let j,S;if("message"in t)j=t.message,S=t.signature;else{const{chain:C,wallet:A,statement:E,options:T}=t;let O;if(mu())if(typeof A=="object")O=A;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")O=Z.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 A!="object"||!(T!=null&&T.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=A}const z=new URL((n=T==null?void 0:T.url)!==null&&n!==void 0?n:window.location.href),F=await O.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const q=KIe(F[0]);let H=(s=T==null?void 0:T.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!H){const Z=await O.request({method:"eth_chainId"});H=Rrt(Z)}const K={domain:z.host,address:q,statement:E,uri:z.href,version:"1",chainId:H,nonce:(i=T==null?void 0:T.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(l=(o=T==null?void 0:T.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(a=T==null?void 0:T.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(h=T==null?void 0:T.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(p=T==null?void 0:T.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(x=T==null?void 0:T.signInWithEthereum)===null||x===void 0?void 0:x.resources};j=zrt(K),S=await O.request({method:"personal_sign",params:[Frt(j),q]})}try{const{data:C,error:A}=await Si(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:j,signature:S},!((y=t.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(w=t.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:qp});if(A)throw A;return!C||!C.session||!C.user?{data:{user:null,session:null},error:new WN}:(C.session&&(await this._saveSession(C.session),await this._notifyAllSubscribers("SIGNED_IN",C.session)),{data:Object.assign({},C),error:A})}catch(C){if(Js(C))return{data:{user:null,session:null},error:C};throw C}}async signInWithSolana(t){var n,s,i,o,l,a,h,p,x,y,w,j;let S,C;if("message"in t)S=t.message,C=t.signature;else{const{chain:A,wallet:E,statement:T,options:O}=t;let z;if(mu())if(typeof E=="object")z=E;else{const q=window;if("solana"in q&&typeof q.solana=="object"&&("signIn"in q.solana&&typeof q.solana.signIn=="function"||"signMessage"in q.solana&&typeof q.solana.signMessage=="function"))z=q.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 E!="object"||!(O!=null&&O.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");z=E}const F=new URL((n=O==null?void 0:O.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in z&&z.signIn){const q=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},O==null?void 0:O.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),T?{statement:T}:null));let H;if(Array.isArray(q)&&q[0]&&typeof q[0]=="object")H=q[0];else if(q&&typeof q=="object"&&"signedMessage"in q&&"signature"in q)H=q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in H&&"signature"in H&&(typeof H.signedMessage=="string"||H.signedMessage instanceof Uint8Array)&&H.signature instanceof Uint8Array)S=typeof H.signedMessage=="string"?H.signedMessage:new TextDecoder().decode(H.signedMessage),C=H.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in z)||typeof z.signMessage!="function"||!("publicKey"in z)||typeof z!="object"||!z.publicKey||!("toBase58"in z.publicKey)||typeof z.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");S=[`${F.host} wants you to sign in with your Solana account:`,z.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(i=(s=O==null?void 0:O.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((o=O==null?void 0:O.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${O.signInWithSolana.notBefore}`]:[],...!((l=O==null?void 0:O.signInWithSolana)===null||l===void 0)&&l.expirationTime?[`Expiration Time: ${O.signInWithSolana.expirationTime}`]:[],...!((a=O==null?void 0:O.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${O.signInWithSolana.chainId}`]:[],...!((h=O==null?void 0:O.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${O.signInWithSolana.nonce}`]:[],...!((p=O==null?void 0:O.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${O.signInWithSolana.requestId}`]:[],...!((y=(x=O==null?void 0:O.signInWithSolana)===null||x===void 0?void 0:x.resources)===null||y===void 0)&&y.length?["Resources",...O.signInWithSolana.resources.map(H=>`- ${H}`)]:[]].join(` `);const q=await z.signMessage(new TextEncoder().encode(S),"utf8");if(!q||!(q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");C=q}}try{const{data:A,error:E}=await Si(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:S,signature:Rw(C)},!((w=t.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(j=t.options)===null||j===void 0?void 0:j.captchaToken}}:null),xform:qp});if(E)throw E;return!A||!A.session||!A.user?{data:{user:null,session:null},error:new WN}:(A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),{data:Object.assign({},A),error:E})}catch(A){if(Js(A))return{data:{user:null,session:null},error:A};throw A}}async _exchangeCodeForSession(t){const n=await n_(this.storage,`${this.storageKey}-code-verifier`),[s,i]=(n??"").split("/");try{const{data:o,error:l}=await Si(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:qp});if(await n0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new WN}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:i??null}),error:l})}catch(o){if(Js(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(t){try{const{options:n,provider:s,token:i,access_token:o,nonce:l}=t,a=await Si(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:i,access_token:o,nonce:l,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:qp}),{data:h,error:p}=a;return p?{data:{user:null,session:null},error:p}:!h||!h.session||!h.user?{data:{user:null,session:null},error:new WN}:(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),{data:h,error:p})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,s,i,o,l;try{if("email"in t){const{email:a,options:h}=t;let p=null,x=null;this.flowType==="pkce"&&([p,x]=await GN(this.storage,this.storageKey));const{error:y}=await Si(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},create_user:(s=h==null?void 0:h.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:x},redirectTo:h==null?void 0:h.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in t){const{phone:a,options:h}=t,{data:p,error:x}=await Si(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=h==null?void 0:h.data)!==null&&i!==void 0?i:{},create_user:(o=h==null?void 0:h.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},channel:(l=h==null?void 0:h.channel)!==null&&l!==void 0?l:"sms"}});return{data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:x}}throw new pL("You must provide either an email or phone number.")}catch(a){if(Js(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(t){var n,s;try{let i,o;"options"in t&&(i=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:l,error:a}=await Si(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:i,xform:qp});if(a)throw a;if(!l)throw new Error("An error occurred on token verification.");const h=l.session,p=l.user;return h!=null&&h.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(i){if(Js(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(t){var n,s,i;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await GN(this.storage,this.storageKey)),await Si(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s:void 0}),!((i=t==null?void 0:t.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:Art})}catch(o){if(Js(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:s}=t;if(s)throw s;if(!n)throw new Up;const{error:i}=await Si(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:i}})}catch(t){if(Js(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:s,type:i,options:o}=t,{error:l}=await Si(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:l}}else if("phone"in t){const{phone:s,type:i,options:o}=t,{data:l,error:a}=await Si(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:l==null?void 0:l.message_id},error:a}}throw new pL("You must provide either an email or phone number and a type")}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=n();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}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 t=null;const n=await n_(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(t){try{return t?await Si(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:N0}):await this._useSession(async n=>{var s,i,o;const{data:l,error:a}=n;if(a)throw a;return!(!((s=l.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Up}:await Si(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(i=l.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0,xform:N0})})}catch(n){if(Js(n))return srt(n)&&(await this._removeSession(),await n0(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async s=>{const{data:i,error:o}=s;if(o)throw o;if(!i.session)throw new Up;const l=i.session;let a=null,h=null;this.flowType==="pkce"&&t.email!=null&&([a,h]=await GN(this.storage,this.storageKey));const{data:p,error:x}=await Si(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:h}),jwt:l.access_token,xform:N0});if(x)throw x;return l.user=p.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),{data:{user:l.user},error:null}})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Up;const n=Date.now()/1e3;let s=n,i=!0,o=null;const{payload:l}=Ple(t.access_token);if(l.exp&&(s=l.exp,i=s<=n),i){const{data:a,error:h}=await this._callRefreshToken(t.refresh_token);if(h)return{data:{user:null,session:null},error:h};if(!a)return{data:{user:null,session:null},error:null};o=a}else{const{data:a,error:h}=await this._getUser(t.access_token);if(h)throw h;o={access_token:t.access_token,refresh_token:t.refresh_token,user:a.user,token_type:"bearer",expires_in:s-n,expires_at:s},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(Js(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var s;if(!t){const{data:l,error:a}=n;if(a)throw a;t=(s=l.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new Up;const{data:i,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{user:null,session:null},error:o}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t,n){try{if(!mu())throw new mL("No browser detected.");if(t.error||t.error_description||t.error_code)throw new mL(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Kwe("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new mL("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new Kwe("No code detected.");const{data:T,error:O}=await this._exchangeCodeForSession(t.code);if(O)throw O;const z=new URL(window.location.href);return z.searchParams.delete("code"),window.history.replaceState(window.history.state,"",z.toString()),{data:{session:T.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:l,expires_in:a,expires_at:h,token_type:p}=t;if(!o||!a||!l||!p)throw new mL("No session defined in URL");const x=Math.round(Date.now()/1e3),y=parseInt(a);let w=x+y;h&&(w=parseInt(h));const j=w-x;j*1e3<=p4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${j}s, should have been closer to ${y}s`);const S=w-y;x-S>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",S,w,x):x-S<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",S,w,x);const{data:C,error:A}=await this._getUser(o);if(A)throw A;const E={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:y,expires_at:w,refresh_token:l,token_type:p,user:C.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:E,redirectType:t.type},error:null}}catch(s){if(Js(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(t){return!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await n_(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{error:o};const l=(s=i.session)===null||s===void 0?void 0:s.access_token;if(l){const{error:a}=await this.admin.signOut(l,t);if(a&&!(nrt(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return t!=="others"&&(await this._removeSession(),await n0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(t){const n=hrt(),s={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:s}}}async _emitInitialSession(t){return await this._useSession(async n=>{var s,i;try{const{data:{session:o},error:l}=n;if(l)throw l;await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let s=null,i=null;this.flowType==="pkce"&&([s,i]=await GN(this.storage,this.storageKey,!0));try{return await Si(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(Js(o))return{data:null,error:o};throw o}}async getUserIdentities(){var t;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:s,error:i}=await this._useSession(async o=>{var l,a,h,p,x;const{data:y,error:w}=o;if(w)throw w;const j=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(l=t.options)===null||l===void 0?void 0:l.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(h=t.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await Si(this.fetch,"GET",j,{headers:this.headers,jwt:(x=(p=y.session)===null||p===void 0?void 0:p.access_token)!==null&&x!==void 0?x:void 0})});if(i)throw i;return mu()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:t.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(Js(s))return{data:{provider:t.provider,url:null},error:s};throw s}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var s;try{const{error:i,data:{session:o}}=n;if(i)throw i;const{options:l,provider:a,token:h,access_token:p,nonce:x}=t,y=await Si(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=o==null?void 0:o.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:h,access_token:p,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:qp}),{data:w,error:j}=y;return j?{data:{user:null,session:null},error:j}:!w||!w.session||!w.user?{data:{user:null,session:null},error:new WN}:(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),{data:w,error:j})}catch(i){if(Js(i))return{data:{user:null,session:null},error:i};throw i}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var s,i;const{data:o,error:l}=n;if(l)throw l;return await Si(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await grt(async i=>(i>0&&await mrt(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await Si(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:qp})),(i,o)=>{const l=200*Math.pow(2,i);return o&&Ile(o)&&Date.now()+l-s{try{await a.callback(t,n)}catch(h){o.push(h)}});if(await Promise.all(l),o.length>0){for(let a=0;athis._autoRefreshTokenTick(),p4);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}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 t=Date.now();try{return await this._useSession(async n=>{const{data:{session:s}}=n;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((s.expires_at*1e3-t)/p4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${p4}ms, refresh threshold is ${Zue} ticks`),i<=Zue&&await this._callRefreshToken(s.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof GIe)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!mu()||!(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(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"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(t,n,s){const i=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&i.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&i.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[o,l]=await GN(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(l)}`});i.push(a.toString())}if(s!=null&&s.queryParams){const o=new URLSearchParams(s.queryParams);i.push(o.toString())}return s!=null&&s.skipBrowserRedirect&&i.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${i.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;return o?{data:null,error:o}:await Si(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _enroll(t){try{return await this._useSession(async n=>{var s,i;const{data:o,error:l}=n;if(l)return{data:null,error:l};const a=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:h,error:p}=await Si(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return p?{data:null,error:p}:(t.factorType==="totp"&&h.type==="totp"&&(!((i=h==null?void 0:h.totp)===null||i===void 0)&&i.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),{data:h,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const l=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Wrt(t.webauthn.credential_response):Grt(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:h}=await Si(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return h?{data:null,error:h}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:h})})}catch(n){if(Js(n))return{data:null,error:n};throw n}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const l=await Si(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:a}=l;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Vrt(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Hrt(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Js(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(t){const{data:n,error:s}=await this._challenge({factorId:t.factorId});return s?{data:null,error:s}:await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:s}=await this.getUser();if(s)return{data:null,error:s};const i={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])i.all.push(o),o.status==="verified"&&i[o.factor_type].push(o);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:s},error:i}=await this.getSession();if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ple(s.access_token);let l=null;o.aal&&(l=o.aal);let a=l;((n=(t=s.user.factors)===null||t===void 0?void 0:t.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(a="aal2");const p=o.amr||[];return{data:{currentLevel:l,nextLevel:a,currentAuthenticationMethods:p},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;return i?{data:null,error:i}:s?await Si(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new Up}})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Up};const l=await Si(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return l.data&&l.data.redirect_url&&mu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _denyAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Up};const l=await Si(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return l.data&&l.data.redirect_url&&mu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async fetchJwk(t,n={keys:[]}){let s=n.keys.find(a=>a.kid===t);if(s)return s;const i=Date.now();if(s=this.jwks.keys.find(a=>a.kid===t),s&&this.jwks_cached_at+trt>i)return s;const{data:o,error:l}=await Si(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(l)throw l;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=i,s=o.keys.find(a=>a.kid===t),!s)?null:s}async getClaims(t,n={}){try{let s=t;if(!s){const{data:j,error:S}=await this.getSession();if(S||!j.session)return{data:null,error:S};s=j.session.access_token}const{header:i,payload:o,signature:l,raw:{header:a,payload:h}}=Ple(s);n!=null&&n.allowExpired||jrt(o.exp);const p=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!p){const{error:j}=await this.getUser(s);if(j)throw j;return{data:{claims:o,header:i,signature:l},error:null}}const x=krt(i.alg),y=await crypto.subtle.importKey("jwk",p,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,drt(`${a}.${h}`)))throw new Que("Invalid JWT signature");return{data:{claims:o,header:i,signature:l},error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}}YA.nextInstanceID=0;const rnt=YA;class nnt extends rnt{constructor(t){super(t)}}class snt{constructor(t,n,s){var i,o,l;this.supabaseUrl=t,this.supabaseKey=n;const a=Ytt(t);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const h=`sb-${a.hostname.split(".")[0]}-auth-token`,p={db:Utt,realtime:Vtt,auth:Object.assign(Object.assign({},qtt),{storageKey:h}),global:$tt},x=Ztt(s??{},p);this.storageKey=(i=x.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=x.global.headers)!==null&&o!==void 0?o:{},x.accessToken?(this.accessToken=x.accessToken,this.auth=new Proxy({},{get:(y,w)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(w)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((l=x.auth)!==null&&l!==void 0?l:{},this.headers,x.global.fetch),this.fetch=Gtt(n,this._getAccessToken.bind(this),x.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},x.realtime)),this.rest=new Xet(new URL("rest/v1",a).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new Ftt(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new qet(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,n={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,n,s)}channel(t,n={config:{}}){return this.realtime.channel(t,n)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t,n;if(this.accessToken)return await this.accessToken();const{data:s}=await this.auth.getSession();return(n=(t=s.session)===null||t===void 0?void 0:t.access_token)!==null&&n!==void 0?n:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,storageKey:l,flowType:a,lock:h,debug:p},x,y){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new nnt({url:this.authUrl.href,headers:Object.assign(Object.assign({},w),x),storageKey:l,autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,flowType:a,lock:h,debug:p,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(j=>j.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new ptt(this.realtimeUrl.href,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,s)=>{this._handleTokenChanged(n,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(t,n,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const int=(e,t,n)=>new snt(e,t,n);function ant(){if(typeof window<"u"||typeof process>"u")return!1;const e=process.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}ant()&&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 Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const ont="https://relzejiswnotikjgvjhz.supabase.co",lnt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",ee=int(ont,lnt,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),YIe=P.createContext(void 0),cnt=({children:e})=>{const[t,n]=P.useState(null),[s,i]=P.useState(null),[o,l]=P.useState(!0),[a,h]=P.useState(!1),[p,x]=P.useState(!1),[y,w]=P.useState(null),[j,S]=P.useState([]),[C,A]=P.useState(null),E=ns(),T=async q=>{try{console.log("Checking roles via RPC for user:",q);const[{data:H,error:K},{data:Z,error:re}]=await Promise.all([ee.rpc("has_role",{_user_id:q,_role:"admin"}),ee.rpc("has_role",{_user_id:q,_role:"brokerage_manager"})]);if(K||re)console.error("Role RPC errors:",{isAdminError:K,isBrokerError:re}),h(!1),x(!1);else{const be=!!H,ne=!!Z;console.log("RPC roles result:",{adminValue:be,brokerValue:ne}),h(be),x(ne)}const{data:ue,error:he}=await ee.from("profiles").select("brokerage_id").eq("id",q).single();if(w(!he&&ue?ue.brokerage_id:null),Z){console.log("Fetching managed brokerages for user:",q);const{data:be,error:ne}=await ee.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",q);if(console.log("Managed brokerage assignments result:",{assignments:be,assignmentsError:ne}),ne||!be){console.error("Error fetching managed brokerage assignments:",ne),S([]);return}const ye=Array.from(new Set(be.map(_e=>_e.brokerage_id).filter(Boolean)));if(ye.length===0){S([]);return}const{data:ie,error:fe}=await ee.from("brokerages").select("id, name").in("id",ye);if(console.log("Managed brokerages details result:",{brokeragesData:ie,brokeragesError:fe}),fe||!ie){console.error("Error fetching managed brokerages details:",fe),S([]);return}const de=ie.map(_e=>({id:_e.id,name:_e.name})).sort((_e,Ee)=>ye.indexOf(_e.id)-ye.indexOf(Ee.id));console.log("Parsed managed brokerages:",de),S(de),de.length>0&&!C&&A(de[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),S([])}catch(H){console.error("Unexpected error in checkRoles:",H),h(!1),x(!1),w(null),S([])}};P.useEffect(()=>{const{data:{subscription:q}}=ee.auth.onAuthStateChange((H,K)=>{console.log("Auth event:",H),i(K),n((K==null?void 0:K.user)??null),H==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{E("/profile?reset=true")},100)),K!=null&&K.user?setTimeout(()=>{T(K.user.id)},0):(h(!1),x(!1),w(null),S([]),A(null))});return ee.auth.getSession().then(({data:{session:H}})=>{i(H),n((H==null?void 0:H.user)??null),H!=null&&H.user?T(H.user.id).finally(()=>{l(!1)}):l(!1)}),()=>q.unsubscribe()},[]);const O=async(q,H)=>{const{error:K}=await ee.auth.signInWithPassword({email:q,password:H});if(K)throw ze.error(K.message),K;ze.success("Welcome back!"),E("/dashboard")},z=async(q,H,K)=>{const Z=`${window.location.origin}/dashboard`,{error:re}=await ee.auth.signUp({email:q,password:H,options:{emailRedirectTo:Z,data:{name:K}}});if(re)throw ze.error(re.message),re;ze.success("Account created! Welcome to LevelUp."),E("/dashboard")},F=async()=>{try{const{data:{session:q}}=await ee.auth.getSession();if(q){const{error:H}=await ee.auth.signOut();H?H.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",H.message):(console.error("Sign out error:",H),ze.error(H.message)):ze.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),i(null),h(!1),x(!1),w(null),S([]),A(null),E("/auth")}catch(q){console.error("Unexpected sign out error:",q),E("/auth")}};return r.jsx(YIe.Provider,{value:{user:t,session:s,loading:o,signIn:O,signUp:z,signOut:F,isAdmin:a,isBrokerageManager:p,brokerageId:y,managedBrokerages:j,selectedBrokerageId:C,setSelectedBrokerageId:A},children:e})},zr=()=>{const e=P.useContext(YIe);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},XIe=P.createContext(void 0),XN="levelup_admin_session",s_="levelup_impersonation",dnt=({children:e})=>{const[t,n]=P.useState(!1),[s,i]=P.useState(null),[o,l]=P.useState(!1);P.useEffect(()=>{const p=sessionStorage.getItem(s_);if(p)try{const x=JSON.parse(p);n(!0),i(x)}catch{sessionStorage.removeItem(s_)}},[]);const a=async p=>{l(!0);try{const{data:{session:x}}=await ee.auth.getSession();if(!x)return ze.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(XN,JSON.stringify(y));const w=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x.access_token}`},body:JSON.stringify({targetUserId:p})}),j=await w.json();if(!w.ok)throw new Error(j.error||"Failed to impersonate user");const S={id:j.targetUser.id,name:j.targetUser.name,email:j.targetUser.email};sessionStorage.setItem(s_,JSON.stringify(S));const{error:C}=await ee.auth.verifyOtp({token_hash:j.token_hash,type:"magiclink"});if(C)throw console.error("Verify OTP error:",C),sessionStorage.removeItem(XN),sessionStorage.removeItem(s_),new Error("Failed to establish impersonation session");return n(!0),i(S),ze.success(`Now viewing as ${S.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),ze.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(XN),sessionStorage.removeItem(s_),!1}finally{l(!1)}},h=async()=>{l(!0);try{const p=sessionStorage.getItem(XN);if(!p){await ee.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(p);await ee.auth.signOut();const{error:y}=await ee.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(XN),sessionStorage.removeItem(s_),y){console.error("Failed to restore admin session:",y),ze.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),i(null),ze.success("Returned to admin account"),window.location.href="/admin/members"}catch(p){console.error("Stop impersonation error:",p),ze.error("Failed to restore admin session"),sessionStorage.removeItem(XN),sessionStorage.removeItem(s_),window.location.href="/auth"}finally{l(!1)}};return r.jsx(XIe.Provider,{value:{isImpersonating:t,impersonatedUser:s,startImpersonation:a,stopImpersonation:h,isLoading:o},children:e})},QIe=()=>{const e=P.useContext(XIe);if(e===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return e},XA=YC("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full 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-full px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),J=P.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...i},o)=>{const l=s?$me:"button";return r.jsx(l,{className:$t(XA({variant:t,size:n,className:e})),ref:o,...i})});J.displayName="Button";const unt=()=>{const{isImpersonating:e,impersonatedUser:t,stopImpersonation:n,isLoading:s}=QIe();return!e||!t?null:r.jsx("div",{className:"fixed top-0 left-0 right-0 z-[100] bg-amber-500 text-amber-950 px-4 py-2 shadow-lg",children:r.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(zh,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("span",{className:"font-medium text-sm md:text-base",children:[r.jsx("span",{className:"hidden sm:inline",children:"You are viewing as "}),r.jsx("strong",{children:t.name}),r.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",t.email,")"]})]})]}),r.jsx(J,{size:"sm",variant:"secondary",onClick:n,disabled:s,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:s?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(Ts,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Exit Impersonation"}),r.jsx("span",{className:"sm:hidden",children:"Exit"})]})})]})})},Sn=({children:e,requireAdmin:t=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:i,isAdmin:o,isBrokerageManager:l}=zr();return i?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):s?t&&!o?r.jsx(tee,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(tee,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:e}):r.jsx(tee,{to:"/auth",replace:!0})};var wge={};(function e(t,n,s,i){var o=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),l=typeof Path2D=="function"&&typeof DOMMatrix=="function",a=function(){if(!t.OffscreenCanvas)return!1;try{var Ee=new OffscreenCanvas(1,1),ke=Ee.getContext("2d");ke.fillRect(0,0,1,1);var pe=Ee.transferToImageBitmap();ke.createPattern(pe,"no-repeat")}catch{return!1}return!0}();function h(){}function p(Ee){var ke=n.exports.Promise,pe=ke!==void 0?ke:t.Promise;return typeof pe=="function"?new pe(Ee):(Ee(h,h),null)}var x=function(Ee,ke){return{transform:function(pe){if(Ee)return pe;if(ke.has(pe))return ke.get(pe);var ae=new OffscreenCanvas(pe.width,pe.height),ge=ae.getContext("2d");return ge.drawImage(pe,0,0),ke.set(pe,ae),ae},clear:function(){ke.clear()}}}(a,new Map),y=function(){var Ee=Math.floor(16.666666666666668),ke,pe,ae={},ge=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(ke=function(Me){var Ue=Math.random();return ae[Ue]=requestAnimationFrame(function Ie(Ke){ge===Ke||ge+Ee-1{const{data:t,error:n}=await ee.from("celebration_queue").select("*").eq("user_id",e.id).is("seen_at",null).order("created_at",{ascending:!0});if(n)throw n;return t},enabled:!!(e!=null&&e.id),refetchOnWindowFocus:!0,staleTime:0})}function fnt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}function pnt(){const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("celebration_queue").insert({user_id:n.user_id,celebration_type:n.celebration_type,title:n.title,message:n.message||null,points_amount:n.points_amount||null,created_by:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}var Dle="focusScope.autoFocusOnMount",Rle="focusScope.autoFocusOnUnmount",oje={bubbles:!1,cancelable:!0},mnt="FocusScope",mI=P.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=e,[a,h]=P.useState(null),p=Gl(i),x=Gl(o),y=P.useRef(null),w=ei(t,C=>h(C)),j=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(s){let C=function(O){if(j.paused||!a)return;const z=O.target;a.contains(z)?y.current=z:o0(y.current,{select:!0})},A=function(O){if(j.paused||!a)return;const z=O.relatedTarget;z!==null&&(a.contains(z)||o0(y.current,{select:!0}))},E=function(O){if(document.activeElement===document.body)for(const F of O)F.removedNodes.length>0&&o0(a)};document.addEventListener("focusin",C),document.addEventListener("focusout",A);const T=new MutationObserver(E);return a&&T.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",A),T.disconnect()}}},[s,a,j.paused]),P.useEffect(()=>{if(a){cje.add(j);const C=document.activeElement;if(!a.contains(C)){const E=new CustomEvent(Dle,oje);a.addEventListener(Dle,p),a.dispatchEvent(E),E.defaultPrevented||(gnt(bnt(JIe(a)),{select:!0}),document.activeElement===C&&o0(a))}return()=>{a.removeEventListener(Dle,p),setTimeout(()=>{const E=new CustomEvent(Rle,oje);a.addEventListener(Rle,x),a.dispatchEvent(E),E.defaultPrevented||o0(C??document.body,{select:!0}),a.removeEventListener(Rle,x),cje.remove(j)},0)}}},[a,p,x,j]);const S=P.useCallback(C=>{if(!n&&!s||j.paused)return;const A=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,E=document.activeElement;if(A&&E){const T=C.currentTarget,[O,z]=xnt(T);O&&z?!C.shiftKey&&E===z?(C.preventDefault(),n&&o0(O,{select:!0})):C.shiftKey&&E===O&&(C.preventDefault(),n&&o0(z,{select:!0})):E===T&&C.preventDefault()}},[n,s,j.paused]);return r.jsx(Rn.div,{tabIndex:-1,...l,ref:w,onKeyDown:S})});mI.displayName=mnt;function gnt(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(o0(s,{select:t}),document.activeElement!==n)return}function xnt(e){const t=JIe(e),n=lje(t,e),s=lje(t.reverse(),e);return[n,s]}function JIe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function lje(e,t){for(const n of e)if(!ynt(n,{upTo:t}))return n}function ynt(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vnt(e){return e instanceof HTMLInputElement&&"select"in e}function o0(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vnt(e)&&t&&e.select()}}var cje=_nt();function _nt(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=dje(e,t),e.unshift(t)},remove(t){var n;e=dje(e,t),(n=e[0])==null||n.resume()}}}function dje(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function bnt(e){return e.filter(t=>t.tagName!=="A")}var Fle=0;function Bne(){P.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??uje()),document.body.insertAdjacentElement("beforeend",e[1]??uje()),Fle++,()=>{Fle===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Fle--}},[])}function uje(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var see="right-scroll-bar-position",iee="width-before-scroll-bar",wnt="with-scroll-bars-hidden",jnt="--removed-body-scroll-bar-size";function zle(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function knt(e,t){var n=P.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=t,n.facade}var Nnt=typeof window<"u"?P.useLayoutEffect:P.useEffect,hje=new WeakMap;function Snt(e,t){var n=knt(null,function(s){return e.forEach(function(i){return zle(i,s)})});return Nnt(function(){var s=hje.get(n);if(s){var i=new Set(s),o=new Set(e),l=n.current;i.forEach(function(a){o.has(a)||zle(a,null)}),o.forEach(function(a){i.has(a)||zle(a,l)})}hje.set(n,e)},[e]),n}function Cnt(e){return e}function Mnt(e,t){t===void 0&&(t=Cnt);var n=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var l=t(o,s);return n.push(l),function(){n=n.filter(function(a){return a!==l})}},assignSyncMedium:function(o){for(s=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){s=!0;var l=[];if(n.length){var a=n;n=[],a.forEach(o),l=n}var h=function(){var x=l;l=[],x.forEach(o)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(x){l.push(x),p()},filter:function(x){return l=l.filter(x),n}}}};return i}function Tnt(e){e===void 0&&(e={});var t=Mnt(null);return t.options=Df({async:!0,ssr:!1},e),t}var ePe=function(e){var t=e.sideCar,n=J1(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return P.createElement(s,Df({},n))};ePe.isSideCarExport=!0;function Ant(e,t){return e.useMedium(t),ePe}var tPe=Tnt(),Ble=function(){},$ne=P.forwardRef(function(e,t){var n=P.useRef(null),s=P.useState({onScrollCapture:Ble,onWheelCapture:Ble,onTouchMoveCapture:Ble}),i=s[0],o=s[1],l=e.forwardProps,a=e.children,h=e.className,p=e.removeScrollBar,x=e.enabled,y=e.shards,w=e.sideCar,j=e.noRelative,S=e.noIsolation,C=e.inert,A=e.allowPinchZoom,E=e.as,T=E===void 0?"div":E,O=e.gapMode,z=J1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=w,q=Snt([n,t]),H=Df(Df({},z),i);return P.createElement(P.Fragment,null,x&&P.createElement(F,{sideCar:tPe,removeScrollBar:p,shards:y,noRelative:j,noIsolation:S,inert:C,setCallbacks:o,allowPinchZoom:!!A,lockRef:n,gapMode:O}),l?P.cloneElement(P.Children.only(a),Df(Df({},H),{ref:q})):P.createElement(T,Df({},H,{className:h,ref:q}),a))});$ne.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};$ne.classNames={fullWidth:iee,zeroRight:see};var Ent=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Int(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ent();return t&&e.setAttribute("nonce",t),e}function Pnt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Lnt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ont=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Int())&&(Pnt(t,n),Lnt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Dnt=function(){var e=Ont();return function(t,n){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rPe=function(){var e=Dnt(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},Rnt={left:0,top:0,right:0,gap:0},$le=function(e){return parseInt(e||"",10)||0},Fnt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[$le(n),$le(s),$le(i)]},znt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Rnt;var t=Fnt(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},Bnt=rPe(),jS="data-scroll-locked",$nt=function(e,t,n,s){var i=e.left,o=e.top,l=e.right,a=e.gap;return n===void 0&&(n="margin"),` .`.concat(wnt,` { overflow: hidden `).concat(s,`; padding-right: `).concat(a,"px ").concat(s,`; } body[`).concat(jS,`] { overflow: hidden `).concat(s,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&` padding-left: `.concat(i,`px; padding-top: `).concat(o,`px; padding-right: `).concat(l,`px; margin-left:0; margin-top:0; margin-right: `).concat(a,"px ").concat(s,`; `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),` } .`).concat(see,` { right: `).concat(a,"px ").concat(s,`; } .`).concat(iee,` { margin-right: `).concat(a,"px ").concat(s,`; } .`).concat(see," .").concat(see,` { right: 0 `).concat(s,`; } .`).concat(iee," .").concat(iee,` { margin-right: 0 `).concat(s,`; } body[`).concat(jS,`] { `).concat(jnt,": ").concat(a,`px; } `)},fje=function(){var e=parseInt(document.body.getAttribute(jS)||"0",10);return isFinite(e)?e:0},Unt=function(){P.useEffect(function(){return document.body.setAttribute(jS,(fje()+1).toString()),function(){var e=fje()-1;e<=0?document.body.removeAttribute(jS):document.body.setAttribute(jS,e.toString())}},[])},qnt=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;Unt();var o=P.useMemo(function(){return znt(i)},[i]);return P.createElement(Bnt,{styles:$nt(o,!t,i,n?"":"!important")})},Jue=!1;if(typeof window<"u")try{var gL=Object.defineProperty({},"passive",{get:function(){return Jue=!0,!0}});window.addEventListener("test",gL,gL),window.removeEventListener("test",gL,gL)}catch{Jue=!1}var QN=Jue?{passive:!1}:!1,Vnt=function(e){return e.tagName==="TEXTAREA"},nPe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vnt(e)&&n[t]==="visible")},Hnt=function(e){return nPe(e,"overflowY")},Wnt=function(e){return nPe(e,"overflowX")},pje=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=sPe(e,s);if(i){var o=iPe(e,s),l=o[1],a=o[2];if(l>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Gnt=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Knt=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},sPe=function(e,t){return e==="v"?Hnt(t):Wnt(t)},iPe=function(e,t){return e==="v"?Gnt(t):Knt(t)},Znt=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ynt=function(e,t,n,s,i){var o=Znt(e,window.getComputedStyle(t).direction),l=o*s,a=n.target,h=t.contains(a),p=!1,x=l>0,y=0,w=0;do{if(!a)break;var j=iPe(e,a),S=j[0],C=j[1],A=j[2],E=C-A-o*S;(S||E)&&sPe(e,a)&&(y+=E,w+=S);var T=a.parentNode;a=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&a!==document.body||h&&(t.contains(a)||t===a));return(x&&Math.abs(y)<1||!x&&Math.abs(w)<1)&&(p=!0),p},xL=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},mje=function(e){return[e.deltaX,e.deltaY]},gje=function(e){return e&&"current"in e?e.current:e},Xnt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qnt=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},Jnt=0,JN=[];function est(e){var t=P.useRef([]),n=P.useRef([0,0]),s=P.useRef(),i=P.useState(Jnt++)[0],o=P.useState(rPe)[0],l=P.useRef(e);P.useEffect(function(){l.current=e},[e]),P.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var C=fge([e.lockRef.current],(e.shards||[]).map(gje),!0).filter(Boolean);return C.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),C.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=P.useCallback(function(C,A){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!l.current.allowPinchZoom;var E=xL(C),T=n.current,O="deltaX"in C?C.deltaX:T[0]-E[0],z="deltaY"in C?C.deltaY:T[1]-E[1],F,q=C.target,H=Math.abs(O)>Math.abs(z)?"h":"v";if("touches"in C&&H==="h"&&q.type==="range")return!1;var K=pje(H,q);if(!K)return!0;if(K?F=H:(F=H==="v"?"h":"v",K=pje(H,q)),!K)return!1;if(!s.current&&"changedTouches"in C&&(O||z)&&(s.current=F),!F)return!0;var Z=s.current||F;return Ynt(Z,A,C,Z==="h"?O:z)},[]),h=P.useCallback(function(C){var A=C;if(!(!JN.length||JN[JN.length-1]!==o)){var E="deltaY"in A?mje(A):xL(A),T=t.current.filter(function(F){return F.name===A.type&&(F.target===A.target||A.target===F.shadowParent)&&Xnt(F.delta,E)})[0];if(T&&T.should){A.cancelable&&A.preventDefault();return}if(!T){var O=(l.current.shards||[]).map(gje).filter(Boolean).filter(function(F){return F.contains(A.target)}),z=O.length>0?a(A,O[0]):!l.current.noIsolation;z&&A.cancelable&&A.preventDefault()}}},[]),p=P.useCallback(function(C,A,E,T){var O={name:C,delta:A,target:E,should:T,shadowParent:tst(E)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(z){return z!==O})},1)},[]),x=P.useCallback(function(C){n.current=xL(C),s.current=void 0},[]),y=P.useCallback(function(C){p(C.type,mje(C),C.target,a(C,e.lockRef.current))},[]),w=P.useCallback(function(C){p(C.type,xL(C),C.target,a(C,e.lockRef.current))},[]);P.useEffect(function(){return JN.push(o),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:w}),document.addEventListener("wheel",h,QN),document.addEventListener("touchmove",h,QN),document.addEventListener("touchstart",x,QN),function(){JN=JN.filter(function(C){return C!==o}),document.removeEventListener("wheel",h,QN),document.removeEventListener("touchmove",h,QN),document.removeEventListener("touchstart",x,QN)}},[]);var j=e.removeScrollBar,S=e.inert;return P.createElement(P.Fragment,null,S?P.createElement(o,{styles:Qnt(i)}):null,j?P.createElement(qnt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tst(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rst=Ant(tPe,est);var gI=P.forwardRef(function(e,t){return P.createElement($ne,Df({},e,{ref:t,sideCar:rst}))});gI.classNames=$ne.classNames;var nst=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},e4=new WeakMap,yL=new WeakMap,vL={},Ule=0,aPe=function(e){return e&&(e.host||aPe(e.parentNode))},sst=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=aPe(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},ist=function(e,t,n,s){var i=sst(t,Array.isArray(e)?e:[e]);vL[n]||(vL[n]=new WeakMap);var o=vL[n],l=[],a=new Set,h=new Set(i),p=function(y){!y||a.has(y)||(a.add(y),p(y.parentNode))};i.forEach(p);var x=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(w){if(a.has(w))x(w);else try{var j=w.getAttribute(s),S=j!==null&&j!=="false",C=(e4.get(w)||0)+1,A=(o.get(w)||0)+1;e4.set(w,C),o.set(w,A),l.push(w),C===1&&S&&yL.set(w,!0),A===1&&w.setAttribute(n,"true"),S||w.setAttribute(s,"true")}catch(E){console.error("aria-hidden: cannot operate on ",w,E)}})};return x(t),a.clear(),Ule++,function(){l.forEach(function(y){var w=e4.get(y)-1,j=o.get(y)-1;e4.set(y,w),o.set(y,j),w||(yL.has(y)||y.removeAttribute(s),yL.delete(y)),j||y.removeAttribute(n)}),Ule--,Ule||(e4=new WeakMap,e4=new WeakMap,yL=new WeakMap,vL={})}},Une=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=nst(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live]"))),ist(s,i,n,"aria-hidden")):function(){return null}},qne="Dialog",[oPe,lPe]=Ql(qne),[ast,Nm]=oPe(qne),cPe=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,a=P.useRef(null),h=P.useRef(null),[p,x]=Lu({prop:s,defaultProp:i??!1,onChange:o,caller:qne});return r.jsx(ast,{scope:t,triggerRef:a,contentRef:h,contentId:Vc(),titleId:Vc(),descriptionId:Vc(),open:p,onOpenChange:x,onOpenToggle:P.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};cPe.displayName=qne;var dPe="DialogTrigger",uPe=P.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Nm(dPe,n),o=ei(t,i.triggerRef);return r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Nge(i.open),...s,ref:o,onClick:cn(e.onClick,i.onOpenToggle)})});uPe.displayName=dPe;var jge="DialogPortal",[ost,hPe]=oPe(jge,{forceMount:void 0}),fPe=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:i}=e,o=Nm(jge,t);return r.jsx(ost,{scope:t,forceMount:n,children:P.Children.map(s,l=>r.jsx(fc,{present:n||o.open,children:r.jsx(ZC,{asChild:!0,container:i,children:l})}))})};fPe.displayName=jge;var Jee="DialogOverlay",pPe=P.forwardRef((e,t)=>{const n=hPe(Jee,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,o=Nm(Jee,e.__scopeDialog);return o.modal?r.jsx(fc,{present:s||o.open,children:r.jsx(cst,{...i,ref:t})}):null});pPe.displayName=Jee;var lst=L1("DialogOverlay.RemoveScroll"),cst=P.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Nm(Jee,n);return r.jsx(gI,{as:lst,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(Rn.div,{"data-state":Nge(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Oj="DialogContent",mPe=P.forwardRef((e,t)=>{const n=hPe(Oj,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,o=Nm(Oj,e.__scopeDialog);return r.jsx(fc,{present:s||o.open,children:o.modal?r.jsx(dst,{...i,ref:t}):r.jsx(ust,{...i,ref:t})})});mPe.displayName=Oj;var dst=P.forwardRef((e,t)=>{const n=Nm(Oj,e.__scopeDialog),s=P.useRef(null),i=ei(t,n.contentRef,s);return P.useEffect(()=>{const o=s.current;if(o)return Une(o)},[]),r.jsx(gPe,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cn(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:cn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0;(l.button===2||a)&&o.preventDefault()}),onFocusOutside:cn(e.onFocusOutside,o=>o.preventDefault())})}),ust=P.forwardRef((e,t)=>{const n=Nm(Oj,e.__scopeDialog),s=P.useRef(!1),i=P.useRef(!1);return r.jsx(gPe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var h,p;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),gPe=P.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,...l}=e,a=Nm(Oj,n),h=P.useRef(null),p=ei(t,h);return Bne(),r.jsxs(r.Fragment,{children:[r.jsx(mI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(X1,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Nge(a.open),...l,ref:p,onDismiss:()=>a.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(fst,{titleId:a.titleId}),r.jsx(mst,{contentRef:h,descriptionId:a.descriptionId})]})]})}),kge="DialogTitle",xPe=P.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Nm(kge,n);return r.jsx(Rn.h2,{id:i.titleId,...s,ref:t})});xPe.displayName=kge;var yPe="DialogDescription",vPe=P.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Nm(yPe,n);return r.jsx(Rn.p,{id:i.descriptionId,...s,ref:t})});vPe.displayName=yPe;var _Pe="DialogClose",bPe=P.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Nm(_Pe,n);return r.jsx(Rn.button,{type:"button",...s,ref:t,onClick:cn(e.onClick,()=>i.onOpenChange(!1))})});bPe.displayName=_Pe;function Nge(e){return e?"open":"closed"}var wPe="DialogTitleWarning",[hst,jPe]=EKe(wPe,{contentName:Oj,titleName:kge,docsSlug:"dialog"}),fst=({titleId:e})=>{const t=jPe(wPe),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return P.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},pst="DialogDescriptionWarning",mst=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jPe(pst).contentName}}.`;return P.useEffect(()=>{var o;const i=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Vne=cPe,Sge=uPe,Hne=fPe,o3=pPe,l3=mPe,xI=xPe,yI=vPe,Wne=bPe;const Br=Vne,Fo=Sge,gst=Hne,kPe=P.forwardRef(({className:e,...t},n)=>r.jsx(o3,{ref:n,className:$t("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",e),...t}));kPe.displayName=o3.displayName;const Fr=P.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(gst,{children:[r.jsx(kPe,{}),r.jsxs(l3,{ref:s,className:$t("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",e),...n,children:[t,r.jsxs(Wne,{className:"absolute right-4 top-4 rounded-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:[r.jsx(Ts,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Fr.displayName=l3.displayName;const Hr=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Hr.displayName="DialogHeader";const ri=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ri.displayName="DialogFooter";const qr=P.forwardRef(({className:e,...t},n)=>r.jsx(xI,{ref:n,className:$t("text-lg font-semibold leading-none tracking-tight",e),...t}));qr.displayName=xI.displayName;const es=P.forwardRef(({className:e,...t},n)=>r.jsx(yI,{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));es.displayName=yI.displayName;const xst={points_earned:Ha,listing_created:fi,deal_closed:ud,custom:vs},xje={points_earned:"from-amber-500 to-orange-500",listing_created:"from-emerald-500 to-teal-500",deal_closed:"from-green-500 to-emerald-500",custom:"from-purple-500 to-pink-500"};function yst(){const{user:e}=zr(),t=Wr(),{data:n}=hnt(),s=fnt(),[i,o]=P.useState(null),[l,a]=P.useState(!1),h=P.useCallback(()=>{const j=Date.now()+3e3,S={startVelocity:30,spread:360,ticks:60,zIndex:9999},C=(E,T)=>Math.random()*(T-E)+E,A=setInterval(()=>{const E=j-Date.now();if(E<=0){clearInterval(A);return}const T=50*(E/3e3);aje({...S,particleCount:T,origin:{x:C(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),aje({...S,particleCount:T,origin:{x:C(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);P.useEffect(()=>{n&&n.length>0&&!i&&(o(n[0]),a(!0),setTimeout(h,100))},[n,i,h]);const p=async()=>{if(i){const w=i.id;a(!1),o(null),t.setQueryData(["celebrations","pending",e==null?void 0:e.id],j=>(j==null?void 0:j.filter(S=>S.id!==w))??[]),await s.mutateAsync(w)}};if(!i)return null;const x=xst[i.celebration_type]||vs,y=xje[i.celebration_type]||xje.custom;return r.jsx(Br,{open:l,onOpenChange:w=>!w&&p(),children:r.jsxs(Fr,{className:"sm:max-w-md text-center border-0 overflow-hidden",children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${y} opacity-10`}),r.jsxs("div",{className:"relative z-10 py-6",children:[r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:`w-20 h-20 rounded-full bg-gradient-to-br ${y} flex items-center justify-center animate-bounce`,children:r.jsx(x,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"flex justify-center gap-1 mb-4",children:[r.jsx(Ss,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Ss,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Ss,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-150"})]}),r.jsxs("h2",{className:"text-2xl font-bold mb-2 bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent",children:["🎉 ",i.title]}),i.points_amount&&i.points_amount>0&&r.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",i.points_amount," points!"]}),i.message&&r.jsx("p",{className:"text-muted-foreground mb-6",children:i.message}),r.jsx(J,{onClick:p,className:"w-full",size:"lg",children:"Awesome! 🙌"}),n&&n.length>1&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-3",children:["+",n.length-1," more celebration",n.length>2?"s":""," waiting"]})]})]})})}const QA="/assets/levelup-logo-color-D3mY9gCJ.png",Cge="/assets/levelup-logo-white-C2RAgAoG.png",vst="/assets/listings-hero-BI9Ki9Dq.jpg",ct=P.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:$t("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",e),ref:s,...n}));ct.displayName="Input";const _st=YC("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 Ft({className:e,variant:t,...n}){return r.jsx("div",{className:$t(_st({variant:t}),e),...n})}function Pr({className:e,...t}){return r.jsx("div",{className:$t("animate-pulse rounded-md bg-muted",e),...t})}function JA(e,[t,n]){return Math.min(n,Math.max(t,e))}var bst=P.createContext(void 0);function rk(e){const t=P.useContext(bst);return e||t||"ltr"}function vI(e){const t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var wst=[" ","Enter","ArrowUp","ArrowDown"],jst=[" ","Enter"],Dj="Select",[Gne,Kne,kst]=aI(Dj),[c3]=Ql(Dj,[kst,Rg]),Zne=Rg(),[Nst,tv]=c3(Dj),[Sst,Cst]=c3(Dj),NPe=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:i,onOpenChange:o,value:l,defaultValue:a,onValueChange:h,dir:p,name:x,autoComplete:y,disabled:w,required:j,form:S}=e,C=Zne(t),[A,E]=P.useState(null),[T,O]=P.useState(null),[z,F]=P.useState(!1),q=rk(p),[H,K]=Lu({prop:s,defaultProp:i??!1,onChange:o,caller:Dj}),[Z,re]=Lu({prop:l,defaultProp:a,onChange:h,caller:Dj}),ue=P.useRef(null),he=A?S||!!A.closest("form"):!0,[be,ne]=P.useState(new Set),ye=Array.from(be).map(ie=>ie.props.value).join(";");return r.jsx(dI,{...C,children:r.jsxs(Nst,{required:j,scope:t,trigger:A,onTriggerChange:E,valueNode:T,onValueNodeChange:O,valueNodeHasChildren:z,onValueNodeHasChildrenChange:F,contentId:Vc(),value:Z,onValueChange:re,open:H,onOpenChange:K,dir:q,triggerPointerDownPosRef:ue,disabled:w,children:[r.jsx(Gne.Provider,{scope:t,children:r.jsx(Sst,{scope:e.__scopeSelect,onNativeOptionAdd:P.useCallback(ie=>{ne(fe=>new Set(fe).add(ie))},[]),onNativeOptionRemove:P.useCallback(ie=>{ne(fe=>{const de=new Set(fe);return de.delete(ie),de})},[]),children:n})}),he?r.jsxs(ZPe,{"aria-hidden":!0,required:j,tabIndex:-1,name:x,autoComplete:y,value:Z,onChange:ie=>re(ie.target.value),disabled:w,form:S,children:[Z===void 0?r.jsx("option",{value:""}):null,Array.from(be)]},ye):null]})})};NPe.displayName=Dj;var SPe="SelectTrigger",CPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...i}=e,o=Zne(n),l=tv(SPe,n),a=l.disabled||s,h=ei(t,l.onTriggerChange),p=Kne(n),x=P.useRef("touch"),[y,w,j]=XPe(C=>{const A=p().filter(O=>!O.disabled),E=A.find(O=>O.value===l.value),T=QPe(A,C,E);T!==void 0&&l.onValueChange(T.value)}),S=C=>{a||(l.onOpenChange(!0),j()),C&&(l.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return r.jsx(e3,{asChild:!0,...o,children:r.jsx(Rn.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":YPe(l.value)?"":void 0,...i,ref:h,onClick:cn(i.onClick,C=>{C.currentTarget.focus(),x.current!=="mouse"&&S(C)}),onPointerDown:cn(i.onPointerDown,C=>{x.current=C.pointerType;const A=C.target;A.hasPointerCapture(C.pointerId)&&A.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(S(C),C.preventDefault())}),onKeyDown:cn(i.onKeyDown,C=>{const A=y.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&w(C.key),!(A&&C.key===" ")&&wst.includes(C.key)&&(S(),C.preventDefault())})})})});CPe.displayName=SPe;var MPe="SelectValue",TPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:i,children:o,placeholder:l="",...a}=e,h=tv(MPe,n),{onValueNodeHasChildrenChange:p}=h,x=o!==void 0,y=ei(t,h.onValueNodeChange);return Yl(()=>{p(x)},[p,x]),r.jsx(Rn.span,{...a,ref:y,style:{pointerEvents:"none"},children:YPe(h.value)?r.jsx(r.Fragment,{children:l}):o})});TPe.displayName=MPe;var Mst="SelectIcon",APe=P.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...i}=e;return r.jsx(Rn.span,{"aria-hidden":!0,...i,ref:t,children:s||"▼"})});APe.displayName=Mst;var Tst="SelectPortal",EPe=e=>r.jsx(ZC,{asChild:!0,...e});EPe.displayName=Tst;var Rj="SelectContent",IPe=P.forwardRef((e,t)=>{const n=tv(Rj,e.__scopeSelect),[s,i]=P.useState();if(Yl(()=>{i(new DocumentFragment)},[]),!n.open){const o=s;return o?hy.createPortal(r.jsx(PPe,{scope:e.__scopeSelect,children:r.jsx(Gne.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(LPe,{...e,ref:t})});IPe.displayName=Rj;var Hp=10,[PPe,rv]=c3(Rj),Ast="SelectContentImpl",Est=L1("SelectContent.RemoveScroll"),LPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:l,side:a,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:w,collisionPadding:j,sticky:S,hideWhenDetached:C,avoidCollisions:A,...E}=e,T=tv(Rj,n),[O,z]=P.useState(null),[F,q]=P.useState(null),H=ei(t,Ie=>z(Ie)),[K,Z]=P.useState(null),[re,ue]=P.useState(null),he=Kne(n),[be,ne]=P.useState(!1),ye=P.useRef(!1);P.useEffect(()=>{if(O)return Une(O)},[O]),Bne();const ie=P.useCallback(Ie=>{const[Ke,...Re]=he().map(Te=>Te.ref.current),[Ce]=Re.slice(-1),Je=document.activeElement;for(const Te of Ie)if(Te===Je||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===Ke&&F&&(F.scrollTop=0),Te===Ce&&F&&(F.scrollTop=F.scrollHeight),Te==null||Te.focus(),document.activeElement!==Je))return},[he,F]),fe=P.useCallback(()=>ie([K,O]),[ie,K,O]);P.useEffect(()=>{be&&fe()},[be,fe]);const{onOpenChange:de,triggerPointerDownPosRef:_e}=T;P.useEffect(()=>{if(O){let Ie={x:0,y:0};const Ke=Ce=>{var Je,Te;Ie={x:Math.abs(Math.round(Ce.pageX)-(((Je=_e.current)==null?void 0:Je.x)??0)),y:Math.abs(Math.round(Ce.pageY)-(((Te=_e.current)==null?void 0:Te.y)??0))}},Re=Ce=>{Ie.x<=10&&Ie.y<=10?Ce.preventDefault():O.contains(Ce.target)||de(!1),document.removeEventListener("pointermove",Ke),_e.current=null};return _e.current!==null&&(document.addEventListener("pointermove",Ke),document.addEventListener("pointerup",Re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ke),document.removeEventListener("pointerup",Re,{capture:!0})}}},[O,de,_e]),P.useEffect(()=>{const Ie=()=>de(!1);return window.addEventListener("blur",Ie),window.addEventListener("resize",Ie),()=>{window.removeEventListener("blur",Ie),window.removeEventListener("resize",Ie)}},[de]);const[Ee,ke]=XPe(Ie=>{const Ke=he().filter(Je=>!Je.disabled),Re=Ke.find(Je=>Je.ref.current===document.activeElement),Ce=QPe(Ke,Ie,Re);Ce&&setTimeout(()=>Ce.ref.current.focus())}),pe=P.useCallback((Ie,Ke,Re)=>{const Ce=!ye.current&&!Re;(T.value!==void 0&&T.value===Ke||Ce)&&(Z(Ie),Ce&&(ye.current=!0))},[T.value]),ae=P.useCallback(()=>O==null?void 0:O.focus(),[O]),ge=P.useCallback((Ie,Ke,Re)=>{const Ce=!ye.current&&!Re;(T.value!==void 0&&T.value===Ke||Ce)&&ue(Ie)},[T.value]),Me=s==="popper"?ehe:OPe,Ue=Me===ehe?{side:a,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:w,collisionPadding:j,sticky:S,hideWhenDetached:C,avoidCollisions:A}:{};return r.jsx(PPe,{scope:n,content:O,viewport:F,onViewportChange:q,itemRefCallback:pe,selectedItem:K,onItemLeave:ae,itemTextRefCallback:ge,focusSelectedItem:fe,selectedItemText:re,position:s,isPositioned:be,searchRef:Ee,children:r.jsx(gI,{as:Est,allowPinchZoom:!0,children:r.jsx(mI,{asChild:!0,trapped:T.open,onMountAutoFocus:Ie=>{Ie.preventDefault()},onUnmountAutoFocus:cn(i,Ie=>{var Ke;(Ke=T.trigger)==null||Ke.focus({preventScroll:!0}),Ie.preventDefault()}),children:r.jsx(X1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ie=>Ie.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:r.jsx(Me,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:Ie=>Ie.preventDefault(),...E,...Ue,onPlaced:()=>ne(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:cn(E.onKeyDown,Ie=>{const Ke=Ie.ctrlKey||Ie.altKey||Ie.metaKey;if(Ie.key==="Tab"&&Ie.preventDefault(),!Ke&&Ie.key.length===1&&ke(Ie.key),["ArrowUp","ArrowDown","Home","End"].includes(Ie.key)){let Ce=he().filter(Je=>!Je.disabled).map(Je=>Je.ref.current);if(["ArrowUp","End"].includes(Ie.key)&&(Ce=Ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ie.key)){const Je=Ie.target,Te=Ce.indexOf(Je);Ce=Ce.slice(Te+1)}setTimeout(()=>ie(Ce)),Ie.preventDefault()}})})})})})})});LPe.displayName=Ast;var Ist="SelectItemAlignedPosition",OPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...i}=e,o=tv(Rj,n),l=rv(Rj,n),[a,h]=P.useState(null),[p,x]=P.useState(null),y=ei(t,H=>x(H)),w=Kne(n),j=P.useRef(!1),S=P.useRef(!0),{viewport:C,selectedItem:A,selectedItemText:E,focusSelectedItem:T}=l,O=P.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&p&&C&&A&&E){const H=o.trigger.getBoundingClientRect(),K=p.getBoundingClientRect(),Z=o.valueNode.getBoundingClientRect(),re=E.getBoundingClientRect();if(o.dir!=="rtl"){const Je=re.left-K.left,Te=Z.left-Je,Ye=H.left-Te,xe=H.width+Ye,mt=Math.max(xe,K.width),et=window.innerWidth-Hp,nt=JA(Te,[Hp,Math.max(Hp,et-mt)]);a.style.minWidth=xe+"px",a.style.left=nt+"px"}else{const Je=K.right-re.right,Te=window.innerWidth-Z.right-Je,Ye=window.innerWidth-H.right-Te,xe=H.width+Ye,mt=Math.max(xe,K.width),et=window.innerWidth-Hp,nt=JA(Te,[Hp,Math.max(Hp,et-mt)]);a.style.minWidth=xe+"px",a.style.right=nt+"px"}const ue=w(),he=window.innerHeight-Hp*2,be=C.scrollHeight,ne=window.getComputedStyle(p),ye=parseInt(ne.borderTopWidth,10),ie=parseInt(ne.paddingTop,10),fe=parseInt(ne.borderBottomWidth,10),de=parseInt(ne.paddingBottom,10),_e=ye+ie+be+de+fe,Ee=Math.min(A.offsetHeight*5,_e),ke=window.getComputedStyle(C),pe=parseInt(ke.paddingTop,10),ae=parseInt(ke.paddingBottom,10),ge=H.top+H.height/2-Hp,Me=he-ge,Ue=A.offsetHeight/2,Ie=A.offsetTop+Ue,Ke=ye+ie+Ie,Re=_e-Ke;if(Ke<=ge){const Je=ue.length>0&&A===ue[ue.length-1].ref.current;a.style.bottom="0px";const Te=p.clientHeight-C.offsetTop-C.offsetHeight,Ye=Math.max(Me,Ue+(Je?ae:0)+Te+fe),xe=Ke+Ye;a.style.height=xe+"px"}else{const Je=ue.length>0&&A===ue[0].ref.current;a.style.top="0px";const Ye=Math.max(ge,ye+C.offsetTop+(Je?pe:0)+Ue)+Re;a.style.height=Ye+"px",C.scrollTop=Ke-ge+C.offsetTop}a.style.margin=`${Hp}px 0`,a.style.minHeight=Ee+"px",a.style.maxHeight=he+"px",s==null||s(),requestAnimationFrame(()=>j.current=!0)}},[w,o.trigger,o.valueNode,a,p,C,A,E,o.dir,s]);Yl(()=>O(),[O]);const[z,F]=P.useState();Yl(()=>{p&&F(window.getComputedStyle(p).zIndex)},[p]);const q=P.useCallback(H=>{H&&S.current===!0&&(O(),T==null||T(),S.current=!1)},[O,T]);return r.jsx(Lst,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:j,onScrollButtonChange:q,children:r.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:r.jsx(Rn.div,{...i,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});OPe.displayName=Ist;var Pst="SelectPopperPosition",ehe=P.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:i=Hp,...o}=e,l=Zne(n);return r.jsx(uI,{...l,...o,ref:t,align:s,collisionPadding:i,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)"}})});ehe.displayName=Pst;var[Lst,Mge]=c3(Rj,{}),the="SelectViewport",DPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...i}=e,o=rv(the,n),l=Mge(the,n),a=ei(t,o.onViewportChange),h=P.useRef(0);return r.jsxs(r.Fragment,{children:[r.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:s}),r.jsx(Gne.Slot,{scope:n,children:r.jsx(Rn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:cn(i.onScroll,p=>{const x=p.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:w}=l;if(w!=null&&w.current&&y){const j=Math.abs(h.current-x.scrollTop);if(j>0){const S=window.innerHeight-Hp*2,C=parseFloat(y.style.minHeight),A=parseFloat(y.style.height),E=Math.max(C,A);if(E0?z:0,y.style.justifyContent="flex-end")}}}h.current=x.scrollTop})})})]})});DPe.displayName=the;var RPe="SelectGroup",[Ost,Dst]=c3(RPe),Rst=P.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,i=Vc();return r.jsx(Ost,{scope:n,id:i,children:r.jsx(Rn.div,{role:"group","aria-labelledby":i,...s,ref:t})})});Rst.displayName=RPe;var FPe="SelectLabel",zPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,i=Dst(FPe,n);return r.jsx(Rn.div,{id:i.id,...s,ref:t})});zPe.displayName=FPe;var ete="SelectItem",[Fst,BPe]=c3(ete),$Pe=P.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:i=!1,textValue:o,...l}=e,a=tv(ete,n),h=rv(ete,n),p=a.value===s,[x,y]=P.useState(o??""),[w,j]=P.useState(!1),S=ei(t,T=>{var O;return(O=h.itemRefCallback)==null?void 0:O.call(h,T,s,i)}),C=Vc(),A=P.useRef("touch"),E=()=>{i||(a.onValueChange(s),a.onOpenChange(!1))};if(s==="")throw new Error("A 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 r.jsx(Fst,{scope:n,value:s,disabled:i,textId:C,isSelected:p,onItemTextChange:P.useCallback(T=>{y(O=>O||((T==null?void 0:T.textContent)??"").trim())},[]),children:r.jsx(Gne.ItemSlot,{scope:n,value:s,disabled:i,textValue:x,children:r.jsx(Rn.div,{role:"option","aria-labelledby":C,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:S,onFocus:cn(l.onFocus,()=>j(!0)),onBlur:cn(l.onBlur,()=>j(!1)),onClick:cn(l.onClick,()=>{A.current!=="mouse"&&E()}),onPointerUp:cn(l.onPointerUp,()=>{A.current==="mouse"&&E()}),onPointerDown:cn(l.onPointerDown,T=>{A.current=T.pointerType}),onPointerMove:cn(l.onPointerMove,T=>{var O;A.current=T.pointerType,i?(O=h.onItemLeave)==null||O.call(h):A.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:cn(l.onPointerLeave,T=>{var O;T.currentTarget===document.activeElement&&((O=h.onItemLeave)==null||O.call(h))}),onKeyDown:cn(l.onKeyDown,T=>{var z;((z=h.searchRef)==null?void 0:z.current)!==""&&T.key===" "||(jst.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})});$Pe.displayName=ete;var lT="SelectItemText",UPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:i,...o}=e,l=tv(lT,n),a=rv(lT,n),h=BPe(lT,n),p=Cst(lT,n),[x,y]=P.useState(null),w=ei(t,E=>y(E),h.onItemTextChange,E=>{var T;return(T=a.itemTextRefCallback)==null?void 0:T.call(a,E,h.value,h.disabled)}),j=x==null?void 0:x.textContent,S=P.useMemo(()=>r.jsx("option",{value:h.value,disabled:h.disabled,children:j},h.value),[h.disabled,h.value,j]),{onNativeOptionAdd:C,onNativeOptionRemove:A}=p;return Yl(()=>(C(S),()=>A(S)),[C,A,S]),r.jsxs(r.Fragment,{children:[r.jsx(Rn.span,{id:h.textId,...o,ref:w}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?hy.createPortal(o.children,l.valueNode):null]})});UPe.displayName=lT;var qPe="SelectItemIndicator",VPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return BPe(qPe,n).isSelected?r.jsx(Rn.span,{"aria-hidden":!0,...s,ref:t}):null});VPe.displayName=qPe;var rhe="SelectScrollUpButton",HPe=P.forwardRef((e,t)=>{const n=rv(rhe,e.__scopeSelect),s=Mge(rhe,e.__scopeSelect),[i,o]=P.useState(!1),l=ei(t,s.onScrollButtonChange);return Yl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const p=h.scrollTop>0;o(p)};const h=n.viewport;return a(),h.addEventListener("scroll",a),()=>h.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(GPe,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:h}=n;a&&h&&(a.scrollTop=a.scrollTop-h.offsetHeight)}}):null});HPe.displayName=rhe;var nhe="SelectScrollDownButton",WPe=P.forwardRef((e,t)=>{const n=rv(nhe,e.__scopeSelect),s=Mge(nhe,e.__scopeSelect),[i,o]=P.useState(!1),l=ei(t,s.onScrollButtonChange);return Yl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const p=h.scrollHeight-h.clientHeight,x=Math.ceil(h.scrollTop)h.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(GPe,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:h}=n;a&&h&&(a.scrollTop=a.scrollTop+h.offsetHeight)}}):null});WPe.displayName=nhe;var GPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...i}=e,o=rv("SelectScrollButton",n),l=P.useRef(null),a=Kne(n),h=P.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return P.useEffect(()=>()=>h(),[h]),Yl(()=>{var x;const p=a().find(y=>y.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[a]),r.jsx(Rn.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:cn(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:cn(i.onPointerMove,()=>{var p;(p=o.onItemLeave)==null||p.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:cn(i.onPointerLeave,()=>{h()})})}),zst="SelectSeparator",KPe=P.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Rn.div,{"aria-hidden":!0,...s,ref:t})});KPe.displayName=zst;var she="SelectArrow",Bst=P.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,i=Zne(n),o=tv(she,n),l=rv(she,n);return o.open&&l.position==="popper"?r.jsx(hI,{...i,...s,ref:t}):null});Bst.displayName=she;var $st="SelectBubbleInput",ZPe=P.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const i=P.useRef(null),o=ei(s,i),l=vI(t);return P.useEffect(()=>{const a=i.current;if(!a)return;const h=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&x){const y=new Event("change",{bubbles:!0});x.call(a,t),a.dispatchEvent(y)}},[l,t]),r.jsx(Rn.select,{...n,style:{...sAe,...n.style},ref:o,defaultValue:t})});ZPe.displayName=$st;function YPe(e){return e===""||e===void 0}function XPe(e){const t=Gl(e),n=P.useRef(""),s=P.useRef(0),i=P.useCallback(l=>{const a=n.current+l;t(a),function h(p){n.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>h(""),1e3))}(a)},[t]),o=P.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,i,o]}function QPe(e,t,n){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=Ust(e,Math.max(o,0));i.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function Ust(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var qst=NPe,JPe=CPe,Vst=TPe,Hst=APe,Wst=EPe,e6e=IPe,Gst=DPe,t6e=zPe,r6e=$Pe,Kst=UPe,Zst=VPe,n6e=HPe,s6e=WPe,i6e=KPe;const bn=qst,wn=Vst,vn=P.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(JPe,{ref:s,className:$t("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-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",e),...n,children:[t,r.jsx(Hst,{asChild:!0,children:r.jsx(Iu,{className:"h-4 w-4 opacity-50"})})]}));vn.displayName=JPe.displayName;const a6e=P.forwardRef(({className:e,...t},n)=>r.jsx(n6e,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(i1,{className:"h-4 w-4"})}));a6e.displayName=n6e.displayName;const o6e=P.forwardRef(({className:e,...t},n)=>r.jsx(s6e,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Iu,{className:"h-4 w-4"})}));o6e.displayName=s6e.displayName;const _n=P.forwardRef(({className:e,children:t,position:n="popper",...s},i)=>r.jsx(Wst,{children:r.jsxs(e6e,{ref:i,className:$t("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",n==="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",e),position:n,...s,children:[r.jsx(a6e,{}),r.jsx(Gst,{className:$t("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(o6e,{})]})}));_n.displayName=e6e.displayName;const Yst=P.forwardRef(({className:e,...t},n)=>r.jsx(t6e,{ref:n,className:$t("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Yst.displayName=t6e.displayName;const Kt=P.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(r6e,{ref:s,className:$t("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",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Zst,{children:r.jsx(Ca,{className:"h-4 w-4"})})}),r.jsx(Kst,{children:t})]}));Kt.displayName=r6e.displayName;const Xst=P.forwardRef(({className:e,...t},n)=>r.jsx(i6e,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",e),...t}));Xst.displayName=i6e.displayName;const Qst=e=>Jt({queryKey:["public-listings",e],queryFn:async()=>{let t=ee.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0).order("created_at",{ascending:!1});e!=null&&e.status&&(t=t.eq("status",e.status)),e!=null&&e.propertyType&&(t=t.eq("property_type",e.propertyType)),e!=null&&e.city&&(t=t.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(t=t.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(t=t.lte("price",e.maxPrice));const{data:n,error:s}=await t;if(s)throw s;return n}}),l6e=e=>Jt({queryKey:["public-listing",e],queryFn:async()=>{const t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);let n=ee.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, agent_notes, agent_notes_public, mls_link, video_link, video_id, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary, sort_order), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds, bunny_video_id) `).eq("is_approved",!0).eq("is_public",!0);t?n=n.eq("id",e):n=n.eq("slug",e);const{data:s,error:i}=await n.single();if(i)throw i;return s},enabled:!!e}),c6e=()=>cr({mutationFn:async({listingId:e,agentId:t,firstName:n,lastName:s,email:i,phone:o,shareToken:l})=>{let a=null,h=null;if(l){const{data:w}=await ee.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",e).maybeSingle();w&&(a=w.id,h=w.sharing_agent_id)}const{data:p,error:x}=await ee.from("listing_leads").insert({listing_id:e,agent_id:h||t,first_name:n,last_name:s,email:i,phone:o,share_id:a,referred_by_agent_id:h}).select().single();if(x)throw x;const{error:y}=await ee.functions.invoke("process-listing-lead",{body:{leadId:p.id}});return y&&console.error("Error processing lead:",y),p}}),Jst=()=>cr({mutationFn:async e=>{const{error:t}=await ee.rpc("increment_listing_share_click",{p_share_token:e});if(t)throw t}}),eit={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},yje={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},tit={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function d6e(){const[e,t]=P.useState(""),[n,s]=P.useState(!1),[i,o]=P.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:a}=Qst({city:e||void 0,status:i.status||void 0,propertyType:i.propertyType||void 0,minPrice:i.minPrice?Number(i.minPrice):void 0,maxPrice:i.maxPrice?Number(i.maxPrice):void 0}),h=y=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(y),p=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),t("")},x=e||i.status||i.propertyType||i.minPrice||i.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"LevelUp Listings - Find Your Dream Home | Real Estate for Sale"}),r.jsx("meta",{name:"description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, condos, townhouses, and luxury properties. View photos, prices, and connect with agents."}),r.jsx("link",{rel:"canonical",href:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{property:"og:description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, view photos, and connect with agents."}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{name:"twitter:description",content:"Browse exclusive property listings from LevelUp real estate agents."}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"keywords",content:"homes for sale, real estate, property listings, houses, condos, townhouses, luxury homes, LevelUp"}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"LevelUp Listings",url:"https://listings.relevelup.com",description:"Browse exclusive property listings from LevelUp real estate agents",potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:"https://listings.relevelup.com?q={search_term_string}"},"query-input":"required name=search_term_string"}})}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateAgent",name:"LevelUp",url:"https://relevelup.com",logo:"https://listings.relevelup.com/assets/levelup-logo-color.png"})})]}),r.jsxs("div",{className:"min-h-screen bg-gray-50",children:[r.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(co,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:QA,alt:"LevelUp",className:"h-8"})}),r.jsx("nav",{className:"hidden md:flex items-center gap-6",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors",children:"About LevelUp"})})]})})}),r.jsxs("section",{className:"relative bg-cover bg-center py-20 md:py-32",style:{backgroundImage:`url(${vst})`},children:[r.jsx("div",{className:"absolute inset-0 bg-black/40"}),r.jsxs("div",{className:"relative max-w-7xl mx-auto px-4",children:[r.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-3 text-center drop-shadow-lg",children:"Find Your Perfect Home"}),r.jsx("p",{className:"text-white/90 text-center mb-10 text-lg md:text-xl drop-shadow",children:"Exclusive listings from LevelUp agents"}),r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex gap-0 shadow-2xl rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"relative flex-1 bg-white",children:[r.jsx(Mi,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(ct,{placeholder:"Enter an address, neighborhood, city, or ZIP code",value:e,onChange:y=>t(y.target.value),className:"pl-12 h-14 md:h-16 text-base md:text-lg border-0 focus-visible:ring-0 rounded-none bg-white"})]}),r.jsx(J,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(Mi,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(J,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(GT,{className:"h-4 w-4"}),n?"Hide Filters":"More Filters"]})}),n&&r.jsxs("div",{className:"mt-4 p-6 bg-white rounded-lg shadow-xl",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Status"}),r.jsxs(bn,{value:i.status||"all",onValueChange:y=>o({...i,status:y==="all"?"":y}),children:[r.jsx(vn,{className:"bg-white",children:r.jsx(wn,{placeholder:"Any status"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"Any status"}),Object.entries(yje).map(([y,w])=>r.jsx(Kt,{value:y,children:w},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),r.jsxs(bn,{value:i.propertyType||"all",onValueChange:y=>o({...i,propertyType:y==="all"?"":y}),children:[r.jsx(vn,{className:"bg-white",children:r.jsx(wn,{placeholder:"Any type"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"Any type"}),Object.entries(tit).map(([y,w])=>r.jsx(Kt,{value:y,children:w},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),r.jsx(ct,{type:"number",placeholder:"No min",value:i.minPrice,onChange:y=>o({...i,minPrice:y.target.value}),className:"bg-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Max Price"}),r.jsx(ct,{type:"number",placeholder:"No max",value:i.maxPrice,onChange:y=>o({...i,maxPrice:y.target.value}),className:"bg-white"})]})]}),x&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(J,{variant:"ghost",size:"sm",onClick:p,className:"gap-1 text-gray-500",children:[r.jsx(Ts,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),r.jsx("section",{className:"py-8",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a?r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((y,w)=>r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[r.jsx(Pr,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Pr,{className:"h-7 w-28"}),r.jsx(Pr,{className:"h-4 w-full"}),r.jsx(Pr,{className:"h-4 w-3/4"})]})]},w))}):l&&l.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[l.length," ",l.length===1?"Home":"Homes"," Available"]})}),r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:l.map(y=>{var C,A,E;const w=((C=y.photos)==null?void 0:C.find(T=>T.is_primary))||((A=y.photos)==null?void 0:A[0]),S=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${y.slug||y.id}`:`/public/listing/${y.slug||y.id}`;return r.jsx(co,{to:S,children:r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-lg transition-shadow cursor-pointer group border border-gray-100",children:[r.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-gray-100",children:[w?r.jsx("img",{src:w.photo_url,alt:y.property_address||y.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(fi,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Ft,{className:`absolute top-2 left-2 ${eit[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:yje[y.status]}),r.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:T=>T.preventDefault(),children:r.jsx(oa,{className:"h-5 w-5 text-gray-600"})})]}),r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-xl font-bold text-gray-900 mb-1",children:h(y.price)}),r.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[y.bedrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bedrooms}),r.jsx("span",{className:"text-gray-500",children:"bds"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.bathrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bathrooms}),r.jsx("span",{className:"text-gray-500",children:"ba"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.square_footage&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.square_footage.toLocaleString()}),r.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),y.property_address&&r.jsx("p",{className:"text-sm text-gray-700 truncate",children:y.property_address}),r.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[y.city,", ",y.state]}),y.agent&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[r.jsx("p",{className:"text-xs text-gray-500 truncate",children:y.agent.name}),((E=y.agent.brokerage)==null?void 0:E.name)&&r.jsx("p",{className:"text-xs text-gray-400 truncate",children:y.agent.brokerage.name})]})]})]})},y.id)})})]}):r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full bg-gray-100 flex items-center justify-center",children:r.jsx(fi,{className:"h-10 w-10 text-gray-400"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No listings found"}),r.jsx("p",{className:"text-gray-500 mb-6",children:x?"Try adjusting your search or filters":"Check back soon for new listings"}),x&&r.jsx(J,{variant:"outline",onClick:p,children:"Clear filters"})]})})}),r.jsx("footer",{className:"bg-gray-900 text-white py-10 mt-auto",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("img",{src:Cge,alt:"LevelUp",className:"h-6"})}),r.jsxs("p",{className:"text-gray-400 text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-white text-sm transition-colors",children:"relevelup.com"})]})})})]})]})}const We=P.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));We.displayName="Card";const Wt=P.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("flex flex-col space-y-1.5 p-6",e),...t}));Wt.displayName="CardHeader";const Xt=P.forwardRef(({className:e,...t},n)=>r.jsx("h3",{ref:n,className:$t("text-2xl font-semibold leading-none tracking-tight",e),...t}));Xt.displayName="CardTitle";const En=P.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));En.displayName="CardDescription";const Xe=P.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("p-6 pt-0",e),...t}));Xe.displayName="CardContent";const sA=P.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("flex items-center p-6 pt-0",e),...t}));sA.displayName="CardFooter";var rit="Label",u6e=P.forwardRef((e,t)=>r.jsx(Rn.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));u6e.displayName=rit;var h6e=u6e;const nit=YC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ve=P.forwardRef(({className:e,...t},n)=>r.jsx(h6e,{ref:n,className:$t(nit(),e),...t}));Ve.displayName=h6e.displayName;function sit(){const e=km(),t=window.location.hostname;if(!(t==="listings.relevelup.com"||t.startsWith("listings.")))return null;const s=e.pathname.slice(1);return!s||s===""?r.jsx(d6e,{}):s.startsWith("public/")?null:r.jsx(iit,{slug:s})}function iit({slug:e}){return r.jsx(lit,{slug:e})}const ait={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},oit={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},vje={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function lit({slug:e}){var Z,re;const{data:t,isLoading:n}=l6e(e),s=c6e(),[i,o]=P.useState(""),[l,a]=P.useState(""),[h,p]=P.useState(""),[x,y]=P.useState(""),[w,j]=P.useState(!1),[S,C]=P.useState(!1),[A,E]=P.useState(null),T=ue=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ue),O=async ue=>{if(ue.preventDefault(),!(!i.trim()||!h.trim()||!t)){j(!0);try{await s.mutateAsync({listingId:t.id,agentId:t.agent_id,firstName:i.trim(),lastName:l.trim(),email:h.trim(),phone:x.trim()}),C(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(he){console.error("Lead submission error:",he),ze.error(`Failed to submit: ${he.message||"Please try again"}`)}finally{j(!1)}}},z=(t==null?void 0:t.photos)||[],F=z.find(ue=>ue.is_primary)||z[0],q=()=>{A!==null&&E(A===0?z.length-1:A-1)},H=()=>{A!==null&&E(A===z.length-1?0:A+1)};if(n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Pr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Pr,{className:"h-10 w-48 mb-6"}),r.jsx(Pr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Pr,{className:"h-12 w-48"}),r.jsx(Pr,{className:"h-6 w-full"}),r.jsx(Pr,{className:"h-6 w-3/4"})]}),r.jsx(Pr,{className:"h-64"})]})]})]});if(!t)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:QA,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(fi,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(J,{asChild:!0,children:r.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const K=t.property_address?`${t.property_address} - ${t.city}, ${t.state}`:`${t.city}, ${t.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[K," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${T(t.price)} - ${t.bedrooms||""}BD ${t.bathrooms||""}BA ${t.square_footage?t.square_footage.toLocaleString()+" sqft":""} ${vje[t.property_type]} in ${t.city}, ${t.state}. ${((Z=t.description)==null?void 0:Z.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:K}),r.jsx("meta",{property:"og:description",content:`${T(t.price)} - ${t.bedrooms||""}BD ${t.bathrooms||""}BA in ${t.city}, ${t.state}`}),r.jsx("meta",{property:"og:type",content:"website"}),F&&r.jsx("meta",{property:"og:image",content:F.photo_url})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:QA,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs("a",{href:"/",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),z.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>E(0),children:r.jsx("img",{src:F==null?void 0:F.photo_url,alt:"Primary",className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:z.slice(1,5).map((ue,he)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>E(he+1),children:[r.jsx("img",{src:ue.photo_url,alt:`Photo ${he+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),he===3&&z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",z.length-5," more"]})]},ue.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Ft,{className:`${ait[t.status]} text-white border-0`,children:oit[t.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:T(t.price)}),t.property_address&&r.jsx("p",{className:"text-xl font-medium",children:t.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(pl,{className:"h-4 w-4"}),t.city,", ",t.state,t.neighborhood&&` • ${t.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[t.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Vf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),t.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(qf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),t.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(xm,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),t.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(Ys,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ft,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),vje[t.property_type]]}),t.lot_size&&r.jsxs(Ft,{variant:"secondary",children:["Lot: ",t.lot_size]}),t.has_hoa&&r.jsx(Ft,{variant:"secondary",children:"HOA"})]}),t.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.description})]}),t.agent_notes&&t.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.agent_notes})]}),t.mls_link&&r.jsx(J,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:t.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[t.agent&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Cc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-semibold text-lg",children:t.agent.name}),((re=t.agent.brokerage)==null?void 0:re.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.agent.brokerage.name})]})]}),r.jsxs(We,{className:"border-primary",children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Xe,{children:S?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(Zs,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:O,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"firstName",children:"First Name *"}),r.jsx(ct,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:ue=>o(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"lastName",children:"Last Name"}),r.jsx(ct,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ue=>a(ue.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"email",children:"Email *"}),r.jsx(ct,{id:"email",type:"email",placeholder:"you@example.com",value:h,onChange:ue=>p(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"phone",children:"Phone"}),r.jsx(ct,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ue=>y(ue.target.value)})]}),r.jsx(J,{type:"submit",className:"w-full",disabled:w,children:w?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Br,{open:A!==null,onOpenChange:()=>E(null),children:r.jsxs(Fr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Hr,{className:"sr-only",children:r.jsx(qr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>E(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ts,{className:"h-5 w-5"})}),A!==null&&z[A]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:z[A].photo_url,alt:`Photo ${A+1}`,className:"w-full max-h-[80vh] object-contain"}),z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:q,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:H,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ga,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[A+1," / ",z.length]})]})]})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}const f6e=e=>Jt({queryKey:["agent-card-public",e],queryFn:async()=>{if(!e)throw new Error("No slug provided");const{data:t,error:n}=await ee.from("agent_cards").select("*").eq("slug",e).eq("is_published",!0).single();if(n)throw n;const{data:s}=await ee.from("profiles").select("name, email, phone, brokerage_id").eq("id",t.user_id).single();let i=null;if(s!=null&&s.brokerage_id){const{data:l}=await ee.from("brokerages").select("name").eq("id",s.brokerage_id).single();i=(l==null?void 0:l.name)||null}let o=null;try{const{data:l}=await ee.storage.from("avatars").list(`${t.user_id}`);if(l&&l.length>0){const{data:a}=ee.storage.from("avatars").getPublicUrl(`${t.user_id}/${l[0].name}`);o=a.publicUrl}}catch{}return{...t,social_links:t.social_links||[],profile:s||{name:null,email:null,phone:null,brokerage_id:null},brokerage_name:i,avatar_url:o}},enabled:!!e}),cit=()=>Jt({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:e,error:t}=await ee.from("agent_cards").select("*").order("created_at",{ascending:!1});if(t)throw t;return e}}),dit=e=>Jt({queryKey:["agent-card",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await ee.from("agent_cards").select("*").eq("user_id",e).maybeSingle();if(n)throw n;return t},enabled:!!e}),p6e=()=>{const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("agent_cards").insert(t).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card created")},onError:t=>ze.error(t.message)})},m6e=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("agent_cards").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card updated")},onError:t=>ze.error(t.message)})},Sa=async(e,t,n,s)=>{const i=new URLSearchParams(window.location.search);await ee.from("agent_card_interactions").insert({card_id:e,interaction_type:t,interaction_detail:n||null,referrer:document.referrer||null,user_agent:navigator.userAgent||null,utm_source:i.get("utm_source")||null,utm_medium:i.get("utm_medium")||null,utm_campaign:i.get("utm_campaign")||null,metadata:{}})},uit=async(e,t)=>{const{error:n}=await ee.from("agent_card_leads").insert({card_id:e,...t});if(n)throw n},g6e=e=>Jt({queryKey:["agent-card-analytics",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await ee.from("agent_card_interactions").select("interaction_type, interaction_detail, created_at").eq("card_id",e).order("created_at",{ascending:!1}).limit(500);if(n)throw n;const{data:s,error:i}=await ee.from("agent_card_leads").select("*").eq("card_id",e).order("created_at",{ascending:!1});if(i)throw i;const o=(t==null?void 0:t.filter(h=>h.interaction_type==="card_view").length)||0,l=(t==null?void 0:t.filter(h=>h.interaction_type==="button_click").length)||0,a=(t==null?void 0:t.filter(h=>h.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:a,leads:s||[],interactions:t||[]}},enabled:!!e});var x6e={exports:{}},y6e={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var aC=P;function hit(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fit=typeof Object.is=="function"?Object.is:hit,pit=aC.useState,mit=aC.useEffect,git=aC.useLayoutEffect,xit=aC.useDebugValue;function yit(e,t){var n=t(),s=pit({inst:{value:n,getSnapshot:t}}),i=s[0].inst,o=s[1];return git(function(){i.value=n,i.getSnapshot=t,qle(i)&&o({inst:i})},[e,n,t]),mit(function(){return qle(i)&&o({inst:i}),e(function(){qle(i)&&o({inst:i})})},[e]),xit(n),n}function qle(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!fit(e,n)}catch{return!0}}function vit(e,t){return t()}var _it=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?vit:yit;y6e.useSyncExternalStore=aC.useSyncExternalStore!==void 0?aC.useSyncExternalStore:_it;x6e.exports=y6e;var bit=x6e.exports;function wit(){return bit.useSyncExternalStore(jit,()=>!0,()=>!1)}function jit(){return()=>{}}var Tge="Avatar",[kit]=Ql(Tge),[Nit,v6e]=kit(Tge),_6e=P.forwardRef((e,t)=>{const{__scopeAvatar:n,...s}=e,[i,o]=P.useState("idle");return r.jsx(Nit,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:r.jsx(Rn.span,{...s,ref:t})})});_6e.displayName=Tge;var b6e="AvatarImage",w6e=P.forwardRef((e,t)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:i=()=>{},...o}=e,l=v6e(b6e,n),a=Sit(s,o),h=Gl(p=>{i(p),l.onImageLoadingStatusChange(p)});return Yl(()=>{a!=="idle"&&h(a)},[a,h]),a==="loaded"?r.jsx(Rn.img,{...o,ref:t,src:s}):null});w6e.displayName=b6e;var j6e="AvatarFallback",k6e=P.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:s,...i}=e,o=v6e(j6e,n),[l,a]=P.useState(s===void 0);return P.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>a(!0),s);return()=>window.clearTimeout(h)}},[s]),l&&o.imageLoadingStatus!=="loaded"?r.jsx(Rn.span,{...i,ref:t}):null});k6e.displayName=j6e;function _je(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Sit(e,{referrerPolicy:t,crossOrigin:n}){const s=wit(),i=P.useRef(null),o=s?(i.current||(i.current=new window.Image),i.current):null,[l,a]=P.useState(()=>_je(o,e));return Yl(()=>{a(_je(o,e))},[o,e]),Yl(()=>{const h=y=>()=>{a(y)};if(!o)return;const p=h("loaded"),x=h("error");return o.addEventListener("load",p),o.addEventListener("error",x),t&&(o.referrerPolicy=t),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",p),o.removeEventListener("error",x)}},[o,n,t]),l}var N6e=_6e,S6e=w6e,C6e=k6e;const ci=P.forwardRef(({className:e,...t},n)=>r.jsx(N6e,{ref:n,className:$t("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ci.displayName=N6e.displayName;const Wa=P.forwardRef(({className:e,...t},n)=>r.jsx(S6e,{ref:n,className:$t("aspect-square h-full w-full",e),...t}));Wa.displayName=S6e.displayName;const di=P.forwardRef(({className:e,...t},n)=>r.jsx(C6e,{ref:n,className:$t("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));di.displayName=C6e.displayName;function Yne({open:e,onOpenChange:t,cardId:n,type:s,agentName:i}){const[o,l]=P.useState(""),[a,h]=P.useState(""),[p,x]=P.useState(""),[y,w]=P.useState(""),[j,S]=P.useState(""),[C,A]=P.useState(!1),E=async T=>{if(T.preventDefault(),!o.trim()){ze.error("Please enter your name");return}A(!0);try{await uit(n,{lead_type:s,name:o.trim(),email:a.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}),Sa(n,"lead_submitted",s),ee.functions.invoke("card-lead-notify",{body:{cardId:n,leadType:s,name:o.trim(),email:a.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}}).catch(O=>console.error("Card lead notify failed:",O)),ze.success(s==="booking"?"Request sent! They'll be in touch soon.":s==="connect"?"Info shared! They'll be in touch soon.":"Referral submitted! Thank you."),t(!1),l(""),h(""),x(""),w(""),S("")}catch{ze.error("Something went wrong. Please try again.")}finally{A(!1)}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(es,{children:s==="booking"?`Let ${i} know you'd like to connect.`:s==="connect"?`Share your info and ${i} will reach out.`:`Know someone who could use ${i}'s help?`})]}),r.jsxs("form",{onSubmit:E,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"lead-name",children:"Name *"}),r.jsx(ct,{id:"lead-name",value:o,onChange:T=>l(T.target.value),placeholder:"Your name",required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"lead-phone",children:"Phone"}),r.jsx(ct,{id:"lead-phone",type:"tel",value:p,onChange:T=>x(T.target.value),placeholder:"(555) 123-4567"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"lead-email",children:"Email"}),r.jsx(ct,{id:"lead-email",type:"email",value:a,onChange:T=>h(T.target.value),placeholder:"you@example.com"})]}),s==="booking"&&r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(bn,{value:y,onValueChange:w,children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select one"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"buy",children:"Buy a home"}),r.jsx(Kt,{value:"sell",children:"Sell my home"}),r.jsx(Kt,{value:"both",children:"Buy & Sell"}),r.jsx(Kt,{value:"other",children:"Something else"})]})]})]}),s!=="connect"&&r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"lead-message",children:s==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(ct,{id:"lead-message",value:j,onChange:T=>S(T.target.value),placeholder:s==="referral"?"Their name, phone, situation...":"Anything you'd like us to know"})]}),r.jsx(J,{type:"submit",className:"w-full rounded-2xl",disabled:C,children:C?"Sending...":"Submit"})]})]})})}const Cit=e=>Jt({queryKey:["card-blocks",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await ee.from("card_blocks").select("*").eq("card_id",e).eq("is_visible",!0).order("sort_order",{ascending:!0});if(n)throw n;return t||[]},enabled:!!e}),Mit=e=>Jt({queryKey:["card-blocks-all",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await ee.from("card_blocks").select("*").eq("card_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t||[]},enabled:!!e}),Tit=()=>{const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("card_blocks").insert(t).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["card-blocks",n.card_id]}),e.invalidateQueries({queryKey:["card-blocks-all",n.card_id]}),ze.success("Block added")},onError:t=>ze.error(t.message)})},Ait=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("card_blocks").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block updated")},onError:t=>ze.error(t.message)})},Eit=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("card_blocks").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block removed")},onError:t=>ze.error(t.message)})};function Iit(e){const t=e.match(/(?:iframe\.mediadelivery\.net\/embed\/|video\.bunnycdn\.com\/play\/)(\d+)\/([a-f0-9-]+)/i);return t?`https://iframe.mediadelivery.net/embed/${t[1]}/${t[2]}?autoplay=false&responsive=true`:(e.includes("iframe.mediadelivery.net"),e)}function Pit(e){const t=e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/);return t?`https://www.youtube.com/embed/${t[1]}`:null}const Lit={standard:"rounded-2xl overflow-hidden mb-6 bg-slate-100",luxury:"rounded-xl overflow-hidden mb-6 bg-[#1e2636] border border-[#c9a84c]/10",bold:"rounded-2xl overflow-hidden mb-6",classic:"rounded-lg overflow-hidden mb-6 border border-[#d4cfc5] shadow-sm"};function Oit({block:e,variant:t}){const n=e.config;if(!n.video_url)return null;const s=n.video_url.includes("mediadelivery.net")||n.video_url.includes("bunnycdn.com"),i=Pit(n.video_url),o=s||!!i,l=s?Iit(n.video_url):i||n.video_url;return r.jsx("div",{className:Lit[t],children:o?r.jsx("div",{style:{position:"relative",paddingTop:"56.25%"},children:r.jsx("iframe",{src:l,loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,width:"100%",height:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsx("video",{src:n.video_url,controls:!0,className:"w-full",preload:"metadata"})})}const Dit={standard:{container:"mb-6",card:"bg-slate-50 rounded-2xl p-5 border border-slate-100",quote:"text-sm text-slate-600 italic",name:"text-sm font-semibold text-slate-800",role:"text-xs text-slate-500",dot:"bg-primary",dotInactive:"bg-slate-300",nav:"text-slate-400 hover:text-slate-600"},luxury:{container:"mb-6",card:"bg-[#1e2636] rounded-xl p-5 border border-[#c9a84c]/10",quote:"text-sm text-[#a0aec0] italic font-serif",name:"text-sm font-semibold text-white",role:"text-xs text-[#c9a84c]",dot:"bg-[#c9a84c]",dotInactive:"bg-[#2a3040]",nav:"text-[#4a5568] hover:text-[#c9a84c]"},bold:{container:"mb-6",card:"bg-[#fff3e0] rounded-2xl p-5",quote:"text-sm text-[#1a1a2e] font-medium",name:"text-sm font-black text-[#1a1a2e]",role:"text-xs text-[#ff5722] font-bold",dot:"bg-[#ff5722]",dotInactive:"bg-gray-300",nav:"text-gray-400 hover:text-[#ff5722]"},classic:{container:"mb-6",card:"bg-white rounded-lg p-5 border border-[#d4cfc5] shadow-sm",quote:"text-sm text-[#4a5568] italic font-serif",name:"text-sm font-semibold text-[#1b3a4b]",role:"text-xs text-[#5a7a6f]",dot:"bg-[#1b3a4b]",dotInactive:"bg-[#d4cfc5]",nav:"text-[#a0aec0] hover:text-[#1b3a4b]"}};function Rit({block:e,variant:t}){const s=e.config.testimonials||[],[i,o]=P.useState(0);if(s.length===0)return null;const l=Dit[t],a=s[i];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(UT,{className:"h-4 w-4 mb-2 opacity-30"}),r.jsxs("p",{className:`${l.quote} mb-3`,children:['"',a.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:l.name,children:a.name}),a.role&&r.jsx("p",{className:l.role,children:a.role})]})]}),s.length>1&&r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[r.jsx("button",{onClick:()=>o(h=>(h-1+s.length)%s.length),className:l.nav,children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:s.map((h,p)=>r.jsx("div",{className:`h-1.5 w-1.5 rounded-full transition-colors cursor-pointer ${p===i?l.dot:l.dotInactive}`,onClick:()=>o(p)},p))}),r.jsx("button",{onClick:()=>o(h=>(h+1)%s.length),className:l.nav,children:r.jsx(Ga,{className:"h-4 w-4"})})]})]})}const Fit={standard:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-primary/10 text-primary"},luxury:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-[#c9a84c]/10 text-[#e8d48b] border border-[#c9a84c]/20"},bold:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-black rounded-full bg-[#1a1a2e] text-white uppercase tracking-wide"},classic:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-md bg-[#1b3a4b]/10 text-[#1b3a4b] border border-[#d4cfc5]"}};function zit({block:e,variant:t}){const s=e.config.tags||[];if(s.length===0)return null;const i=Fit[t];return r.jsx("div",{className:i.container,children:s.map((o,l)=>r.jsx("span",{className:i.tag,children:o},l))})}const Bit={standard:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-2xl bg-slate-50 hover:bg-slate-100 border border-slate-100 transition-colors text-sm font-medium text-slate-700",icon:"text-primary"},luxury:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-xl bg-[#1e2636] hover:bg-[#252d3f] border border-[#c9a84c]/10 transition-colors text-sm font-medium text-[#e2e8f0]",icon:"text-[#c9a84c]"},bold:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-2xl bg-gray-50 hover:bg-gray-100 transition-colors text-sm font-bold text-[#1a1a2e]",icon:"text-[#ff5722]"},classic:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-lg bg-white hover:bg-[#f5f1eb] border border-[#d4cfc5] shadow-sm transition-colors text-sm font-medium text-[#1b3a4b]",icon:"text-[#5a7a6f]"}};function $it({block:e,cardId:t,variant:n}){const i=e.config.links||[];if(i.length===0)return null;const o=Bit[n];return r.jsx("div",{className:o.container,children:i.map((l,a)=>r.jsxs("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(t,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(Ls,{className:`h-4 w-4 ${o.icon}`})]},a))})}const ihe={instagram:{label:"Instagram",icon:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z",color:"#E4405F",hoverBg:"hover:bg-[#E4405F]/10"},facebook:{label:"Facebook",icon:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z",color:"#1877F2",hoverBg:"hover:bg-[#1877F2]/10"},linkedin:{label:"LinkedIn",icon:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",color:"#0A66C2",hoverBg:"hover:bg-[#0A66C2]/10"},twitter:{label:"X",icon:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z",color:"#000000",hoverBg:"hover:bg-black/10"},youtube:{label:"YouTube",icon:"M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814z M9.545 15.568V8.432L15.818 12z",color:"#FF0000",hoverBg:"hover:bg-[#FF0000]/10"},tiktok:{label:"TikTok",icon:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z",color:"#000000",hoverBg:"hover:bg-black/10"},zillow:{label:"Zillow",icon:"M12 0L1 6v12l11 6 11-6V6L12 0zm0 2.18L21 7.5v9L12 21.82 3 16.5v-9L12 2.18z",color:"#006AFF",hoverBg:"hover:bg-[#006AFF]/10"},realtor:{label:"Realtor",icon:"M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18l8 4v8l-8 4-8-4v-8l8-4z",color:"#D92228",hoverBg:"hover:bg-[#D92228]/10"}};function Uit({path:e,color:t,size:n=20}){return r.jsx("svg",{viewBox:"0 0 24 24",width:n,height:n,fill:t,children:r.jsx("path",{d:e})})}const qit={standard:{container:"bg-white rounded-2xl border border-slate-100 p-5 mb-6 shadow-sm",title:"text-sm font-semibold text-slate-800 mb-3",linkClass:"h-11 w-11 rounded-xl bg-slate-50 border border-slate-100 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:shadow-md"},luxury:{container:"bg-zinc-900/50 backdrop-blur rounded-2xl border border-amber-900/20 p-5 mb-6",title:"text-sm font-semibold text-amber-200/80 mb-3",linkClass:"h-11 w-11 rounded-xl bg-zinc-800/80 border border-amber-900/20 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:border-amber-500/40 hover:shadow-md hover:shadow-amber-500/10"},bold:{container:"bg-white/10 backdrop-blur rounded-2xl border border-white/20 p-5 mb-6",title:"text-sm font-semibold text-white/90 mb-3",linkClass:"h-11 w-11 rounded-xl bg-white/10 border border-white/20 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:bg-white/20 hover:shadow-md"},classic:{container:"bg-stone-50 rounded-2xl border border-stone-200 p-5 mb-6",title:"text-sm font-semibold text-stone-800 mb-3",linkClass:"h-11 w-11 rounded-xl bg-white border border-stone-200 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:shadow-md"}};function Vit({block:e,cardId:t,variant:n}){const i=e.config.platforms||[],o=qit[n];return i.length===0?null:r.jsxs("div",{className:o.container,children:[r.jsx("h3",{className:o.title,children:"Follow Me"}),r.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:i.map((l,a)=>{const h=ihe[l.platform.toLowerCase()];return!h||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(t,"button_click",`social_${l.platform}`),className:o.linkClass,title:h.label,children:r.jsx(Uit,{path:h.icon,color:h.color})},a)})})]})}function Xne({cardId:e,variant:t}){const{data:n}=Cit(e);return!n||n.length===0?null:r.jsx(r.Fragment,{children:n.map(s=>{switch(s.block_type){case"video_intro":return r.jsx(Oit,{block:s,variant:t},s.id);case"testimonials":return r.jsx(Rit,{block:s,variant:t},s.id);case"specialties":return r.jsx(zit,{block:s,variant:t},s.id);case"custom_links":return r.jsx($it,{block:s,cardId:e,variant:t},s.id);case"social_media":return r.jsx(Vit,{block:s,cardId:e,variant:t},s.id);default:return null}})})}async function Hit(e){try{const t=await fetch(e);if(!t.ok)return null;const n=await t.blob(),s=n.type||"image/jpeg";return new Promise(i=>{const o=new FileReader;o.onloadend=()=>{const a=o.result.split(",")[1];i({base64:a,mimeType:s})},o.onerror=()=>i(null),o.readAsDataURL(n)})}catch{return null}}function Wit(e){const t=e.trim().split(/\s+/);if(t.length<=1)return{first:t[0]||"",last:""};const n=t.pop();return{first:t.join(" "),last:n}}async function Qne(e){const{first:t,last:n}=Wit(e.name),s=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`,`N:${n};${t};;;`];if(e.phone&&s.push(`TEL;TYPE=CELL:${e.phone}`),e.email&&s.push(`EMAIL;TYPE=INTERNET:${e.email}`),e.brokerage&&s.push(`ORG:${e.brokerage}`),s.push(`URL:${e.cardUrl}`),e.avatarUrl){const a=await Hit(e.avatarUrl);if(a){const p={"image/jpeg":"JPEG","image/jpg":"JPEG","image/png":"PNG","image/gif":"GIF","image/webp":"JPEG"}[a.mimeType]||"JPEG";s.push(`PHOTO;ENCODING=b;TYPE=${p}:${a.base64}`)}}s.push("END:VCARD");const i=new Blob([s.join(`\r `)],{type:"text/vcard"}),o=URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=`${e.name.replace(/\s+/g,"_")}.vcf`,l.click(),URL.revokeObjectURL(o),ze.success("Contact saved!")}function Git({card:e}){var E;const[t,n]=P.useState(!1),[s,i]=P.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,O)=>{Sa(e.id,"button_click",T),O()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},w=()=>{var T,O;Sa(e.id,"contact_saved"),Qne({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(O=e.profile)==null?void 0:O.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:e.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},S=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 via-white to-slate-50",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(ci,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Wa,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-semibold bg-primary text-primary-foreground",children:l})]}),r.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-medium text-primary mb-1",children:e.title}),e.brokerage_name&&r.jsx("p",{className:"text-sm font-medium text-slate-500 mb-3",children:e.brokerage_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-slate-600 italic leading-relaxed max-w-xs mx-auto",children:['"',e.positioning_statement,'"']})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[r.jsxs(J,{onClick:h,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(ca,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),r.jsxs(J,{onClick:p,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(Po,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),r.jsxs(J,{onClick:x,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(Zs,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),r.jsxs(J,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[r.jsx(Ys,{className:"h-5 w-5 mr-2"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm text-slate-600",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-amber-500 fill-amber-500"}),r.jsx("span",{className:"font-bold text-slate-900",children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"bg-slate-50 rounded-2xl p-4 mb-6 border border-slate-100",children:r.jsxs("p",{className:"text-sm text-slate-600 italic text-center",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-2",children:"About Me"}),r.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:e.bio})]}),r.jsx(Xne,{cardId:e.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[e.show_save_contact&&r.jsxs(J,{variant:"ghost",onClick:w,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Xa,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs(J,{variant:"ghost",onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(vs,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),e.show_refer_friend&&r.jsxs(J,{variant:"ghost",onClick:S,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Kn,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),r.jsxs(J,{variant:"ghost",onClick:C,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Qh,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),r.jsxs(J,{variant:"ghost",onClick:j,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(dc,{className:"h-4 w-4 mr-3 text-primary"}),"Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,O)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-slate-100 hover:bg-slate-200 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},O))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-slate-400",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Kit({card:e}){var E;const[t,n]=P.useState(!1),[s,i]=P.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,O)=>{Sa(e.id,"button_click",T),O()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},w=()=>{var T,O;Sa(e.id,"contact_saved"),Qne({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(O=e.profile)==null?void 0:O.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:e.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},S=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#0f1419] via-[#1a1f2e] to-[#0f1419]",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsx("div",{className:"w-16 h-0.5 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] mx-auto mb-8"}),r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(ci,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(Wa,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-serif bg-[#c9a84c]/20 text-[#e8d48b]",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-white tracking-wide mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-medium text-[#e8d48b] mb-1",children:e.title}),e.brokerage_name&&r.jsx("p",{className:"text-sm font-medium text-[#c9a84c] tracking-widest uppercase mb-3",children:e.brokerage_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-[#a0aec0] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',e.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:ca,label:"Call",handler:h},{icon:Po,label:"Text",handler:p},{icon:Zs,label:"Email",handler:x}].map(({icon:T,label:O,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-[#1e2636] hover:bg-[#252d3f] border border-[#c9a84c]/20 rounded-xl transition-colors",children:[r.jsx(T,{className:"h-5 w-5 text-[#c9a84c]"}),r.jsx("span",{className:"text-xs font-medium text-[#e2e8f0]",children:O})]},O))}),r.jsxs("button",{onClick:y,className:"w-full h-12 text-base font-semibold rounded-xl mb-6 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] text-[#0f1419] hover:opacity-90 transition-opacity flex items-center justify-center gap-2",children:[r.jsx(Ys,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c] fill-[#c9a84c]"}),r.jsx("span",{className:"font-bold text-white",children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"bg-[#1e2636] rounded-xl p-4 mb-6 border border-[#c9a84c]/10",children:r.jsxs("p",{className:"text-sm text-[#a0aec0] italic text-center font-serif",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#c9a84c] mb-2 tracking-wide uppercase",children:"About"}),r.jsx("p",{className:"text-sm text-[#a0aec0] leading-relaxed",children:e.bio})]}),r.jsx(Xne,{cardId:e.id,variant:"luxury"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:w,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Xa,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:S,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Kn,{className:"h-4 w-4 text-[#c9a84c]"})," Refer a Friend"]}),r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Qh,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(dc,{className:"h-4 w-4 text-[#c9a84c]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,O)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-[#1e2636] border border-[#c9a84c]/20 hover:border-[#c9a84c]/50 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},O))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Zit({card:e}){var E;const[t,n]=P.useState(!1),[s,i]=P.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,O)=>{Sa(e.id,"button_click",T),O()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},w=()=>{var T,O;Sa(e.id,"contact_saved"),Qne({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(O=e.profile)==null?void 0:O.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},S=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#ff5722]",children:[r.jsxs("div",{className:"bg-[#1a1a2e] px-5 pt-10 pb-14 text-center relative",children:[e.show_photo&&r.jsxs(ci,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-[#ff5722] shadow-2xl",children:[r.jsx(Wa,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-black bg-[#ff5722] text-white",children:l})]}),r.jsx("h1",{className:"text-3xl font-black text-white tracking-tight mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-bold text-[#ff5722]/80 mb-1",children:e.title}),e.brokerage_name&&r.jsx("p",{className:"text-sm font-bold text-[#ff5722] uppercase tracking-wider",children:e.brokerage_name})]}),r.jsxs("div",{className:"max-w-md mx-auto px-5 -mt-6",children:[r.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl px-5 py-8",children:[e.positioning_statement&&r.jsx("p",{className:"text-center text-[#1a1a2e] font-bold text-lg leading-snug mb-6 max-w-xs mx-auto",children:e.positioning_statement}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:ca,label:"Call",handler:h},{icon:Po,label:"Text",handler:p},{icon:Zs,label:"Email",handler:x}].map(({icon:T,label:O,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-[#1a1a2e] hover:bg-[#2a2a4e] text-white rounded-2xl transition-colors font-bold",children:[r.jsx(T,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs",children:O})]},O))}),r.jsxs("button",{onClick:y,className:"w-full h-14 text-base font-black rounded-2xl mb-6 bg-[#ff5722] hover:bg-[#e64a19] text-white transition-colors flex items-center justify-center gap-2 uppercase tracking-wide",children:[r.jsx(Ys,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-5 mb-6",children:e.review_snippet&&r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-5 w-5 text-[#ff5722] fill-[#ff5722]"}),r.jsx("span",{className:"font-black text-[#1a1a2e] text-2xl",children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"bg-[#fff3e0] rounded-2xl p-4 mb-6",children:r.jsxs("p",{className:"text-sm text-[#1a1a2e] font-medium text-center",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-xs font-black text-[#ff5722] mb-2 uppercase tracking-wider",children:"About Me"}),r.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:e.bio})]}),r.jsx(Xne,{cardId:e.id,variant:"bold"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:w,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(Xa,{className:"h-4 w-4 text-[#ff5722]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(vs,{className:"h-4 w-4 text-[#ff5722]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:S,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(Kn,{className:"h-4 w-4 text-[#ff5722]"})," Refer a Friend"]}),r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(Qh,{className:"h-4 w-4 text-[#ff5722]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(dc,{className:"h-4 w-4 text-[#ff5722]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-6",children:e.social_links.slice(0,3).map((T,O)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-[#1a1a2e] hover:bg-[#2a2a4e] flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},O))})]}),r.jsx("div",{className:"text-center py-6",children:r.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Yit({card:e}){var E;const[t,n]=P.useState(!1),[s,i]=P.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,O)=>{Sa(e.id,"button_click",T),O()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},w=()=>{var T,O;Sa(e.id,"contact_saved"),Qne({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(O=e.profile)==null?void 0:O.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},S=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#f5f1eb]",children:[r.jsx("div",{className:"bg-[#1b3a4b] h-2"}),r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(ci,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Wa,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-serif bg-[#1b3a4b] text-white",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-[#1b3a4b] mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:e.title}),e.brokerage_name&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-3",children:e.brokerage_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-[#4a5568] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',e.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:ca,label:"Call",handler:h},{icon:Po,label:"Text",handler:p},{icon:Zs,label:"Email",handler:x}].map(({icon:T,label:O,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-white hover:bg-[#e8e3db] border border-[#d4cfc5] rounded-lg transition-colors shadow-sm",children:[r.jsx(T,{className:"h-5 w-5 text-[#1b3a4b]"}),r.jsx("span",{className:"text-xs font-semibold text-[#1b3a4b]",children:O})]},O))}),r.jsxs("button",{onClick:y,className:"w-full h-12 text-base font-semibold rounded-lg mb-6 bg-[#1b3a4b] hover:bg-[#264d61] text-white transition-colors flex items-center justify-center gap-2 shadow-sm",children:[r.jsx(Ys,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsx("div",{className:"flex items-center justify-center gap-6",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843] fill-[#d4a843]"}),r.jsx("span",{className:"font-bold text-[#1b3a4b] font-serif",children:"5.0"})]})})}),e.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsxs("p",{className:"text-sm text-[#4a5568] italic text-center font-serif",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#1b3a4b] mb-2 font-serif",children:"About"}),r.jsx("p",{className:"text-sm text-[#4a5568] leading-relaxed",children:e.bio})]}),r.jsx(Xne,{cardId:e.id,variant:"classic"}),r.jsxs("div",{className:"bg-white rounded-lg border border-[#d4cfc5] shadow-sm divide-y divide-[#e8e3db] mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:w,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Xa,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:S,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Kn,{className:"h-4 w-4 text-[#5a7a6f]"})," Refer a Friend"]}),r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Qh,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(dc,{className:"h-4 w-4 text-[#5a7a6f]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,O)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-white border border-[#d4cfc5] hover:bg-[#e8e3db] flex items-center justify-center text-lg transition-colors shadow-sm",children:A[T.platform.toLowerCase()]||"🔗"},O))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function M6e({card:e}){switch(e.theme){case"luxury":return r.jsx(Kit,{card:e});case"bold":return r.jsx(Zit,{card:e});case"classic":return r.jsx(Yit,{card:e});case"standard":default:return r.jsx(Git,{card:e})}}function Xit(){const e=km();P.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]);const t=e.pathname.slice(1);return!t||t===""?r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Agent Cards"}),r.jsx("p",{className:"text-slate-500",children:"Visit a specific agent's card URL to view their digital business card."})]})}):r.jsx(Qit,{slug:t})}function Qit({slug:e}){return r.jsx(Jit,{slug:e})}function Jit({slug:e}){var o;const{data:t,isLoading:n,error:s}=f6e(e);if(P.useEffect(()=>{t!=null&&t.id&&Sa(t.id,"card_view")},[t==null?void 0:t.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Pr,{className:"h-28 w-28 rounded-full"}),r.jsx(Pr,{className:"h-6 w-48"}),r.jsx(Pr,{className:"h-4 w-36"})]}),r.jsx(Pr,{className:"h-12 w-full"}),r.jsx(Pr,{className:"h-12 w-full"})]})});if(s||!t)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const i=((o=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[i," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.positioning_statement||`Connect with ${i}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${i} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:t.positioning_statement||`Connect with ${i}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(M6e,{card:t})]})}const ahe="levelup_affiliate_ref",eat=30,tat=()=>{const[e]=Fd();P.useEffect(()=>{const t=e.get("ref");if(t){const n={code:t.toUpperCase(),timestamp:Date.now()};localStorage.setItem(ahe,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",t)}},[e])},rat=()=>{try{const e=localStorage.getItem(ahe);if(!e)return null;const t=JSON.parse(e),n=eat*24*60*60*1e3;return Date.now()-t.timestamp>n?(localStorage.removeItem(ahe),console.log("[Affiliate] Referral code expired"),null):t.code}catch{return null}},tte="/assets/levelup-logo-header-_ZX7DvlA.png",nat="/assets/scale-your-team-ku4MPatU.png";function sat({open:e,onOpenChange:t}){return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-[#4a6b6d]/10 rounded-lg",children:r.jsx(na,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(es,{children:"Learn how LevelUp can empower your entire team"})]})]})}),e&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/brokerinterestmeeting",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Brokerage Interest Meeting"})]})})}const sd={individual_agent:{name:"Individual Agent",price:"$39",period:"/month",description:"Perfect for independent agents ready to level up",features:["Full dashboard access","300+ professional templates","Academy training library","Community & networking","Live events & workshops","Social media content","Newsletter resources","Email support"],trial:"7-day free trial"},brokerage_under_25:{name:"Brokerage",subtitle:"Under 25 Agents",price:"$299",period:"/month",description:"Empower your entire team to succeed",features:["Everything in Individual","Brokerage manager dashboard","Invite & manage up to 25 agents","Exclusive brokerage resources","Team performance analytics","Agent onboarding tools","Resource sharing","Priority support"]},brokerage_over_25:{name:"Brokerage",subtitle:"Over 25 Agents",price:"$499",period:"/month",description:"Scale your brokerage without limits",features:["Everything in Brokerage","Unlimited agents","Advanced team analytics","Dedicated account manager","Custom onboarding sessions","White-glove support"]}},iat=[{icon:Of,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Ld,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Ys,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Zl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Ai,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Va,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],aat=[{icon:Kn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ss,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:ca,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Gh,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:pl,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:ac,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:oa,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:jg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],oat=[{name:"Sarah M.",role:"Top Producer, RE/MAX",quote:"LevelUp completely transformed how I run my business. The templates alone save me hours every week."},{name:"Mike T.",role:"Brokerage Owner",quote:"Onboarding new agents used to take weeks. Now they're productive from day one with all the training resources."},{name:"Jessica L.",role:"Team Lead",quote:"The community is incredible. I've learned more from other agents here than any conference I've attended."}],lat=()=>{const{user:e,loading:t}=zr(),n=ns(),[s]=Fd();P.useEffect(()=>{const H=window.location.host==="listings.relevelup.com",K=window.location.pathname==="/";if(H&&K){n("/public/listings",{replace:!0});return}},[n]);const[i,o]=P.useState(null),[l,a]=P.useState(null),[h,p]=P.useState(!1),[x,y]=P.useState(""),[w,j]=P.useState(""),[S,C]=P.useState(""),[A,E]=P.useState(!1),[T,O]=P.useState(!1),z=(H,K=!1)=>{a({tier:H,skipTrial:K}),p(!0)};tat(),P.useEffect(()=>{const H=window.location.host==="listings.relevelup.com",K=location.pathname.startsWith("/public/");!t&&e&&!H&&!K&&n("/dashboard")},[e,t,n,location.pathname]),P.useEffect(()=>{s.get("canceled")==="true"&&ze.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const F=async(H,K=!1)=>{if(!x){ze.error("Please enter your email address");return}if(!w.trim()){ze.error("Please enter your full name");return}E(!0),o(H+(K?"_direct":""));const Z=rat();try{const{data:re,error:ue}=await ee.functions.invoke("create-checkout",{body:{tier:H,email:x,name:w.trim(),couponCode:S.trim()||void 0,skipTrial:K,referralCode:Z}});if(ue)throw ue;if(re!=null&&re.url)window.open(re.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(re){console.error("Checkout error:",re),ze.error(re.message||"Failed to start checkout. Please try again.")}finally{E(!1),o(null),p(!1),a(null)}},q=()=>{l&&F(l.tier,l.skipTrial)};return t?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#4a6b6d]",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-white border-t-transparent"})}):r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(J,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var H;return(H=document.getElementById("features"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(J,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(J,{onClick:()=>n("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("p",{className:"text-lg text-white/80 max-w-3xl mx-auto leading-relaxed font-sans font-bold md:text-4xl",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[r.jsxs(J,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("free-trial"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",children:["Start Your Free Trial",r.jsx(Ko,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(J,{size:"lg",variant:"outline",onClick:()=>{var H;return(H=document.getElementById("features"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#1e3a4c] rounded-full",children:"See What's Included"})]})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Learn how we support agents and empower brokerages to grow—together."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center pt-4",children:[r.jsxs(J,{size:"lg",variant:"outline",onClick:()=>{var H;return(H=document.getElementById("brokerage"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(na,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(J,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(Cc,{className:"mr-2 h-5 w-5"}),"Individual Membership"]})]})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:iat.map((H,K)=>r.jsxs(We,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Wt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(H.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Xt,{className:"text-xl font-sans",children:H.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:H.description})})]},K))})]})}),r.jsxs("section",{id:"agent-os",className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Ss,{className:"w-4 h-4"}),"Included with Membership"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:aat.map((H,K)=>r.jsxs(We,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(H.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Xt,{className:"text-lg font-semibold text-white",children:H.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:H.description})})]},K))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(J,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-white text-[#4a6b6d] hover:bg-white/90 shadow-xl transition-all hover:scale-105",children:["Get Agent OS with Your Membership",r.jsx(Ko,{className:"ml-2 w-5 h-5"})]})})]})]}),r.jsx("section",{id:"brokerage",className:"py-20 bg-[#4a6b6d]/5",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsx("div",{className:"max-w-6xl mx-auto",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[#4a6b6d]/10 text-[#4a6b6d] text-sm font-medium",children:[r.jsx(na,{className:"w-4 h-4"}),"For Brokerages"]}),r.jsxs("h2",{className:"text-3xl font-sans font-bold md:text-6xl",children:["Empower Your"," ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Entire Team"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Give every agent on your team access to world-class training and resources. Track performance, streamline onboarding, and watch your brokerage thrive."}),r.jsx("ul",{className:"space-y-4",children:["Dedicated brokerage manager dashboard","Invite and manage agents with one click","Exclusive brokerage-only resources","Team analytics and performance tracking","Simplified agent onboarding","Share resources across your team"].map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ca,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:H})]},K))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(J,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Ga,{className:"ml-2 w-5 h-5"})]}),r.jsxs(J,{size:"lg",variant:"outline",onClick:()=>O(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(Ys,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:nat,alt:"Scale Your Team from 5 to 500 Agents",className:"w-full rounded-3xl shadow-lg"})})]})})})}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Agents Love ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"LevelUp"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what top producers are saying about the platform."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 max-w-6xl mx-auto",children:oat.map((H,K)=>r.jsx(We,{className:"bg-muted/30 border-0",children:r.jsxs(Xe,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(Z=>r.jsx(vs,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},Z))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',H.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:H.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:H.role})]})]})},K))})]})}),r.jsxs("section",{id:"free-trial",className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center space-y-8",children:[r.jsxs("h2",{className:"text-3xl md:text-5xl font-bold text-white",children:["Start Your Free Trial ",r.jsx("span",{className:"italic",children:"Today"})]}),r.jsx("p",{className:"text-lg md:text-xl text-white/80 leading-relaxed",children:"Get instant access to 7 days of trainings, templates, and tools — designed to give you quick wins now and resources you'll keep forever."}),r.jsx("div",{className:"pt-4",children:r.jsxs(J,{size:"lg",className:"px-12 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",onClick:()=>z("individual_agent"),children:["Start Free Trial",r.jsx(Ko,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]})})]}),r.jsx("section",{id:"pricing",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Simple, Transparent ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Pricing"})]}),r.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Choose the plan that fits your needs. All plans include everything you need to succeed."})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:[r.jsxs(We,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Cc,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Xt,{className:"text-xl font-sans",children:sd.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:sd.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:sd.individual_agent.period})]}),r.jsx(En,{className:"text-base mt-2",children:sd.individual_agent.description}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-500/10 text-green-600 text-sm font-medium mt-4",children:[r.jsx(Ki,{className:"w-4 h-4"}),sd.individual_agent.trial]})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:sd.individual_agent.features.map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ca,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},K))})}),r.jsxs(sA,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(J,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("individual_agent"),children:"Start Free Trial"}),r.jsx(J,{variant:"outline",className:"w-full rounded-full border-2 border-[#4a6b6d] text-[#4a6b6d] bg-white hover:bg-[#4a6b6d]/5 uppercase text-sm font-medium tracking-wide",onClick:()=>z("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),r.jsxs(We,{className:"relative flex flex-col border-2 border-[#4a6b6d] shadow-2xl scale-105 bg-background",children:[r.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 px-6 py-2 bg-[#4a6b6d] text-white text-sm font-semibold rounded-full shadow-lg",children:"Most Popular"}),r.jsxs(Wt,{className:"pb-4 pt-8",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(na,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-xl font-sans",children:sd.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:sd.brokerage_under_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:sd.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:sd.brokerage_under_25.period})]}),r.jsx(En,{className:"text-base mt-2",children:sd.brokerage_under_25.description})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:sd.brokerage_under_25.features.map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ca,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},K))})}),r.jsx(sA,{className:"pt-4",children:r.jsx(J,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_under_25"),children:"Get Started"})})]}),r.jsxs(We,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(na,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-xl font-sans",children:sd.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:sd.brokerage_over_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:sd.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:sd.brokerage_over_25.period})]}),r.jsx(En,{className:"text-base mt-2",children:sd.brokerage_over_25.description})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:sd.brokerage_over_25.features.map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ca,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},K))})}),r.jsx(sA,{className:"pt-4",children:r.jsx(J,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_over_25"),children:"Get Started"})})]})]})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl text-white font-sans md:text-5xl",children:"Ready to Level Up?"}),r.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"Join thousands of agents who are closing more deals, saving time, and growing their business with LevelUp."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(J,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"px-10 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105",children:["Start Your Free Trial",r.jsx(Ko,{className:"ml-2 w-5 h-5"})]}),r.jsx(J,{size:"lg",onClick:()=>n("/auth"),className:"px-10 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#4a6b6d]",children:"Sign In"})]})]})})]}),r.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx("a",{href:"/privacy-policy",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Privacy Policy"}),r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Contact Support"})]})]})})}),r.jsx(sat,{open:T,onOpenChange:O}),r.jsx(Br,{open:h,onOpenChange:p,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(es,{children:(l==null?void 0:l.tier)==="individual_agent"&&!(l!=null&&l.skipTrial)?"Start your 7-day free trial":(l==null?void 0:l.tier)==="individual_agent"?"Subscribe to Individual Agent":(l==null?void 0:l.tier)==="brokerage_under_25"?"Subscribe to Brokerage (Under 25 Agents)":"Subscribe to Brokerage (Over 25 Agents)"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsxs(Ve,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ct,{id:"dialog-name",type:"text",placeholder:"John Smith",value:w,onChange:H=>j(H.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Ve,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ct,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:H=>y(H.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Ve,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(ct,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:S,onChange:H=>C(H.target.value),className:"mt-1"})]})]}),r.jsx(J,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:q,disabled:A,children:A?"Loading...":"Continue to Checkout"})]})})]})},cat=()=>r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Privacy Policy | LevelUp"}),r.jsx("meta",{name:"description",content:"Privacy Policy for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Privacy Policy"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Introduction"}),r.jsx("p",{children:'Welcome to LevelUp ("we," "our," or "us"). We are committed to protecting your personal information and your right to privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our platform.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Information We Collect"}),r.jsx("p",{children:"We collect information that you provide directly to us, including:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Name and contact information (email address, phone number)"}),r.jsx("li",{children:"Account credentials"}),r.jsx("li",{children:"Profile information"}),r.jsx("li",{children:"Transaction and billing information"}),r.jsx("li",{children:"Communications you send to us"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. How We Use Your Information"}),r.jsx("p",{children:"We use the information we collect to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide, maintain, and improve our services"}),r.jsx("li",{children:"Process transactions and send related information"}),r.jsx("li",{children:"Send you technical notices and support messages"}),r.jsx("li",{children:"Respond to your comments and questions"}),r.jsx("li",{children:"Communicate with you about products, services, and events"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Information Sharing"}),r.jsx("p",{children:"We do not sell, trade, or otherwise transfer your personal information to third parties without your consent, except as described in this policy or as required by law."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Data Security"}),r.jsx("p",{children:"We implement appropriate technical and organizational measures to protect the security of your personal information. However, no method of transmission over the Internet is 100% secure."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Your Rights"}),r.jsx("p",{children:"You have the right to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Access your personal information"}),r.jsx("li",{children:"Correct inaccurate data"}),r.jsx("li",{children:"Request deletion of your data"}),r.jsx("li",{children:"Opt-out of marketing communications"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Third-Party Services"}),r.jsx("p",{children:"Our platform may integrate with third-party services such as Facebook and Instagram for social media posting features. When you connect these accounts, you are subject to their respective privacy policies."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Contact Us"}),r.jsxs("p",{children:["If you have questions about this Privacy Policy, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),dat=()=>r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Terms of Service | LevelUp"}),r.jsx("meta",{name:"description",content:"Terms of Service for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Terms of Service"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Acceptance of Terms"}),r.jsx("p",{children:'By accessing or using the LevelUp platform ("Service"), you agree to be bound by these Terms of Service. If you do not agree to these terms, please do not use our Service.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Description of Service"}),r.jsx("p",{children:"LevelUp provides a platform for real estate professionals to access training, resources, marketing tools, and community features. We reserve the right to modify or discontinue the Service at any time."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. User Accounts"}),r.jsx("p",{children:"To use certain features, you must create an account. You agree to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide accurate and complete information"}),r.jsx("li",{children:"Maintain the security of your account credentials"}),r.jsx("li",{children:"Notify us immediately of any unauthorized access"}),r.jsx("li",{children:"Accept responsibility for all activities under your account"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Acceptable Use"}),r.jsx("p",{children:"You agree not to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Violate any applicable laws or regulations"}),r.jsx("li",{children:"Infringe on the rights of others"}),r.jsx("li",{children:"Upload malicious code or interfere with the Service"}),r.jsx("li",{children:"Attempt to gain unauthorized access to any part of the Service"}),r.jsx("li",{children:"Use the Service for any unlawful purpose"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Intellectual Property"}),r.jsx("p",{children:"The Service and its original content, features, and functionality are owned by LevelUp and are protected by international copyright, trademark, and other intellectual property laws."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Third-Party Integrations"}),r.jsx("p",{children:"Our Service may integrate with third-party platforms such as Facebook and Instagram. Your use of these integrations is subject to the terms and policies of those third parties. We are not responsible for the content or practices of any third-party services."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Payment Terms"}),r.jsx("p",{children:"Certain features may require payment. By subscribing to paid features, you agree to pay all applicable fees. All payments are non-refundable unless otherwise specified."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Limitation of Liability"}),r.jsx("p",{children:"To the maximum extent permitted by law, LevelUp shall not be liable for any indirect, incidental, special, consequential, or punitive damages resulting from your use of the Service."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"9. Termination"}),r.jsx("p",{children:"We may terminate or suspend your account at any time, without prior notice, for conduct that we believe violates these Terms or is harmful to other users, us, or third parties."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"10. Changes to Terms"}),r.jsx("p",{children:"We reserve the right to modify these Terms at any time. We will notify you of significant changes by posting a notice on our platform. Continued use of the Service constitutes acceptance of the modified terms."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"11. Contact Us"}),r.jsxs("p",{children:["If you have questions about these Terms, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),uat=()=>r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Data Deletion | LevelUp"}),r.jsx("meta",{name:"description",content:"Data deletion instructions for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Data Deletion Instructions"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"How to Request Data Deletion"}),r.jsx("p",{children:"If you wish to have your data deleted from LevelUp, you can request deletion through one of the following methods:"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 1: Email Request"}),r.jsxs("p",{children:["Send an email to"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})," ",'with the subject line "Data Deletion Request" and include:']}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your full name"}),r.jsx("li",{children:"The email address associated with your account"}),r.jsx("li",{children:"A clear statement requesting deletion of your data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 2: Account Settings"}),r.jsx("p",{children:"If you have an active account, you can request data deletion through your account settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Log in to your LevelUp account"}),r.jsx("li",{children:"Navigate to your Profile settings"}),r.jsx("li",{children:"Contact support through the Support page to request account deletion"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"What Data Will Be Deleted"}),r.jsx("p",{children:"Upon a valid deletion request, we will delete:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your account information (name, email, profile data)"}),r.jsx("li",{children:"Any content you have created or uploaded"}),r.jsx("li",{children:"Your activity history and preferences"}),r.jsx("li",{children:"Connected social media account tokens and data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Data Retention"}),r.jsx("p",{children:"Some data may be retained for legal or legitimate business purposes, such as:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Transaction records required for financial reporting"}),r.jsx("li",{children:"Data necessary to comply with legal obligations"}),r.jsx("li",{children:"Anonymized or aggregated data that cannot identify you"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Facebook/Instagram Data"}),r.jsx("p",{children:"If you have connected your Facebook or Instagram account to LevelUp, you can also manage your data through Facebook's settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Go to your Facebook Settings & Privacy → Settings"}),r.jsx("li",{children:'Click on "Apps and Websites"'}),r.jsx("li",{children:'Find LevelUp and click "Remove"'}),r.jsx("li",{children:"This will revoke our access to your Facebook/Instagram data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Processing Time"}),r.jsx("p",{children:"We will process your data deletion request within 30 days of receiving it. You will receive a confirmation email once your data has been deleted."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Contact Us"}),r.jsxs("p",{children:["If you have questions about data deletion, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]});var ro;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const l of i)o[l]=l;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),l={};for(const a of o)l[a]=i[a];return e.objectValues(l)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&o.push(l);return o},e.find=(i,o)=>{for(const l of i)if(o(l))return l},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,o=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}e.joinValues=s,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ro||(ro={}));var bje;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(bje||(bje={}));const Ms=ro.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m0=e=>{switch(typeof e){case"undefined":return Ms.undefined;case"string":return Ms.string;case"number":return Number.isNaN(e)?Ms.nan:Ms.number;case"boolean":return Ms.boolean;case"function":return Ms.function;case"bigint":return Ms.bigint;case"symbol":return Ms.symbol;case"object":return Array.isArray(e)?Ms.array:e===null?Ms.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ms.promise:typeof Map<"u"&&e instanceof Map?Ms.map:typeof Set<"u"&&e instanceof Set?Ms.set:typeof Date<"u"&&e instanceof Date?Ms.date:Ms.object;default:return Ms.unknown}},On=ro.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Eg extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(o){return o.message},s={_errors:[]},i=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)s._errors.push(n(l));else{let a=s,h=0;for(;hn.message){const n={},s=[];for(const i of this.issues)if(i.path.length>0){const o=i.path[0];n[o]=n[o]||[],n[o].push(t(i))}else s.push(t(i));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}Eg.create=e=>new Eg(e);const ohe=(e,t)=>{let n;switch(e.code){case On.invalid_type:e.received===Ms.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case On.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ro.jsonStringifyReplacer)}`;break;case On.unrecognized_keys:n=`Unrecognized key(s) in object: ${ro.joinValues(e.keys,", ")}`;break;case On.invalid_union:n="Invalid input";break;case On.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ro.joinValues(e.options)}`;break;case On.invalid_enum_value:n=`Invalid enum value. Expected ${ro.joinValues(e.options)}, received '${e.received}'`;break;case On.invalid_arguments:n="Invalid function arguments";break;case On.invalid_return_type:n="Invalid function return type";break;case On.invalid_date:n="Invalid date";break;case On.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ro.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case On.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case On.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case On.custom:n="Invalid input";break;case On.invalid_intersection_types:n="Intersection results could not be merged";break;case On.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case On.not_finite:n="Number must be finite";break;default:n=t.defaultError,ro.assertNever(e)}return{message:n}};let hat=ohe;function fat(){return hat}const pat=e=>{const{data:t,path:n,errorMaps:s,issueData:i}=e,o=[...n,...i.path||[]],l={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="";const h=s.filter(p=>!!p).slice().reverse();for(const p of h)a=p(l,{data:t,defaultError:a}).message;return{...i,path:o,message:a}};function hs(e,t){const n=fat(),s=pat({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ohe?void 0:ohe].filter(i=>!!i)});e.common.issues.push(s)}class nf{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const s=[];for(const i of n){if(i.status==="aborted")return Wi;i.status==="dirty"&&t.dirty(),s.push(i.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){const s=[];for(const i of n){const o=await i.key,l=await i.value;s.push({key:o,value:l})}return nf.mergeObjectSync(t,s)}static mergeObjectSync(t,n){const s={};for(const i of n){const{key:o,value:l}=i;if(o.status==="aborted"||l.status==="aborted")return Wi;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(s[o.value]=l.value)}return{status:t.value,value:s}}}const Wi=Object.freeze({status:"aborted"}),cT=e=>({status:"dirty",value:e}),sp=e=>({status:"valid",value:e}),wje=e=>e.status==="aborted",jje=e=>e.status==="dirty",oC=e=>e.status==="valid",rte=e=>typeof Promise<"u"&&e instanceof Promise;var Rs;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Rs||(Rs={}));class R1{constructor(t,n,s,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kje=(e,t)=>{if(oC(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Eg(e.common.issues);return this._error=n,this._error}}};function va(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:i}=e;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(l,a)=>{const{message:h}=e;return l.code==="invalid_enum_value"?{message:h??a.defaultError}:typeof a.data>"u"?{message:h??s??a.defaultError}:l.code!=="invalid_type"?{message:a.defaultError}:{message:h??n??a.defaultError}},description:i}}class Ja{get description(){return this._def.description}_getType(t){return m0(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:m0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nf,ctx:{common:t.parent.common,data:t.data,parsedType:m0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(rte(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,n){const s={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:m0(t)},i=this._parseSync({data:t,path:s.path,parent:s});return kje(s,i)}"~validate"(t){var s,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:m0(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return oC(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(i=(s=o==null?void 0:o.message)==null?void 0:s.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>oC(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(t,n){const s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,n){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:m0(t)},i=this._parse({data:t,path:s.path,parent:s}),o=await(rte(i)?i:Promise.resolve(i));return kje(s,o)}refine(t,n){const s=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const l=t(i),a=()=>o.addIssue({code:On.custom,...s(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(a(),!1)):l?!0:(a(),!1)})}refinement(t,n){return this._refinement((s,i)=>t(s)?!0:(i.addIssue(typeof n=="function"?n(s,i):n),!1))}_refinement(t){return new dC({schema:this,typeName:Gi.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return j1.create(this,this._def)}nullable(){return uC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Cg.create(this)}promise(){return ate.create(this,this._def)}or(t){return ste.create([this,t],this._def)}and(t){return ite.create(this,t,this._def)}transform(t){return new dC({...va(this._def),schema:this,typeName:Gi.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new uhe({...va(this._def),innerType:this,defaultValue:n,typeName:Gi.ZodDefault})}brand(){return new Rat({typeName:Gi.ZodBranded,type:this,...va(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new hhe({...va(this._def),innerType:this,catchValue:n,typeName:Gi.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Age.create(this,t)}readonly(){return fhe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mat=/^c[^\s-]{8,}$/i,gat=/^[0-9a-z]+$/,xat=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yat=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,vat=/^[a-z0-9_-]{21}$/i,_at=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bat=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wat=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jat="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Vle;const kat=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nat=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Sat=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Cat=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mat=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tat=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,T6e="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Aat=new RegExp(`^${T6e}$`);function A6e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Eat(e){return new RegExp(`^${A6e(e)}$`)}function Iat(e){let t=`${T6e}T${A6e(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Pat(e,t){return!!((t==="v4"||!t)&&kat.test(e)||(t==="v6"||!t)&&Sat.test(e))}function Lat(e,t){if(!_at.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function Oat(e,t){return!!((t==="v4"||!t)&&Nat.test(e)||(t==="v6"||!t)&&Cat.test(e))}class q0 extends Ja{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ms.string){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_type,expected:Ms.string,received:o.parsedType}),Wi}const s=new nf;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),hs(i,{code:On.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){const l=t.data.length>o.value,a=t.data.lengtht.test(i),{validation:n,code:On.invalid_string,...Rs.errToObj(s)})}_addCheck(t){return new q0({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Rs.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Rs.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Rs.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Rs.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Rs.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Rs.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Rs.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Rs.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Rs.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Rs.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Rs.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Rs.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Rs.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Rs.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Rs.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Rs.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Rs.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Rs.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Rs.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Rs.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Rs.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Rs.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Rs.errToObj(n)})}nonempty(t){return this.min(1,Rs.errToObj(t))}trim(){return new q0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew q0({checks:[],typeName:Gi.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...va(e)});function Dat(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,i=n>s?n:s,o=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return o%l/10**i}class lC extends Ja{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ms.number){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_type,expected:Ms.number,received:o.parsedType}),Wi}let s;const i=new nf;for(const o of this._def.checks)o.kind==="int"?ro.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),hs(s,{code:On.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Dat(t.data,o.value)!==0&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),hs(s,{code:On.not_finite,message:o.message}),i.dirty()):ro.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Rs.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Rs.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Rs.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Rs.toString(n))}setLimit(t,n,s,i){return new lC({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Rs.toString(i)}]})}_addCheck(t){return new lC({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Rs.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Rs.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Rs.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Rs.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Rs.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Rs.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Rs.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Rs.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Rs.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&ro.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(t===null||s.valuenew lC({checks:[],typeName:Gi.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...va(e)});class eE extends Ja{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ms.bigint)return this._getInvalidInput(t);let s;const i=new nf;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ro.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return hs(n,{code:On.invalid_type,expected:Ms.bigint,received:n.parsedType}),Wi}gte(t,n){return this.setLimit("min",t,!0,Rs.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Rs.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Rs.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Rs.toString(n))}setLimit(t,n,s,i){return new eE({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Rs.toString(i)}]})}_addCheck(t){return new eE({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Rs.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Rs.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Rs.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Rs.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Rs.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew eE({checks:[],typeName:Gi.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...va(e)});class lhe extends Ja{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ms.boolean){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ms.boolean,received:s.parsedType}),Wi}return sp(t.data)}}lhe.create=e=>new lhe({typeName:Gi.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...va(e)});class nte extends Ja{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ms.date){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_type,expected:Ms.date,received:o.parsedType}),Wi}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_date}),Wi}const s=new nf;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),hs(i,{code:On.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):ro.assertNever(o);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new nte({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Rs.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Rs.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew nte({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Gi.ZodDate,...va(e)});class Nje extends Ja{_parse(t){if(this._getType(t)!==Ms.symbol){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ms.symbol,received:s.parsedType}),Wi}return sp(t.data)}}Nje.create=e=>new Nje({typeName:Gi.ZodSymbol,...va(e)});class Sje extends Ja{_parse(t){if(this._getType(t)!==Ms.undefined){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ms.undefined,received:s.parsedType}),Wi}return sp(t.data)}}Sje.create=e=>new Sje({typeName:Gi.ZodUndefined,...va(e)});class Cje extends Ja{_parse(t){if(this._getType(t)!==Ms.null){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ms.null,received:s.parsedType}),Wi}return sp(t.data)}}Cje.create=e=>new Cje({typeName:Gi.ZodNull,...va(e)});class Mje extends Ja{constructor(){super(...arguments),this._any=!0}_parse(t){return sp(t.data)}}Mje.create=e=>new Mje({typeName:Gi.ZodAny,...va(e)});class Tje extends Ja{constructor(){super(...arguments),this._unknown=!0}_parse(t){return sp(t.data)}}Tje.create=e=>new Tje({typeName:Gi.ZodUnknown,...va(e)});class F1 extends Ja{_parse(t){const n=this._getOrReturnCtx(t);return hs(n,{code:On.invalid_type,expected:Ms.never,received:n.parsedType}),Wi}}F1.create=e=>new F1({typeName:Gi.ZodNever,...va(e)});class Aje extends Ja{_parse(t){if(this._getType(t)!==Ms.undefined){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ms.void,received:s.parsedType}),Wi}return sp(t.data)}}Aje.create=e=>new Aje({typeName:Gi.ZodVoid,...va(e)});class Cg extends Ja{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ms.array)return hs(n,{code:On.invalid_type,expected:Ms.array,received:n.parsedType}),Wi;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(hs(n,{code:On.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((l,a)=>i.type._parseAsync(new R1(n,l,n.path,a)))).then(l=>nf.mergeArray(s,l));const o=[...n.data].map((l,a)=>i.type._parseSync(new R1(n,l,n.path,a)));return nf.mergeArray(s,o)}get element(){return this._def.type}min(t,n){return new Cg({...this._def,minLength:{value:t,message:Rs.toString(n)}})}max(t,n){return new Cg({...this._def,maxLength:{value:t,message:Rs.toString(n)}})}length(t,n){return new Cg({...this._def,exactLength:{value:t,message:Rs.toString(n)}})}nonempty(t){return this.min(1,t)}}Cg.create=(e,t)=>new Cg({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Gi.ZodArray,...va(t)});function g4(e){if(e instanceof wc){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=j1.create(g4(s))}return new wc({...e._def,shape:()=>t})}else return e instanceof Cg?new Cg({...e._def,type:g4(e.element)}):e instanceof j1?j1.create(g4(e.unwrap())):e instanceof uC?uC.create(g4(e.unwrap())):e instanceof Fj?Fj.create(e.items.map(t=>g4(t))):e}class wc extends Ja{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=ro.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ms.object){const p=this._getOrReturnCtx(t);return hs(p,{code:On.invalid_type,expected:Ms.object,received:p.parsedType}),Wi}const{status:s,ctx:i}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),a=[];if(!(this._def.catchall instanceof F1&&this._def.unknownKeys==="strip"))for(const p in i.data)l.includes(p)||a.push(p);const h=[];for(const p of l){const x=o[p],y=i.data[p];h.push({key:{status:"valid",value:p},value:x._parse(new R1(i,y,i.path,p)),alwaysSet:p in i.data})}if(this._def.catchall instanceof F1){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of a)h.push({key:{status:"valid",value:x},value:{status:"valid",value:i.data[x]}});else if(p==="strict")a.length>0&&(hs(i,{code:On.unrecognized_keys,keys:a}),s.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of a){const y=i.data[x];h.push({key:{status:"valid",value:x},value:p._parse(new R1(i,y,i.path,x)),alwaysSet:x in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of h){const y=await x.key,w=await x.value;p.push({key:y,value:w,alwaysSet:x.alwaysSet})}return p}).then(p=>nf.mergeObjectSync(s,p)):nf.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(t){return Rs.errToObj,new wc({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{var o,l;const i=((l=(o=this._def).errorMap)==null?void 0:l.call(o,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:Rs.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new wc({...this._def,unknownKeys:"strip"})}passthrough(){return new wc({...this._def,unknownKeys:"passthrough"})}extend(t){return new wc({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new wc({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Gi.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new wc({...this._def,catchall:t})}pick(t){const n={};for(const s of ro.objectKeys(t))t[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new wc({...this._def,shape:()=>n})}omit(t){const n={};for(const s of ro.objectKeys(this.shape))t[s]||(n[s]=this.shape[s]);return new wc({...this._def,shape:()=>n})}deepPartial(){return g4(this)}partial(t){const n={};for(const s of ro.objectKeys(this.shape)){const i=this.shape[s];t&&!t[s]?n[s]=i:n[s]=i.optional()}return new wc({...this._def,shape:()=>n})}required(t){const n={};for(const s of ro.objectKeys(this.shape))if(t&&!t[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof j1;)o=o._def.innerType;n[s]=o}return new wc({...this._def,shape:()=>n})}keyof(){return E6e(ro.objectKeys(this.shape))}}wc.create=(e,t)=>new wc({shape:()=>e,unknownKeys:"strip",catchall:F1.create(),typeName:Gi.ZodObject,...va(t)});wc.strictCreate=(e,t)=>new wc({shape:()=>e,unknownKeys:"strict",catchall:F1.create(),typeName:Gi.ZodObject,...va(t)});wc.lazycreate=(e,t)=>new wc({shape:e,unknownKeys:"strip",catchall:F1.create(),typeName:Gi.ZodObject,...va(t)});class ste extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t),s=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(a=>new Eg(a.ctx.common.issues));return hs(n,{code:On.invalid_union,unionErrors:l}),Wi}if(n.common.async)return Promise.all(s.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let o;const l=[];for(const h of s){const p={...n,common:{...n.common,issues:[]},parent:null},x=h._parseSync({data:n.data,path:n.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!o&&(o={result:x,ctx:p}),p.common.issues.length&&l.push(p.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=l.map(h=>new Eg(h));return hs(n,{code:On.invalid_union,unionErrors:a}),Wi}}get options(){return this._def.options}}ste.create=(e,t)=>new ste({options:e,typeName:Gi.ZodUnion,...va(t)});function che(e,t){const n=m0(e),s=m0(t);if(e===t)return{valid:!0,data:e};if(n===Ms.object&&s===Ms.object){const i=ro.objectKeys(t),o=ro.objectKeys(e).filter(a=>i.indexOf(a)!==-1),l={...e,...t};for(const a of o){const h=che(e[a],t[a]);if(!h.valid)return{valid:!1};l[a]=h.data}return{valid:!0,data:l}}else if(n===Ms.array&&s===Ms.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(wje(o)||wje(l))return Wi;const a=che(o.value,l.value);return a.valid?((jje(o)||jje(l))&&n.dirty(),{status:n.value,value:a.data}):(hs(s,{code:On.invalid_intersection_types}),Wi)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,l])=>i(o,l)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ite.create=(e,t,n)=>new ite({left:e,right:t,typeName:Gi.ZodIntersection,...va(n)});class Fj extends Ja{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ms.array)return hs(s,{code:On.invalid_type,expected:Ms.array,received:s.parsedType}),Wi;if(s.data.lengththis._def.items.length&&(hs(s,{code:On.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((l,a)=>{const h=this._def.items[a]||this._def.rest;return h?h._parse(new R1(s,l,s.path,a)):null}).filter(l=>!!l);return s.common.async?Promise.all(o).then(l=>nf.mergeArray(n,l)):nf.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Fj({...this._def,rest:t})}}Fj.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fj({items:e,typeName:Gi.ZodTuple,rest:null,...va(t)})};class Eje extends Ja{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ms.map)return hs(s,{code:On.invalid_type,expected:Ms.map,received:s.parsedType}),Wi;const i=this._def.keyType,o=this._def.valueType,l=[...s.data.entries()].map(([a,h],p)=>({key:i._parse(new R1(s,a,s.path,[p,"key"])),value:o._parse(new R1(s,h,s.path,[p,"value"]))}));if(s.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const h of l){const p=await h.key,x=await h.value;if(p.status==="aborted"||x.status==="aborted")return Wi;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),a.set(p.value,x.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const h of l){const p=h.key,x=h.value;if(p.status==="aborted"||x.status==="aborted")return Wi;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),a.set(p.value,x.value)}return{status:n.value,value:a}}}}Eje.create=(e,t,n)=>new Eje({valueType:t,keyType:e,typeName:Gi.ZodMap,...va(n)});class tE extends Ja{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ms.set)return hs(s,{code:On.invalid_type,expected:Ms.set,received:s.parsedType}),Wi;const i=this._def;i.minSize!==null&&s.data.sizei.maxSize.value&&(hs(s,{code:On.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function l(h){const p=new Set;for(const x of h){if(x.status==="aborted")return Wi;x.status==="dirty"&&n.dirty(),p.add(x.value)}return{status:n.value,value:p}}const a=[...s.data.values()].map((h,p)=>o._parse(new R1(s,h,s.path,p)));return s.common.async?Promise.all(a).then(h=>l(h)):l(a)}min(t,n){return new tE({...this._def,minSize:{value:t,message:Rs.toString(n)}})}max(t,n){return new tE({...this._def,maxSize:{value:t,message:Rs.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}tE.create=(e,t)=>new tE({valueType:e,minSize:null,maxSize:null,typeName:Gi.ZodSet,...va(t)});class Ije extends Ja{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Ije.create=(e,t)=>new Ije({getter:e,typeName:Gi.ZodLazy,...va(t)});class dhe extends Ja{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return hs(n,{received:n.data,code:On.invalid_literal,expected:this._def.value}),Wi}return{status:"valid",value:t.data}}get value(){return this._def.value}}dhe.create=(e,t)=>new dhe({value:e,typeName:Gi.ZodLiteral,...va(t)});function E6e(e,t){return new cC({values:e,typeName:Gi.ZodEnum,...va(t)})}class cC extends Ja{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return hs(n,{expected:ro.joinValues(s),received:n.parsedType,code:On.invalid_type}),Wi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),s=this._def.values;return hs(n,{received:n.data,code:On.invalid_enum_value,options:s}),Wi}return sp(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return cC.create(t,{...this._def,...n})}exclude(t,n=this._def){return cC.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}cC.create=E6e;class Pje extends Ja{_parse(t){const n=ro.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Ms.string&&s.parsedType!==Ms.number){const i=ro.objectValues(n);return hs(s,{expected:ro.joinValues(i),received:s.parsedType,code:On.invalid_type}),Wi}if(this._cache||(this._cache=new Set(ro.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=ro.objectValues(n);return hs(s,{received:s.data,code:On.invalid_enum_value,options:i}),Wi}return sp(t.data)}get enum(){return this._def.values}}Pje.create=(e,t)=>new Pje({values:e,typeName:Gi.ZodNativeEnum,...va(t)});class ate extends Ja{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ms.promise&&n.common.async===!1)return hs(n,{code:On.invalid_type,expected:Ms.promise,received:n.parsedType}),Wi;const s=n.parsedType===Ms.promise?n.data:Promise.resolve(n.data);return sp(s.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ate.create=(e,t)=>new ate({type:e,typeName:Gi.ZodPromise,...va(t)});class dC extends Ja{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Gi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:l=>{hs(s,l),l.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const l=i.transform(s.data,o);if(s.common.async)return Promise.resolve(l).then(async a=>{if(n.value==="aborted")return Wi;const h=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return h.status==="aborted"?Wi:h.status==="dirty"||n.value==="dirty"?cT(h.value):h});{if(n.value==="aborted")return Wi;const a=this._def.schema._parseSync({data:l,path:s.path,parent:s});return a.status==="aborted"?Wi:a.status==="dirty"||n.value==="dirty"?cT(a.value):a}}if(i.type==="refinement"){const l=a=>{const h=i.refinement(a,o);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Wi:(a.status==="dirty"&&n.dirty(),l(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?Wi:(a.status==="dirty"&&n.dirty(),l(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(s.common.async===!1){const l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!oC(l))return Wi;const a=i.transform(l.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>oC(l)?Promise.resolve(i.transform(l.value,o)).then(a=>({status:n.value,value:a})):Wi);ro.assertNever(i)}}dC.create=(e,t,n)=>new dC({schema:e,typeName:Gi.ZodEffects,effect:t,...va(n)});dC.createWithPreprocess=(e,t,n)=>new dC({schema:t,effect:{type:"preprocess",transform:e},typeName:Gi.ZodEffects,...va(n)});class j1 extends Ja{_parse(t){return this._getType(t)===Ms.undefined?sp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}j1.create=(e,t)=>new j1({innerType:e,typeName:Gi.ZodOptional,...va(t)});class uC extends Ja{_parse(t){return this._getType(t)===Ms.null?sp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}uC.create=(e,t)=>new uC({innerType:e,typeName:Gi.ZodNullable,...va(t)});class uhe extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===Ms.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}uhe.create=(e,t)=>new uhe({innerType:e,typeName:Gi.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...va(t)});class hhe extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return rte(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Eg(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Eg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}hhe.create=(e,t)=>new hhe({innerType:e,typeName:Gi.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...va(t)});class Lje extends Ja{_parse(t){if(this._getType(t)!==Ms.nan){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ms.nan,received:s.parsedType}),Wi}return{status:"valid",value:t.data}}}Lje.create=e=>new Lje({typeName:Gi.ZodNaN,...va(e)});class Rat extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Age extends Ja{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Wi:o.status==="dirty"?(n.dirty(),cT(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Wi:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(t,n){return new Age({in:t,out:n,typeName:Gi.ZodPipeline})}}class fhe extends Ja{_parse(t){const n=this._def.innerType._parse(t),s=i=>(oC(i)&&(i.value=Object.freeze(i.value)),i);return rte(n)?n.then(i=>s(i)):s(n)}unwrap(){return this._def.innerType}}fhe.create=(e,t)=>new fhe({innerType:e,typeName:Gi.ZodReadonly,...va(t)});var Gi;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Gi||(Gi={}));const nc=q0.create,iA=lC.create,Fat=lhe.create;F1.create;Cg.create;const d3=wc.create;ste.create;ite.create;Fj.create;const Oje=dhe.create,I6e=cC.create;ate.create;j1.create;uC.create;const zat="/assets/levelup-logo-horizontal-DEFNc0ms.png",Bat=d3({email:nc().email("Invalid email address"),password:nc().min(6,"Password must be at least 6 characters")}),$at=()=>{const{signIn:e,user:t}=zr(),n=ns(),[s,i]=P.useState(!1),[o,l]=P.useState({}),[a,h]=P.useState(""),[p,x]=P.useState(!1),[y,w]=P.useState(!1);P.useEffect(()=>{t&&n("/dashboard")},[t,n]);const j=async C=>{C.preventDefault(),l({}),i(!0);const A=new FormData(C.currentTarget),E=A.get("email"),T=A.get("password");try{Bat.parse({email:E,password:T}),await e(E,T)}catch(O){if(O instanceof Eg){const z={};O.errors.forEach(F=>{F.path[0]&&(z[F.path[0]]=F.message)}),l(z)}}finally{i(!1)}},S=async()=>{if(!a){ze.error("Please enter your email address");return}x(!0);try{const{error:C}=await ee.functions.invoke("send-password-reset",{body:{email:a,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(C)throw C;ze.success("Password reset email sent! Check your inbox."),w(!1),h("")}catch(C){ze.error(C.message||"Failed to send reset email")}finally{x(!1)}};return r.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#4a6b6d] via-[#3d5a5c] to-[#2a4347]",children:r.jsxs("div",{className:"absolute inset-0 opacity-30",children:[r.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"2s"}})]})}),r.jsxs("div",{className:"relative z-10 flex flex-col min-h-screen",children:[r.jsx("header",{className:"p-6",children:r.jsxs(co,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Home"]})}),r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("div",{className:"bg-white rounded-xl p-4 shadow-2xl",children:r.jsx("img",{src:zat,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(We,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Wt,{className:"space-y-1 text-center pb-4",children:[r.jsx(Xt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(En,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(Xe,{children:r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(ct,{id:"signin-email",name:"email",type:"email",placeholder:"your@email.com",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.email&&r.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(ct,{id:"signin-password",name:"password",type:"password",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.password&&r.jsx("p",{className:"text-sm text-red-600",children:o.password})]}),r.jsx(J,{type:"submit",className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white font-semibold py-6 text-lg transition-all duration-200 shadow-lg hover:shadow-xl",disabled:s,children:s?"Signing in...":"Sign In"}),r.jsxs(Br,{open:y,onOpenChange:w,children:[r.jsx(Fo,{asChild:!0,children:r.jsx(J,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Fr,{className:"bg-white",children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(es,{className:"text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(ct,{id:"reset-email",type:"email",placeholder:"your@email.com",value:a,onChange:C=>h(C.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(J,{onClick:S,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:p,children:p?"Sending...":"Send Reset Link"})]})]})]})]})})]}),r.jsxs("p",{className:"text-center text-white/70 text-sm mt-6",children:["Don't have an account?"," ",r.jsx(co,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},Uat=()=>{const[e]=Fd(),t=e.get("tier"),n=t==null?void 0:t.includes("brokerage");return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(We,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mb-4",children:r.jsx(qa,{className:"w-10 h-10 text-green-500"})}),r.jsx(Xt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(En,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Zs,{className:"w-5 h-5"}),r.jsx("span",{className:"font-semibold",children:"Check your email to sign in"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"We've sent you an email with a secure link to access your account. Click the link in your email to get started."})]}),n?r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Create and name your brokerage"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"4."}),"Start inviting agents to join your team"]})]})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Start exploring templates, training videos, and more!"]})]}),r.jsx("p",{className:"text-sm text-green-600 font-medium mt-4",children:"🎉 Your 7-day free trial has started!"})]}),r.jsx("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Didn't receive the email? Check your spam folder or contact support."})})]})]})})},Ege=e=>{const[t,n]=P.useState(null),[s,i]=P.useState(!0);return P.useEffect(()=>{if(!e){i(!1);return}(async()=>{try{const{data:a}=await ee.storage.from("avatars").list(`${e}`);if(a&&a.length>0){const{data:h}=ee.storage.from("avatars").getPublicUrl(`${e}/${a[0].name}`);n(`${h.publicUrl}?t=${Date.now()}`)}else n(null)}catch(a){console.error("Error fetching avatar:",a),n(null)}finally{i(!1)}})()},[e]),{avatarUrl:t,loading:s,refreshAvatar:async()=>{if(e)try{const{data:l}=await ee.storage.from("avatars").list(`${e}`);if(l&&l.length>0){const{data:a}=ee.storage.from("avatars").getPublicUrl(`${e}/${l[0].name}`);n(`${a.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},P6e=async e=>{const t=new Map;return await Promise.all(e.map(async n=>{try{const{data:s}=await ee.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:i}=ee.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);t.set(n,i.publicUrl)}}catch{}})),t},qat=e=>{const[t,n]=P.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return P.useEffect(()=>{if(!e){n(i=>({...i,loading:!1}));return}(async()=>{try{const{data:i,error:o}=await ee.from("profiles").select("is_trial, trial_expires_at, subscription_status, subscription_end_date").eq("id",e).single();if(o){console.error("Error fetching trial status:",o),n(h=>({...h,loading:!1}));return}const l=(i==null?void 0:i.subscription_status)==="trialing"&&(i==null?void 0:i.subscription_end_date),a=(i==null?void 0:i.is_trial)&&(i==null?void 0:i.trial_expires_at);if(l){const h=new Date().getTime(),p=new Date(i.subscription_end_date).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:i.subscription_end_date,daysLeft:y?0:x,loading:!1})}else if(a){const h=new Date().getTime(),p=new Date(i.trial_expires_at).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:i.trial_expires_at,daysLeft:y?0:x,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(i){console.error("Error in useTrialStatus:",i),n(o=>({...o,loading:!1}))}})()},[e]),t},L6e=()=>{const{data:e,isLoading:t}=Jt({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:i}=await ee.from("feature_flags").select("*");if(i)throw i;return s}}),n=s=>{if(!e)return!1;const i=e.find(o=>o.key===s);return(i==null?void 0:i.enabled)??!1};return{flags:e,isLoading:t,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},Dje="community_last_seen_post_at";function Vat(){const{user:e}=zr(),t=km(),[n,s]=P.useState(0),[i,o]=P.useState(null);P.useEffect(()=>{if(!e)return;const a=localStorage.getItem(`${Dje}_${e.id}`);o(a)},[e]),P.useEffect(()=>{if(!e)return;(async()=>{let h=ee.from("community_posts").select("id",{count:"exact",head:!0});i&&(h=h.gt("created_at",i));const{data:p}=await ee.from("profiles").select("brokerage_id").eq("id",e.id).single(),{count:x,error:y}=await h;!y&&x!==null&&s(x)})()},[e,i]),P.useEffect(()=>{if(!e)return;const a=ee.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async h=>{const p=h.new;if(p.user_id===e.id)return;const x=t.pathname==="/community";x||s(S=>S+1);const{data:y}=await ee.from("profiles").select("name").eq("id",p.user_id).single(),w=(y==null?void 0:y.name)||"Someone",j=p.content.length>50?p.content.substring(0,50)+"...":p.content;x||ze("New Community Post",{description:`${w}: ${j}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{ee.removeChannel(a)}},[e,t.pathname]);const l=P.useCallback(()=>{if(!e)return;const a=new Date().toISOString();localStorage.setItem(`${Dje}_${e.id}`,a),o(a),s(0)},[e]);return P.useEffect(()=>{t.pathname==="/community"&&n>0&&l()},[t.pathname,n,l]),{unreadCount:n,markAsRead:l}}function Hat(){const{isAdmin:e}=zr(),{data:t=0}=Jt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await ee.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(s)throw s;return n||0},enabled:e,staleTime:6e4});return{openCount:e?t:0}}const Jne=Vne,Ige=Sge,Wat=Hne,O6e=P.forwardRef(({className:e,...t},n)=>r.jsx(o3,{className:$t("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",e),...t,ref:n}));O6e.displayName=o3.displayName;const Gat=YC("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"}}),_I=P.forwardRef(({side:e="right",className:t,children:n,...s},i)=>r.jsxs(Wat,{children:[r.jsx(O6e,{}),r.jsxs(l3,{ref:i,className:$t(Gat({side:e}),t),...s,children:[n,r.jsxs(Wne,{className:"absolute right-4 top-4 rounded-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:[r.jsx(Ts,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_I.displayName=l3.displayName;const ese=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",e),...t});ese.displayName="SheetHeader";const tse=P.forwardRef(({className:e,...t},n)=>r.jsx(xI,{ref:n,className:$t("text-lg font-semibold text-foreground",e),...t}));tse.displayName=xI.displayName;const Kat=P.forwardRef(({className:e,...t},n)=>r.jsx(yI,{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));Kat.displayName=yI.displayName;function Zat(e,t){return P.useReducer((n,s)=>t[n][s]??n,e)}var Pge="ScrollArea",[D6e]=Ql(Pge),[Yat,ip]=D6e(Pge),R6e=P.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:s="hover",dir:i,scrollHideDelay:o=600,...l}=e,[a,h]=P.useState(null),[p,x]=P.useState(null),[y,w]=P.useState(null),[j,S]=P.useState(null),[C,A]=P.useState(null),[E,T]=P.useState(0),[O,z]=P.useState(0),[F,q]=P.useState(!1),[H,K]=P.useState(!1),Z=ei(t,ue=>h(ue)),re=rk(i);return r.jsx(Yat,{scope:n,type:s,dir:re,scrollHideDelay:o,scrollArea:a,viewport:p,onViewportChange:x,content:y,onContentChange:w,scrollbarX:j,onScrollbarXChange:S,scrollbarXEnabled:F,onScrollbarXEnabledChange:q,scrollbarY:C,onScrollbarYChange:A,scrollbarYEnabled:H,onScrollbarYEnabledChange:K,onCornerWidthChange:T,onCornerHeightChange:z,children:r.jsx(Rn.div,{dir:re,...l,ref:Z,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":O+"px",...e.style}})})});R6e.displayName=Pge;var F6e="ScrollAreaViewport",z6e=P.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:i,...o}=e,l=ip(F6e,n),a=P.useRef(null),h=ei(t,a,l.onViewportChange);return r.jsxs(r.Fragment,{children:[r.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:i}),r.jsx(Rn.div,{"data-radix-scroll-area-viewport":"",...o,ref:h,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});z6e.displayName=F6e;var zg="ScrollAreaScrollbar",Lge=P.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=ip(zg,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=i,a=e.orientation==="horizontal";return P.useEffect(()=>(a?o(!0):l(!0),()=>{a?o(!1):l(!1)}),[a,o,l]),i.type==="hover"?r.jsx(Xat,{...s,ref:t,forceMount:n}):i.type==="scroll"?r.jsx(Qat,{...s,ref:t,forceMount:n}):i.type==="auto"?r.jsx(B6e,{...s,ref:t,forceMount:n}):i.type==="always"?r.jsx(Oge,{...s,ref:t}):null});Lge.displayName=zg;var Xat=P.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=ip(zg,e.__scopeScrollArea),[o,l]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let h=0;if(a){const p=()=>{window.clearTimeout(h),l(!0)},x=()=>{h=window.setTimeout(()=>l(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",p),a.addEventListener("pointerleave",x),()=>{window.clearTimeout(h),a.removeEventListener("pointerenter",p),a.removeEventListener("pointerleave",x)}}},[i.scrollArea,i.scrollHideDelay]),r.jsx(fc,{present:n||o,children:r.jsx(B6e,{"data-state":o?"visible":"hidden",...s,ref:t})})}),Qat=P.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=ip(zg,e.__scopeScrollArea),o=e.orientation==="horizontal",l=nse(()=>h("SCROLL_END"),100),[a,h]=Zat("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 P.useEffect(()=>{if(a==="idle"){const p=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(p)}},[a,i.scrollHideDelay,h]),P.useEffect(()=>{const p=i.viewport,x=o?"scrollLeft":"scrollTop";if(p){let y=p[x];const w=()=>{const j=p[x];y!==j&&(h("SCROLL"),l()),y=j};return p.addEventListener("scroll",w),()=>p.removeEventListener("scroll",w)}},[i.viewport,o,h,l]),r.jsx(fc,{present:n||a!=="hidden",children:r.jsx(Oge,{"data-state":a==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:cn(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:cn(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),B6e=P.forwardRef((e,t)=>{const n=ip(zg,e.__scopeScrollArea),{forceMount:s,...i}=e,[o,l]=P.useState(!1),a=e.orientation==="horizontal",h=nse(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=e,i=ip(zg,e.__scopeScrollArea),o=P.useRef(null),l=P.useRef(0),[a,h]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=H6e(a.viewport,a.content),x={...s,sizes:a,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:w=>o.current=w,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:w=>l.current=w};function y(w,j){return sot(w,l.current,a,j)}return n==="horizontal"?r.jsx(Jat,{...x,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const w=i.viewport.scrollLeft,j=Rje(w,a,i.dir);o.current.style.transform=`translate3d(${j}px, 0, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollLeft=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollLeft=y(w,i.dir))}}):n==="vertical"?r.jsx(eot,{...x,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const w=i.viewport.scrollTop,j=Rje(w,a);o.current.style.transform=`translate3d(0, ${j}px, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollTop=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollTop=y(w))}}):null}),Jat=P.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...i}=e,o=ip(zg,e.__scopeScrollArea),[l,a]=P.useState(),h=P.useRef(null),p=ei(t,h,o.onScrollbarXChange);return P.useEffect(()=>{h.current&&a(getComputedStyle(h.current))},[h]),r.jsx(U6e,{"data-orientation":"horizontal",...i,ref:p,sizes:n,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":rse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.x),onDragScroll:x=>e.onDragScroll(x.x),onWheelScroll:(x,y)=>{if(o.viewport){const w=o.viewport.scrollLeft+x.deltaX;e.onWheelScroll(w),G6e(w,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:lte(l.paddingLeft),paddingEnd:lte(l.paddingRight)}})}})}),eot=P.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...i}=e,o=ip(zg,e.__scopeScrollArea),[l,a]=P.useState(),h=P.useRef(null),p=ei(t,h,o.onScrollbarYChange);return P.useEffect(()=>{h.current&&a(getComputedStyle(h.current))},[h]),r.jsx(U6e,{"data-orientation":"vertical",...i,ref:p,sizes:n,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":rse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.y),onDragScroll:x=>e.onDragScroll(x.y),onWheelScroll:(x,y)=>{if(o.viewport){const w=o.viewport.scrollTop+x.deltaY;e.onWheelScroll(w),G6e(w,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:lte(l.paddingTop),paddingEnd:lte(l.paddingBottom)}})}})}),[tot,$6e]=D6e(zg),U6e=P.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:i,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:a,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:x,onResize:y,...w}=e,j=ip(zg,n),[S,C]=P.useState(null),A=ei(t,Z=>C(Z)),E=P.useRef(null),T=P.useRef(""),O=j.viewport,z=s.content-s.viewport,F=Gl(x),q=Gl(h),H=nse(y,10);function K(Z){if(E.current){const re=Z.clientX-E.current.left,ue=Z.clientY-E.current.top;p({x:re,y:ue})}}return P.useEffect(()=>{const Z=re=>{const ue=re.target;(S==null?void 0:S.contains(ue))&&F(re,z)};return document.addEventListener("wheel",Z,{passive:!1}),()=>document.removeEventListener("wheel",Z,{passive:!1})},[O,S,z,F]),P.useEffect(q,[s,q]),hC(S,H),hC(j.content,H),r.jsx(tot,{scope:n,scrollbar:S,hasThumb:i,onThumbChange:Gl(o),onThumbPointerUp:Gl(l),onThumbPositionChange:q,onThumbPointerDown:Gl(a),children:r.jsx(Rn.div,{...w,ref:A,style:{position:"absolute",...w.style},onPointerDown:cn(e.onPointerDown,Z=>{Z.button===0&&(Z.target.setPointerCapture(Z.pointerId),E.current=S.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",j.viewport&&(j.viewport.style.scrollBehavior="auto"),K(Z))}),onPointerMove:cn(e.onPointerMove,K),onPointerUp:cn(e.onPointerUp,Z=>{const re=Z.target;re.hasPointerCapture(Z.pointerId)&&re.releasePointerCapture(Z.pointerId),document.body.style.webkitUserSelect=T.current,j.viewport&&(j.viewport.style.scrollBehavior=""),E.current=null})})})}),ote="ScrollAreaThumb",q6e=P.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=$6e(ote,e.__scopeScrollArea);return r.jsx(fc,{present:n||i.hasThumb,children:r.jsx(rot,{ref:t,...s})})}),rot=P.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...i}=e,o=ip(ote,n),l=$6e(ote,n),{onThumbPositionChange:a}=l,h=ei(t,y=>l.onThumbChange(y)),p=P.useRef(void 0),x=nse(()=>{p.current&&(p.current(),p.current=void 0)},100);return P.useEffect(()=>{const y=o.viewport;if(y){const w=()=>{if(x(),!p.current){const j=iot(y,a);p.current=j,a()}};return a(),y.addEventListener("scroll",w),()=>y.removeEventListener("scroll",w)}},[o.viewport,x,a]),r.jsx(Rn.div,{"data-state":l.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:cn(e.onPointerDownCapture,y=>{const j=y.target.getBoundingClientRect(),S=y.clientX-j.left,C=y.clientY-j.top;l.onThumbPointerDown({x:S,y:C})}),onPointerUp:cn(e.onPointerUp,l.onThumbPointerUp)})});q6e.displayName=ote;var Dge="ScrollAreaCorner",V6e=P.forwardRef((e,t)=>{const n=ip(Dge,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(not,{...e,ref:t}):null});V6e.displayName=Dge;var not=P.forwardRef((e,t)=>{const{__scopeScrollArea:n,...s}=e,i=ip(Dge,n),[o,l]=P.useState(0),[a,h]=P.useState(0),p=!!(o&&a);return hC(i.scrollbarX,()=>{var y;const x=((y=i.scrollbarX)==null?void 0:y.offsetHeight)||0;i.onCornerHeightChange(x),h(x)}),hC(i.scrollbarY,()=>{var y;const x=((y=i.scrollbarY)==null?void 0:y.offsetWidth)||0;i.onCornerWidthChange(x),l(x)}),p?r.jsx(Rn.div,{...s,ref:t,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function lte(e){return e?parseInt(e,10):0}function H6e(e,t){const n=e/t;return isNaN(n)?0:n}function rse(e){const t=H6e(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function sot(e,t,n,s="ltr"){const i=rse(n),o=i/2,l=t||o,a=i-l,h=n.scrollbar.paddingStart+l,p=n.scrollbar.size-n.scrollbar.paddingEnd-a,x=n.content-n.viewport,y=s==="ltr"?[0,x]:[x*-1,0];return W6e([h,p],y)(e)}function Rje(e,t,n="ltr"){const s=rse(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,l=t.content-t.viewport,a=o-s,h=n==="ltr"?[0,l]:[l*-1,0],p=JA(e,h);return W6e([0,l],[0,a])(p)}function W6e(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function G6e(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},s=0;return function i(){const o={left:e.scrollLeft,top:e.scrollTop},l=n.left!==o.left,a=n.top!==o.top;(l||a)&&t(),n=o,s=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(s)};function nse(e,t){const n=Gl(e),s=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(s.current),[]),P.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,t)},[n,t])}function hC(e,t){const n=Gl(t);Yl(()=>{let s=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(s),i.unobserve(e)}}},[e,n])}var K6e=R6e,aot=z6e,oot=V6e;const Jo=P.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(K6e,{ref:s,className:$t("relative overflow-hidden",e),...n,children:[r.jsx(aot,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(Rge,{}),r.jsx(oot,{})]}));Jo.displayName=K6e.displayName;const Rge=P.forwardRef(({className:e,orientation:t="vertical",...n},s)=>r.jsx(Lge,{ref:s,orientation:t,className:$t("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(q6e,{className:"relative flex-1 rounded-full bg-border"})}));Rge.displayName=Lge.displayName;var Hle="rovingFocusGroup.onEntryFocus",lot={bubbles:!1,cancelable:!0},bI="RovingFocusGroup",[phe,Z6e,cot]=aI(bI),[dot,u3]=Ql(bI,[cot]),[uot,hot]=dot(bI),Y6e=P.forwardRef((e,t)=>r.jsx(phe.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(phe.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(fot,{...e,ref:t})})}));Y6e.displayName=bI;var fot=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...y}=e,w=P.useRef(null),j=ei(t,w),S=rk(o),[C,A]=Lu({prop:l,defaultProp:a??null,onChange:h,caller:bI}),[E,T]=P.useState(!1),O=Gl(p),z=Z6e(n),F=P.useRef(!1),[q,H]=P.useState(0);return P.useEffect(()=>{const K=w.current;if(K)return K.addEventListener(Hle,O),()=>K.removeEventListener(Hle,O)},[O]),r.jsx(uot,{scope:n,orientation:s,dir:S,loop:i,currentTabStopId:C,onItemFocus:P.useCallback(K=>A(K),[A]),onItemShiftTab:P.useCallback(()=>T(!0),[]),onFocusableItemAdd:P.useCallback(()=>H(K=>K+1),[]),onFocusableItemRemove:P.useCallback(()=>H(K=>K-1),[]),children:r.jsx(Rn.div,{tabIndex:E||q===0?-1:0,"data-orientation":s,...y,ref:j,style:{outline:"none",...e.style},onMouseDown:cn(e.onMouseDown,()=>{F.current=!0}),onFocus:cn(e.onFocus,K=>{const Z=!F.current;if(K.target===K.currentTarget&&Z&&!E){const re=new CustomEvent(Hle,lot);if(K.currentTarget.dispatchEvent(re),!re.defaultPrevented){const ue=z().filter(ie=>ie.focusable),he=ue.find(ie=>ie.active),be=ue.find(ie=>ie.id===C),ye=[he,be,...ue].filter(Boolean).map(ie=>ie.ref.current);J6e(ye,x)}}F.current=!1}),onBlur:cn(e.onBlur,()=>T(!1))})})}),X6e="RovingFocusGroupItem",Q6e=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:o,children:l,...a}=e,h=Vc(),p=o||h,x=hot(X6e,n),y=x.currentTabStopId===p,w=Z6e(n),{onFocusableItemAdd:j,onFocusableItemRemove:S,currentTabStopId:C}=x;return P.useEffect(()=>{if(s)return j(),()=>S()},[s,j,S]),r.jsx(phe.ItemSlot,{scope:n,id:p,focusable:s,active:i,children:r.jsx(Rn.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...a,ref:t,onMouseDown:cn(e.onMouseDown,A=>{s?x.onItemFocus(p):A.preventDefault()}),onFocus:cn(e.onFocus,()=>x.onItemFocus(p)),onKeyDown:cn(e.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){x.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const E=got(A,x.orientation,x.dir);if(E!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let O=w().filter(z=>z.focusable).map(z=>z.ref.current);if(E==="last")O.reverse();else if(E==="prev"||E==="next"){E==="prev"&&O.reverse();const z=O.indexOf(A.currentTarget);O=x.loop?xot(O,z+1):O.slice(z+1)}setTimeout(()=>J6e(O))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:C!=null}):l})})});Q6e.displayName=X6e;var pot={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mot(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function got(e,t,n){const s=mot(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return pot[s]}function J6e(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function xot(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Fge=Y6e,zge=Q6e,mhe=["Enter"," "],yot=["ArrowDown","PageUp","Home"],eLe=["ArrowUp","PageDown","End"],vot=[...yot,...eLe],_ot={ltr:[...mhe,"ArrowRight"],rtl:[...mhe,"ArrowLeft"]},bot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wI="Menu",[rE,wot,jot]=aI(wI),[nk,tLe]=Ql(wI,[jot,Rg,u3]),sse=Rg(),rLe=u3(),[kot,sk]=nk(wI),[Not,jI]=nk(wI),nLe=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:i,onOpenChange:o,modal:l=!0}=e,a=sse(t),[h,p]=P.useState(null),x=P.useRef(!1),y=Gl(o),w=rk(i);return P.useEffect(()=>{const j=()=>{x.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>x.current=!1;return document.addEventListener("keydown",j,{capture:!0}),()=>{document.removeEventListener("keydown",j,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),r.jsx(dI,{...a,children:r.jsx(kot,{scope:t,open:n,onOpenChange:y,content:h,onContentChange:p,children:r.jsx(Not,{scope:t,onClose:P.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:w,modal:l,children:s})})})};nLe.displayName=wI;var Sot="MenuAnchor",Bge=P.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=sse(n);return r.jsx(e3,{...i,...s,ref:t})});Bge.displayName=Sot;var $ge="MenuPortal",[Cot,sLe]=nk($ge,{forceMount:void 0}),iLe=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:i}=e,o=sk($ge,t);return r.jsx(Cot,{scope:t,forceMount:n,children:r.jsx(fc,{present:n||o.open,children:r.jsx(ZC,{asChild:!0,container:i,children:s})})})};iLe.displayName=$ge;var Zf="MenuContent",[Mot,Uge]=nk(Zf),aLe=P.forwardRef((e,t)=>{const n=sLe(Zf,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,o=sk(Zf,e.__scopeMenu),l=jI(Zf,e.__scopeMenu);return r.jsx(rE.Provider,{scope:e.__scopeMenu,children:r.jsx(fc,{present:s||o.open,children:r.jsx(rE.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(Tot,{...i,ref:t}):r.jsx(Aot,{...i,ref:t})})})})}),Tot=P.forwardRef((e,t)=>{const n=sk(Zf,e.__scopeMenu),s=P.useRef(null),i=ei(t,s);return P.useEffect(()=>{const o=s.current;if(o)return Une(o)},[]),r.jsx(qge,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:cn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Aot=P.forwardRef((e,t)=>{const n=sk(Zf,e.__scopeMenu);return r.jsx(qge,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Eot=L1("MenuContent.ScrollLock"),qge=P.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:a,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:w,onDismiss:j,disableOutsideScroll:S,...C}=e,A=sk(Zf,n),E=jI(Zf,n),T=sse(n),O=rLe(n),z=wot(n),[F,q]=P.useState(null),H=P.useRef(null),K=ei(t,H,A.onContentChange),Z=P.useRef(0),re=P.useRef(""),ue=P.useRef(0),he=P.useRef(null),be=P.useRef("right"),ne=P.useRef(0),ye=S?gI:P.Fragment,ie=S?{as:Eot,allowPinchZoom:!0}:void 0,fe=_e=>{var Ie,Ke;const Ee=re.current+_e,ke=z().filter(Re=>!Re.disabled),pe=document.activeElement,ae=(Ie=ke.find(Re=>Re.ref.current===pe))==null?void 0:Ie.textValue,ge=ke.map(Re=>Re.textValue),Me=qot(ge,Ee,ae),Ue=(Ke=ke.find(Re=>Re.textValue===Me))==null?void 0:Ke.ref.current;(function Re(Ce){re.current=Ce,window.clearTimeout(Z.current),Ce!==""&&(Z.current=window.setTimeout(()=>Re(""),1e3))})(Ee),Ue&&setTimeout(()=>Ue.focus())};P.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Bne();const de=P.useCallback(_e=>{var ke,pe;return be.current===((ke=he.current)==null?void 0:ke.side)&&Hot(_e,(pe=he.current)==null?void 0:pe.area)},[]);return r.jsx(Mot,{scope:n,searchRef:re,onItemEnter:P.useCallback(_e=>{de(_e)&&_e.preventDefault()},[de]),onItemLeave:P.useCallback(_e=>{var Ee;de(_e)||((Ee=H.current)==null||Ee.focus(),q(null))},[de]),onTriggerLeave:P.useCallback(_e=>{de(_e)&&_e.preventDefault()},[de]),pointerGraceTimerRef:ue,onPointerGraceIntentChange:P.useCallback(_e=>{he.current=_e},[]),children:r.jsx(ye,{...ie,children:r.jsx(mI,{asChild:!0,trapped:i,onMountAutoFocus:cn(o,_e=>{var Ee;_e.preventDefault(),(Ee=H.current)==null||Ee.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(X1,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:w,onDismiss:j,children:r.jsx(Fge,{asChild:!0,...O,dir:E.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:q,onEntryFocus:cn(h,_e=>{E.isUsingKeyboardRef.current||_e.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(uI,{role:"menu","aria-orientation":"vertical","data-state":wLe(A.open),"data-radix-menu-content":"",dir:E.dir,...T,...C,ref:K,style:{outline:"none",...C.style},onKeyDown:cn(C.onKeyDown,_e=>{const ke=_e.target.closest("[data-radix-menu-content]")===_e.currentTarget,pe=_e.ctrlKey||_e.altKey||_e.metaKey,ae=_e.key.length===1;ke&&(_e.key==="Tab"&&_e.preventDefault(),!pe&&ae&&fe(_e.key));const ge=H.current;if(_e.target!==ge||!vot.includes(_e.key))return;_e.preventDefault();const Ue=z().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);eLe.includes(_e.key)&&Ue.reverse(),$ot(Ue)}),onBlur:cn(e.onBlur,_e=>{_e.currentTarget.contains(_e.target)||(window.clearTimeout(Z.current),re.current="")}),onPointerMove:cn(e.onPointerMove,nE(_e=>{const Ee=_e.target,ke=ne.current!==_e.clientX;if(_e.currentTarget.contains(Ee)&&ke){const pe=_e.clientX>ne.current?"right":"left";be.current=pe,ne.current=_e.clientX}}))})})})})})})});aLe.displayName=Zf;var Iot="MenuGroup",Vge=P.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Rn.div,{role:"group",...s,ref:t})});Vge.displayName=Iot;var Pot="MenuLabel",oLe=P.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Rn.div,{...s,ref:t})});oLe.displayName=Pot;var cte="MenuItem",Fje="menu.itemSelect",ise=P.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...i}=e,o=P.useRef(null),l=jI(cte,e.__scopeMenu),a=Uge(cte,e.__scopeMenu),h=ei(t,o),p=P.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const w=new CustomEvent(Fje,{bubbles:!0,cancelable:!0});y.addEventListener(Fje,j=>s==null?void 0:s(j),{once:!0}),Ume(y,w),w.defaultPrevented?p.current=!1:l.onClose()}};return r.jsx(lLe,{...i,ref:h,disabled:n,onClick:cn(e.onClick,x),onPointerDown:y=>{var w;(w=e.onPointerDown)==null||w.call(e,y),p.current=!0},onPointerUp:cn(e.onPointerUp,y=>{var w;p.current||(w=y.currentTarget)==null||w.click()}),onKeyDown:cn(e.onKeyDown,y=>{const w=a.searchRef.current!=="";n||w&&y.key===" "||mhe.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});ise.displayName=cte;var lLe=P.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:i,...o}=e,l=Uge(cte,n),a=rLe(n),h=P.useRef(null),p=ei(t,h),[x,y]=P.useState(!1),[w,j]=P.useState("");return P.useEffect(()=>{const S=h.current;S&&j((S.textContent??"").trim())},[o.children]),r.jsx(rE.ItemSlot,{scope:n,disabled:s,textValue:i??w,children:r.jsx(zge,{asChild:!0,...a,focusable:!s,children:r.jsx(Rn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:p,onPointerMove:cn(e.onPointerMove,nE(S=>{s?l.onItemLeave(S):(l.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:cn(e.onPointerLeave,nE(S=>l.onItemLeave(S))),onFocus:cn(e.onFocus,()=>y(!0)),onBlur:cn(e.onBlur,()=>y(!1))})})})}),Lot="MenuCheckboxItem",cLe=P.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...i}=e;return r.jsx(pLe,{scope:e.__scopeMenu,checked:n,children:r.jsx(ise,{role:"menuitemcheckbox","aria-checked":dte(n)?"mixed":n,...i,ref:t,"data-state":Wge(n),onSelect:cn(i.onSelect,()=>s==null?void 0:s(dte(n)?!0:!n),{checkForDefaultPrevented:!1})})})});cLe.displayName=Lot;var dLe="MenuRadioGroup",[Oot,Dot]=nk(dLe,{value:void 0,onValueChange:()=>{}}),uLe=P.forwardRef((e,t)=>{const{value:n,onValueChange:s,...i}=e,o=Gl(s);return r.jsx(Oot,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Vge,{...i,ref:t})})});uLe.displayName=dLe;var hLe="MenuRadioItem",fLe=P.forwardRef((e,t)=>{const{value:n,...s}=e,i=Dot(hLe,e.__scopeMenu),o=n===i.value;return r.jsx(pLe,{scope:e.__scopeMenu,checked:o,children:r.jsx(ise,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Wge(o),onSelect:cn(s.onSelect,()=>{var l;return(l=i.onValueChange)==null?void 0:l.call(i,n)},{checkForDefaultPrevented:!1})})})});fLe.displayName=hLe;var Hge="MenuItemIndicator",[pLe,Rot]=nk(Hge,{checked:!1}),mLe=P.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...i}=e,o=Rot(Hge,n);return r.jsx(fc,{present:s||dte(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{...i,ref:t,"data-state":Wge(o.checked)})})});mLe.displayName=Hge;var Fot="MenuSeparator",gLe=P.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Rn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});gLe.displayName=Fot;var zot="MenuArrow",xLe=P.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=sse(n);return r.jsx(hI,{...i,...s,ref:t})});xLe.displayName=zot;var Bot="MenuSub",[GZt,yLe]=nk(Bot),dT="MenuSubTrigger",vLe=P.forwardRef((e,t)=>{const n=sk(dT,e.__scopeMenu),s=jI(dT,e.__scopeMenu),i=yLe(dT,e.__scopeMenu),o=Uge(dT,e.__scopeMenu),l=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:h}=o,p={__scopeMenu:e.__scopeMenu},x=P.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return P.useEffect(()=>x,[x]),P.useEffect(()=>{const y=a.current;return()=>{window.clearTimeout(y),h(null)}},[a,h]),r.jsx(Bge,{asChild:!0,...p,children:r.jsx(lLe,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":wLe(n.open),...e,ref:ny(t,i.onTriggerChange),onClick:y=>{var w;(w=e.onClick)==null||w.call(e,y),!(e.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:cn(e.onPointerMove,nE(y=>{o.onItemEnter(y),!y.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),x()},100))})),onPointerLeave:cn(e.onPointerLeave,nE(y=>{var j,S;x();const w=(j=n.content)==null?void 0:j.getBoundingClientRect();if(w){const C=(S=n.content)==null?void 0:S.dataset.side,A=C==="right",E=A?-5:5,T=w[A?"left":"right"],O=w[A?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+E,y:y.clientY},{x:T,y:w.top},{x:O,y:w.top},{x:O,y:w.bottom},{x:T,y:w.bottom}],side:C}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:cn(e.onKeyDown,y=>{var j;const w=o.searchRef.current!=="";e.disabled||w&&y.key===" "||_ot[s.dir].includes(y.key)&&(n.onOpenChange(!0),(j=n.content)==null||j.focus(),y.preventDefault())})})})});vLe.displayName=dT;var _Le="MenuSubContent",bLe=P.forwardRef((e,t)=>{const n=sLe(Zf,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,o=sk(Zf,e.__scopeMenu),l=jI(Zf,e.__scopeMenu),a=yLe(_Le,e.__scopeMenu),h=P.useRef(null),p=ei(t,h);return r.jsx(rE.Provider,{scope:e.__scopeMenu,children:r.jsx(fc,{present:s||o.open,children:r.jsx(rE.Slot,{scope:e.__scopeMenu,children:r.jsx(qge,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:p,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{var y;l.isUsingKeyboardRef.current&&((y=h.current)==null||y.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:cn(e.onFocusOutside,x=>{x.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:cn(e.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:cn(e.onKeyDown,x=>{var j;const y=x.currentTarget.contains(x.target),w=bot[l.dir].includes(x.key);y&&w&&(o.onOpenChange(!1),(j=a.trigger)==null||j.focus(),x.preventDefault())})})})})})});bLe.displayName=_Le;function wLe(e){return e?"open":"closed"}function dte(e){return e==="indeterminate"}function Wge(e){return dte(e)?"indeterminate":e?"checked":"unchecked"}function $ot(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Uot(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function qot(e,t,n){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=Uot(e,Math.max(o,0));i.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function Vot(e,t){const{x:n,y:s}=e;let i=!1;for(let o=0,l=t.length-1;os!=w>s&&n<(y-p)*(s-x)/(w-x)+p&&(i=!i)}return i}function Hot(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Vot(n,t)}function nE(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Wot=nLe,Got=Bge,Kot=iLe,Zot=aLe,Yot=Vge,Xot=oLe,Qot=ise,Jot=cLe,elt=uLe,tlt=fLe,rlt=mLe,nlt=gLe,slt=xLe,ilt=vLe,alt=bLe,ase="DropdownMenu",[olt]=Ql(ase,[tLe]),Bu=tLe(),[llt,jLe]=olt(ase),kLe=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:i,defaultOpen:o,onOpenChange:l,modal:a=!0}=e,h=Bu(t),p=P.useRef(null),[x,y]=Lu({prop:i,defaultProp:o??!1,onChange:l,caller:ase});return r.jsx(llt,{scope:t,triggerId:Vc(),triggerRef:p,contentId:Vc(),open:x,onOpenChange:y,onOpenToggle:P.useCallback(()=>y(w=>!w),[y]),modal:a,children:r.jsx(Wot,{...h,open:x,onOpenChange:y,dir:s,modal:a,children:n})})};kLe.displayName=ase;var NLe="DropdownMenuTrigger",SLe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...i}=e,o=jLe(NLe,n),l=Bu(n);return r.jsx(Got,{asChild:!0,...l,children:r.jsx(Rn.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":s?"":void 0,disabled:s,...i,ref:ny(t,o.triggerRef),onPointerDown:cn(e.onPointerDown,a=>{!s&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:cn(e.onKeyDown,a=>{s||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});SLe.displayName=NLe;var clt="DropdownMenuPortal",CLe=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Bu(t);return r.jsx(Kot,{...s,...n})};CLe.displayName=clt;var MLe="DropdownMenuContent",TLe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=jLe(MLe,n),o=Bu(n),l=P.useRef(!1);return r.jsx(Zot,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...s,ref:t,onCloseAutoFocus:cn(e.onCloseAutoFocus,a=>{var h;l.current||(h=i.triggerRef.current)==null||h.focus(),l.current=!1,a.preventDefault()}),onInteractOutside:cn(e.onInteractOutside,a=>{const h=a.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,x=h.button===2||p;(!i.modal||x)&&(l.current=!0)}),style:{...e.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)"}})});TLe.displayName=MLe;var dlt="DropdownMenuGroup",ult=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(Yot,{...i,...s,ref:t})});ult.displayName=dlt;var hlt="DropdownMenuLabel",ALe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(Xot,{...i,...s,ref:t})});ALe.displayName=hlt;var flt="DropdownMenuItem",ELe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(Qot,{...i,...s,ref:t})});ELe.displayName=flt;var plt="DropdownMenuCheckboxItem",ILe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(Jot,{...i,...s,ref:t})});ILe.displayName=plt;var mlt="DropdownMenuRadioGroup",glt=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(elt,{...i,...s,ref:t})});glt.displayName=mlt;var xlt="DropdownMenuRadioItem",PLe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(tlt,{...i,...s,ref:t})});PLe.displayName=xlt;var ylt="DropdownMenuItemIndicator",LLe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(rlt,{...i,...s,ref:t})});LLe.displayName=ylt;var vlt="DropdownMenuSeparator",OLe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(nlt,{...i,...s,ref:t})});OLe.displayName=vlt;var _lt="DropdownMenuArrow",blt=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(slt,{...i,...s,ref:t})});blt.displayName=_lt;var wlt="DropdownMenuSubTrigger",DLe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(ilt,{...i,...s,ref:t})});DLe.displayName=wlt;var jlt="DropdownMenuSubContent",RLe=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Bu(n);return r.jsx(alt,{...i,...s,ref:t,style:{...e.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)"}})});RLe.displayName=jlt;var klt=kLe,Nlt=SLe,Slt=CLe,FLe=TLe,zLe=ALe,BLe=ELe,$Le=ILe,ULe=PLe,qLe=LLe,VLe=OLe,HLe=DLe,WLe=RLe;const Sm=klt,Cm=Nlt,Clt=P.forwardRef(({className:e,inset:t,children:n,...s},i)=>r.jsxs(HLe,{ref:i,className:$t("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",t&&"pl-8",e),...s,children:[n,r.jsx(Ga,{className:"ml-auto h-4 w-4"})]}));Clt.displayName=HLe.displayName;const Mlt=P.forwardRef(({className:e,...t},n)=>r.jsx(WLe,{ref:n,className:$t("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]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Mlt.displayName=WLe.displayName;const ap=P.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(Slt,{children:r.jsx(FLe,{ref:s,sideOffset:t,className:$t("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",e),...n})}));ap.displayName=FLe.displayName;const po=P.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(BLe,{ref:s,className:$t("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",t&&"pl-8",e),...n}));po.displayName=BLe.displayName;const Tlt=P.forwardRef(({className:e,children:t,checked:n,...s},i)=>r.jsxs($Le,{ref:i,className:$t("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",e),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(qLe,{children:r.jsx(Ca,{className:"h-4 w-4"})})}),t]}));Tlt.displayName=$Le.displayName;const Alt=P.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(ULe,{ref:s,className:$t("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",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(qLe,{children:r.jsx(Pu,{className:"h-2 w-2 fill-current"})})}),t]}));Alt.displayName=ULe.displayName;const ghe=P.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(zLe,{ref:s,className:$t("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));ghe.displayName=zLe.displayName;const fC=P.forwardRef(({className:e,...t},n)=>r.jsx(VLe,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",e),...t}));fC.displayName=VLe.displayName;var ose="Collapsible",[Elt]=Ql(ose),[Ilt,Gge]=Elt(ose),GLe=P.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:i,disabled:o,onOpenChange:l,...a}=e,[h,p]=Lu({prop:s,defaultProp:i??!1,onChange:l,caller:ose});return r.jsx(Ilt,{scope:n,disabled:o,contentId:Vc(),open:h,onOpenToggle:P.useCallback(()=>p(x=>!x),[p]),children:r.jsx(Rn.div,{"data-state":Zge(h),"data-disabled":o?"":void 0,...a,ref:t})})});GLe.displayName=ose;var KLe="CollapsibleTrigger",ZLe=P.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,i=Gge(KLe,n);return r.jsx(Rn.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Zge(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:t,onClick:cn(e.onClick,i.onOpenToggle)})});ZLe.displayName=KLe;var Kge="CollapsibleContent",YLe=P.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=Gge(Kge,e.__scopeCollapsible);return r.jsx(fc,{present:n||i.open,children:({present:o})=>r.jsx(Plt,{...s,ref:t,present:o})})});YLe.displayName=Kge;var Plt=P.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:i,...o}=e,l=Gge(Kge,n),[a,h]=P.useState(s),p=P.useRef(null),x=ei(t,p),y=P.useRef(0),w=y.current,j=P.useRef(0),S=j.current,C=l.open||a,A=P.useRef(C),E=P.useRef(void 0);return P.useEffect(()=>{const T=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(T)},[]),Yl(()=>{const T=p.current;if(T){E.current=E.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const O=T.getBoundingClientRect();y.current=O.height,j.current=O.width,A.current||(T.style.transitionDuration=E.current.transitionDuration,T.style.animationName=E.current.animationName),h(s)}},[l.open,s]),r.jsx(Rn.div,{"data-state":Zge(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!C,...o,ref:x,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...e.style},children:C&&i})});function Zge(e){return e?"open":"closed"}var Llt=GLe;const kS=Llt,NS=ZLe,SS=YLe,zje="/assets/levelup-logo-Eif24dqY.png",Olt="/assets/levelup-logo-icon-C-7iromj.png";var kI=e=>e.type==="checkbox",Fw=e=>e instanceof Date,_u=e=>e==null;const XLe=e=>typeof e=="object";var hc=e=>!_u(e)&&!Array.isArray(e)&&XLe(e)&&!Fw(e),QLe=e=>hc(e)&&e.target?kI(e.target)?e.target.checked:e.target.value:e,Dlt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,JLe=(e,t)=>e.has(Dlt(t)),Rlt=e=>{const t=e.constructor&&e.constructor.prototype;return hc(t)&&t.hasOwnProperty("isPrototypeOf")},Yge=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Dc(e){let t;const n=Array.isArray(e),s=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Yge&&(e instanceof Blob||s))&&(n||hc(e)))if(t=n?[]:{},!n&&!Rlt(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=Dc(e[i]));else return e;return t}var lse=e=>/^\w*$/.test(e),sc=e=>e===void 0,Xge=e=>Array.isArray(e)?e.filter(Boolean):[],Qge=e=>Xge(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Gn=(e,t,n)=>{if(!t||!hc(e))return n;const s=(lse(t)?[t]:Qge(t)).reduce((i,o)=>_u(i)?i:i[o],e);return sc(s)||s===e?sc(e[t])?n:e[t]:s},Fh=e=>typeof e=="boolean",bo=(e,t,n)=>{let s=-1;const i=lse(t)?[t]:Qge(t),o=i.length,l=o-1;for(;++srt.useContext(Jge),Flt=e=>{const{children:t,...n}=e;return rt.createElement(Jge.Provider,{value:n},t)};var e8e=(e,t,n,s=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const l=o;return t._proxyFormState[l]!==tm.all&&(t._proxyFormState[l]=!s||tm.all),n&&(n[l]=!0),e[l]}});return i};const exe=typeof window<"u"?rt.useLayoutEffect:rt.useEffect;function zlt(e){const t=cse(),{control:n=t.control,disabled:s,name:i,exact:o}=e||{},[l,a]=rt.useState(n._formState),h=rt.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return exe(()=>n._subscribe({name:i,formState:h.current,exact:o,callback:p=>{!s&&a({...n._formState,...p})}}),[i,s,o]),rt.useEffect(()=>{h.current.isValid&&n._setValid(!0)},[n]),rt.useMemo(()=>e8e(l,n,h.current,!1),[l,n])}var hg=e=>typeof e=="string",t8e=(e,t,n,s,i)=>hg(e)?(s&&t.watch.add(e),Gn(n,e,i)):Array.isArray(e)?e.map(o=>(s&&t.watch.add(o),Gn(n,o))):(s&&(t.watchAll=!0),n),xhe=e=>_u(e)||!XLe(e);function Tx(e,t,n=new WeakSet){if(xhe(e)||xhe(t))return e===t;if(Fw(e)&&Fw(t))return e.getTime()===t.getTime();const s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of s){const l=e[o];if(!i.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Fw(l)&&Fw(a)||hc(l)&&hc(a)||Array.isArray(l)&&Array.isArray(a)?!Tx(l,a,n):l!==a)return!1}}return!0}function Blt(e){const t=cse(),{control:n=t.control,name:s,defaultValue:i,disabled:o,exact:l,compute:a}=e||{},h=rt.useRef(i),p=rt.useRef(a),x=rt.useRef(void 0);p.current=a;const y=rt.useMemo(()=>n._getWatch(s,h.current),[n,s]),[w,j]=rt.useState(p.current?p.current(y):y);return exe(()=>n._subscribe({name:s,formState:{values:!0},exact:l,callback:S=>{if(!o){const C=t8e(s,n._names,S.values||n._formValues,!1,h.current);if(p.current){const A=p.current(C);Tx(A,x.current)||(j(A),x.current=A)}else j(C)}}}),[n,o,s,l]),rt.useEffect(()=>n._removeUnmounted()),w}function $lt(e){const t=cse(),{name:n,disabled:s,control:i=t.control,shouldUnregister:o,defaultValue:l}=e,a=JLe(i._names.array,n),h=rt.useMemo(()=>Gn(i._formValues,n,Gn(i._defaultValues,n,l)),[i,n,l]),p=Blt({control:i,name:n,defaultValue:h,exact:!0}),x=zlt({control:i,name:n,exact:!0}),y=rt.useRef(e),w=rt.useRef(i.register(n,{...e.rules,value:p,...Fh(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const j=rt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Gn(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!Gn(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Gn(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Gn(x.validatingFields,n)},error:{enumerable:!0,get:()=>Gn(x.errors,n)}}),[x,n]),S=rt.useCallback(T=>w.current.onChange({target:{value:QLe(T),name:n},type:ute.CHANGE}),[n]),C=rt.useCallback(()=>w.current.onBlur({target:{value:Gn(i._formValues,n),name:n},type:ute.BLUR}),[n,i._formValues]),A=rt.useCallback(T=>{const O=Gn(i._fields,n);O&&T&&(O._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:z=>T.setCustomValidity(z),reportValidity:()=>T.reportValidity()})},[i._fields,n]),E=rt.useMemo(()=>({name:n,value:p,...Fh(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:S,onBlur:C,ref:A}),[n,s,x.disabled,S,C,A,p]);return rt.useEffect(()=>{const T=i._options.shouldUnregister||o;i.register(n,{...y.current.rules,...Fh(y.current.disabled)?{disabled:y.current.disabled}:{}});const O=(z,F)=>{const q=Gn(i._fields,z);q&&q._f&&(q._f.mount=F)};if(O(n,!0),T){const z=Dc(Gn(i._options.defaultValues,n));bo(i._defaultValues,n,z),sc(Gn(i._formValues,n))&&bo(i._formValues,n,z)}return!a&&i.register(n),()=>{(a?T&&!i._state.action:T)?i.unregister(n):O(n,!1)}},[n,i,a,o]),rt.useEffect(()=>{i._setDisabledField({disabled:s,name:n})},[s,n,i]),rt.useMemo(()=>({field:E,formState:x,fieldState:j}),[E,x,j])}const Ult=e=>e.render($lt(e));var r8e=(e,t,n,s,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:i||!0}}:{},aA=e=>Array.isArray(e)?e:[e],Bje=()=>{let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}},sh=e=>hc(e)&&!Object.keys(e).length,txe=e=>e.type==="file",rm=e=>typeof e=="function",hte=e=>{if(!Yge)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},n8e=e=>e.type==="select-multiple",rxe=e=>e.type==="radio",qlt=e=>rxe(e)||kI(e),Wle=e=>hte(e)&&e.isConnected;function Vlt(e,t){const n=t.slice(0,-1).length;let s=0;for(;s{for(const t in e)if(rm(e[t]))return!0;return!1};function fte(e,t={}){const n=Array.isArray(e);if(hc(e)||n)for(const s in e)Array.isArray(e[s])||hc(e[s])&&!s8e(e[s])?(t[s]=Array.isArray(e[s])?[]:{},fte(e[s],t[s])):_u(e[s])||(t[s]=!0);return t}function i8e(e,t,n){const s=Array.isArray(e);if(hc(e)||s)for(const i in e)Array.isArray(e[i])||hc(e[i])&&!s8e(e[i])?sc(t)||xhe(n[i])?n[i]=Array.isArray(e[i])?fte(e[i],[]):{...fte(e[i])}:i8e(e[i],_u(t)?{}:t[i],n[i]):n[i]=!Tx(e[i],t[i]);return n}var LM=(e,t)=>i8e(e,t,fte(t));const $je={value:!1,isValid:!1},Uje={value:!0,isValid:!0};var a8e=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!sc(e[0].attributes.value)?sc(e[0].value)||e[0].value===""?Uje:{value:e[0].value,isValid:!0}:Uje:$je}return $je},o8e=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:s})=>sc(e)?e:t?e===""?NaN:e&&+e:n&&hg(e)?new Date(e):s?s(e):e;const qje={isValid:!1,value:null};var l8e=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,qje):qje;function Vje(e){const t=e.ref;return txe(t)?t.files:rxe(t)?l8e(e.refs).value:n8e(t)?[...t.selectedOptions].map(({value:n})=>n):kI(t)?a8e(e.refs).value:o8e(sc(t.value)?e.ref.value:t.value,e)}var Wlt=(e,t,n,s)=>{const i={};for(const o of e){const l=Gn(t,o);l&&bo(i,o,l._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:s}},pte=e=>e instanceof RegExp,OM=e=>sc(e)?e:pte(e)?e.source:hc(e)?pte(e.value)?e.value.source:e.value:e,Hje=e=>({isOnSubmit:!e||e===tm.onSubmit,isOnBlur:e===tm.onBlur,isOnChange:e===tm.onChange,isOnAll:e===tm.all,isOnTouch:e===tm.onTouched});const Wje="AsyncFunction";var Glt=e=>!!e&&!!e.validate&&!!(rm(e.validate)&&e.validate.constructor.name===Wje||hc(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Wje)),Klt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Gje=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const oA=(e,t,n,s)=>{for(const i of n||Object.keys(e)){const o=Gn(e,i);if(o){const{_f:l,...a}=o;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],i)&&!s)return!0;if(l.ref&&t(l.ref,l.name)&&!s)return!0;if(oA(a,t))break}else if(hc(a)&&oA(a,t))break}}};function Kje(e,t,n){const s=Gn(e,n);if(s||lse(n))return{error:s,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),l=Gn(t,o),a=Gn(e,o);if(l&&!Array.isArray(l)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};i.pop()}return{name:n}}var Zlt=(e,t,n,s)=>{n(e);const{name:i,...o}=e;return sh(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(l=>t[l]===(!s||tm.all))},Ylt=(e,t,n)=>!e||!t||e===t||aA(e).some(s=>s&&(n?s===t:s.startsWith(t)||t.startsWith(s))),Xlt=(e,t,n,s,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?s.isOnBlur:i.isOnBlur)?!e:(n?s.isOnChange:i.isOnChange)?e:!0,Qlt=(e,t)=>!Xge(Gn(e,t)).length&&vc(e,t),Jlt=(e,t,n)=>{const s=aA(Gn(e,n));return bo(s,"root",t[n]),bo(e,n,s),e},aee=e=>hg(e);function Zje(e,t,n="validate"){if(aee(e)||Array.isArray(e)&&e.every(aee)||Fh(e)&&!e)return{type:n,message:aee(e)?e:"",ref:t}}var t4=e=>hc(e)&&!pte(e)?e:{value:e,message:""},Yje=async(e,t,n,s,i,o)=>{const{ref:l,refs:a,required:h,maxLength:p,minLength:x,min:y,max:w,pattern:j,validate:S,name:C,valueAsNumber:A,mount:E}=e._f,T=Gn(n,C);if(!E||t.has(C))return{};const O=a?a[0]:l,z=he=>{i&&O.reportValidity&&(O.setCustomValidity(Fh(he)?"":he||""),O.reportValidity())},F={},q=rxe(l),H=kI(l),K=q||H,Z=(A||txe(l))&&sc(l.value)&&sc(T)||hte(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,re=r8e.bind(null,C,s,F),ue=(he,be,ne,ye=hx.maxLength,ie=hx.minLength)=>{const fe=he?be:ne;F[C]={type:he?ye:ie,message:fe,ref:l,...re(he?ye:ie,fe)}};if(o?!Array.isArray(T)||!T.length:h&&(!K&&(Z||_u(T))||Fh(T)&&!T||H&&!a8e(a).isValid||q&&!l8e(a).isValid)){const{value:he,message:be}=aee(h)?{value:!!h,message:h}:t4(h);if(he&&(F[C]={type:hx.required,message:be,ref:O,...re(hx.required,be)},!s))return z(be),F}if(!Z&&(!_u(y)||!_u(w))){let he,be;const ne=t4(w),ye=t4(y);if(!_u(T)&&!isNaN(T)){const ie=l.valueAsNumber||T&&+T;_u(ne.value)||(he=ie>ne.value),_u(ye.value)||(be=ienew Date(new Date().toDateString()+" "+Ee),de=l.type=="time",_e=l.type=="week";hg(ne.value)&&T&&(he=de?fe(T)>fe(ne.value):_e?T>ne.value:ie>new Date(ne.value)),hg(ye.value)&&T&&(be=de?fe(T)+he.value,ye=!_u(be.value)&&T.length<+be.value;if((ne||ye)&&(ue(ne,he.message,be.message),!s))return z(F[C].message),F}if(j&&!Z&&hg(T)){const{value:he,message:be}=t4(j);if(pte(he)&&!T.match(he)&&(F[C]={type:hx.pattern,message:be,ref:l,...re(hx.pattern,be)},!s))return z(be),F}if(S){if(rm(S)){const he=await S(T,n),be=Zje(he,O);if(be&&(F[C]={...be,...re(hx.validate,be.message)},!s))return z(be.message),F}else if(hc(S)){let he={};for(const be in S){if(!sh(he)&&!s)break;const ne=Zje(await S[be](T,n),O,be);ne&&(he={...ne,...re(be,ne.message)},z(ne.message),s&&(F[C]=he))}if(!sh(he)&&(F[C]={ref:O,...he},!s))return F}}return z(!0),F};const ect={mode:tm.onSubmit,reValidateMode:tm.onChange,shouldFocusError:!0};function tct(e={}){let t={...ect,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:rm(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},i=hc(t.defaultValues)||hc(t.values)?Dc(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Dc(i),l={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},h,p=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...x};const w={array:Bje(),state:Bje()},j=t.criteriaMode===tm.all,S=Be=>Qe=>{clearTimeout(p),p=setTimeout(Be,Qe)},C=async Be=>{if(!t.disabled&&(x.isValid||y.isValid||Be)){const Qe=t.resolver?sh((await H()).errors):await Z(s,!0);Qe!==n.isValid&&w.state.next({isValid:Qe})}},A=(Be,Qe)=>{!t.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&((Be||Array.from(a.mount)).forEach(tt=>{tt&&(Qe?bo(n.validatingFields,tt,Qe):vc(n.validatingFields,tt))}),w.state.next({validatingFields:n.validatingFields,isValidating:!sh(n.validatingFields)}))},E=(Be,Qe=[],tt,ht,wt=!0,Ct=!0)=>{if(ht&&tt&&!t.disabled){if(l.action=!0,Ct&&Array.isArray(Gn(s,Be))){const It=tt(Gn(s,Be),ht.argA,ht.argB);wt&&bo(s,Be,It)}if(Ct&&Array.isArray(Gn(n.errors,Be))){const It=tt(Gn(n.errors,Be),ht.argA,ht.argB);wt&&bo(n.errors,Be,It),Qlt(n.errors,Be)}if((x.touchedFields||y.touchedFields)&&Ct&&Array.isArray(Gn(n.touchedFields,Be))){const It=tt(Gn(n.touchedFields,Be),ht.argA,ht.argB);wt&&bo(n.touchedFields,Be,It)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=LM(i,o)),w.state.next({name:Be,isDirty:ue(Be,Qe),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else bo(o,Be,Qe)},T=(Be,Qe)=>{bo(n.errors,Be,Qe),w.state.next({errors:n.errors})},O=Be=>{n.errors=Be,w.state.next({errors:n.errors,isValid:!1})},z=(Be,Qe,tt,ht)=>{const wt=Gn(s,Be);if(wt){const Ct=Gn(o,Be,sc(tt)?Gn(i,Be):tt);sc(Ct)||ht&&ht.defaultChecked||Qe?bo(o,Be,Qe?Ct:Vje(wt._f)):ne(Be,Ct),l.mount&&C()}},F=(Be,Qe,tt,ht,wt)=>{let Ct=!1,It=!1;const jt={name:Be};if(!t.disabled){if(!tt||ht){(x.isDirty||y.isDirty)&&(It=n.isDirty,n.isDirty=jt.isDirty=ue(),Ct=It!==jt.isDirty);const rr=Tx(Gn(i,Be),Qe);It=!!Gn(n.dirtyFields,Be),rr?vc(n.dirtyFields,Be):bo(n.dirtyFields,Be,!0),jt.dirtyFields=n.dirtyFields,Ct=Ct||(x.dirtyFields||y.dirtyFields)&&It!==!rr}if(tt){const rr=Gn(n.touchedFields,Be);rr||(bo(n.touchedFields,Be,tt),jt.touchedFields=n.touchedFields,Ct=Ct||(x.touchedFields||y.touchedFields)&&rr!==tt)}Ct&&wt&&w.state.next(jt)}return Ct?jt:{}},q=(Be,Qe,tt,ht)=>{const wt=Gn(n.errors,Be),Ct=(x.isValid||y.isValid)&&Fh(Qe)&&n.isValid!==Qe;if(t.delayError&&tt?(h=S(()=>T(Be,tt)),h(t.delayError)):(clearTimeout(p),h=null,tt?bo(n.errors,Be,tt):vc(n.errors,Be)),(tt?!Tx(wt,tt):wt)||!sh(ht)||Ct){const It={...ht,...Ct&&Fh(Qe)?{isValid:Qe}:{},errors:n.errors,name:Be};n={...n,...It},w.state.next(It)}},H=async Be=>{A(Be,!0);const Qe=await t.resolver(o,t.context,Wlt(Be||a.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return A(Be),Qe},K=async Be=>{const{errors:Qe}=await H(Be);if(Be)for(const tt of Be){const ht=Gn(Qe,tt);ht?bo(n.errors,tt,ht):vc(n.errors,tt)}else n.errors=Qe;return Qe},Z=async(Be,Qe,tt={valid:!0})=>{for(const ht in Be){const wt=Be[ht];if(wt){const{_f:Ct,...It}=wt;if(Ct){const jt=a.array.has(Ct.name),rr=wt._f&&Glt(wt._f);rr&&x.validatingFields&&A([ht],!0);const Ar=await Yje(wt,a.disabled,o,j,t.shouldUseNativeValidation&&!Qe,jt);if(rr&&x.validatingFields&&A([ht]),Ar[Ct.name]&&(tt.valid=!1,Qe))break;!Qe&&(Gn(Ar,Ct.name)?jt?Jlt(n.errors,Ar,Ct.name):bo(n.errors,Ct.name,Ar[Ct.name]):vc(n.errors,Ct.name))}!sh(It)&&await Z(It,Qe,tt)}}return tt.valid},re=()=>{for(const Be of a.unMount){const Qe=Gn(s,Be);Qe&&(Qe._f.refs?Qe._f.refs.every(tt=>!Wle(tt)):!Wle(Qe._f.ref))&&Ie(Be)}a.unMount=new Set},ue=(Be,Qe)=>!t.disabled&&(Be&&Qe&&bo(o,Be,Qe),!Tx(Ee(),i)),he=(Be,Qe,tt)=>t8e(Be,a,{...l.mount?o:sc(Qe)?i:hg(Be)?{[Be]:Qe}:Qe},tt,Qe),be=Be=>Xge(Gn(l.mount?o:i,Be,t.shouldUnregister?Gn(i,Be,[]):[])),ne=(Be,Qe,tt={})=>{const ht=Gn(s,Be);let wt=Qe;if(ht){const Ct=ht._f;Ct&&(!Ct.disabled&&bo(o,Be,o8e(Qe,Ct)),wt=hte(Ct.ref)&&_u(Qe)?"":Qe,n8e(Ct.ref)?[...Ct.ref.options].forEach(It=>It.selected=wt.includes(It.value)):Ct.refs?kI(Ct.ref)?Ct.refs.forEach(It=>{(!It.defaultChecked||!It.disabled)&&(Array.isArray(wt)?It.checked=!!wt.find(jt=>jt===It.value):It.checked=wt===It.value||!!wt)}):Ct.refs.forEach(It=>It.checked=It.value===wt):txe(Ct.ref)?Ct.ref.value="":(Ct.ref.value=wt,Ct.ref.type||w.state.next({name:Be,values:Dc(o)})))}(tt.shouldDirty||tt.shouldTouch)&&F(Be,wt,tt.shouldTouch,tt.shouldDirty,!0),tt.shouldValidate&&_e(Be)},ye=(Be,Qe,tt)=>{for(const ht in Qe){if(!Qe.hasOwnProperty(ht))return;const wt=Qe[ht],Ct=Be+"."+ht,It=Gn(s,Ct);(a.array.has(Be)||hc(wt)||It&&!It._f)&&!Fw(wt)?ye(Ct,wt,tt):ne(Ct,wt,tt)}},ie=(Be,Qe,tt={})=>{const ht=Gn(s,Be),wt=a.array.has(Be),Ct=Dc(Qe);bo(o,Be,Ct),wt?(w.array.next({name:Be,values:Dc(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&tt.shouldDirty&&w.state.next({name:Be,dirtyFields:LM(i,o),isDirty:ue(Be,Ct)})):ht&&!ht._f&&!_u(Ct)?ye(Be,Ct,tt):ne(Be,Ct,tt),Gje(Be,a)&&w.state.next({...n,name:Be}),w.state.next({name:l.mount?Be:void 0,values:Dc(o)})},fe=async Be=>{l.mount=!0;const Qe=Be.target;let tt=Qe.name,ht=!0;const wt=Gn(s,tt),Ct=rr=>{ht=Number.isNaN(rr)||Fw(rr)&&isNaN(rr.getTime())||Tx(rr,Gn(o,tt,rr))},It=Hje(t.mode),jt=Hje(t.reValidateMode);if(wt){let rr,Ar;const gn=Qe.type?Vje(wt._f):QLe(Be),kn=Be.type===ute.BLUR||Be.type===ute.FOCUS_OUT,Jr=!Klt(wt._f)&&!t.resolver&&!Gn(n.errors,tt)&&!wt._f.deps||Xlt(kn,Gn(n.touchedFields,tt),n.isSubmitted,jt,It),zn=Gje(tt,a,kn);bo(o,tt,gn),kn?(wt._f.onBlur&&wt._f.onBlur(Be),h&&h(0)):wt._f.onChange&&wt._f.onChange(Be);const js=F(tt,gn,kn),fr=!sh(js)||zn;if(!kn&&w.state.next({name:tt,type:Be.type,values:Dc(o)}),Jr)return(x.isValid||y.isValid)&&(t.mode==="onBlur"?kn&&C():kn||C()),fr&&w.state.next({name:tt,...zn?{}:js});if(!kn&&zn&&w.state.next({...n}),t.resolver){const{errors:xs}=await H([tt]);if(Ct(gn),ht){const bi=Kje(n.errors,s,tt),mi=Kje(xs,s,bi.name||tt);rr=mi.error,tt=mi.name,Ar=sh(xs)}}else A([tt],!0),rr=(await Yje(wt,a.disabled,o,j,t.shouldUseNativeValidation))[tt],A([tt]),Ct(gn),ht&&(rr?Ar=!1:(x.isValid||y.isValid)&&(Ar=await Z(s,!0)));ht&&(wt._f.deps&&_e(wt._f.deps),q(tt,Ar,rr,js))}},de=(Be,Qe)=>{if(Gn(n.errors,Qe)&&Be.focus)return Be.focus(),1},_e=async(Be,Qe={})=>{let tt,ht;const wt=aA(Be);if(t.resolver){const Ct=await K(sc(Be)?Be:wt);tt=sh(Ct),ht=Be?!wt.some(It=>Gn(Ct,It)):tt}else Be?(ht=(await Promise.all(wt.map(async Ct=>{const It=Gn(s,Ct);return await Z(It&&It._f?{[Ct]:It}:It)}))).every(Boolean),!(!ht&&!n.isValid)&&C()):ht=tt=await Z(s);return w.state.next({...!hg(Be)||(x.isValid||y.isValid)&&tt!==n.isValid?{}:{name:Be},...t.resolver||!Be?{isValid:tt}:{},errors:n.errors}),Qe.shouldFocus&&!ht&&oA(s,de,Be?wt:a.mount),ht},Ee=Be=>{const Qe={...l.mount?o:i};return sc(Be)?Qe:hg(Be)?Gn(Qe,Be):Be.map(tt=>Gn(Qe,tt))},ke=(Be,Qe)=>({invalid:!!Gn((Qe||n).errors,Be),isDirty:!!Gn((Qe||n).dirtyFields,Be),error:Gn((Qe||n).errors,Be),isValidating:!!Gn(n.validatingFields,Be),isTouched:!!Gn((Qe||n).touchedFields,Be)}),pe=Be=>{Be&&aA(Be).forEach(Qe=>vc(n.errors,Qe)),w.state.next({errors:Be?n.errors:{}})},ae=(Be,Qe,tt)=>{const ht=(Gn(s,Be,{_f:{}})._f||{}).ref,wt=Gn(n.errors,Be)||{},{ref:Ct,message:It,type:jt,...rr}=wt;bo(n.errors,Be,{...rr,...Qe,ref:ht}),w.state.next({name:Be,errors:n.errors,isValid:!1}),tt&&tt.shouldFocus&&ht&&ht.focus&&ht.focus()},ge=(Be,Qe)=>rm(Be)?w.state.subscribe({next:tt=>"values"in tt&&Be(he(void 0,Qe),tt)}):he(Be,Qe,!0),Me=Be=>w.state.subscribe({next:Qe=>{Ylt(Be.name,Qe.name,Be.exact)&&Zlt(Qe,Be.formState||x,nt,Be.reRenderRoot)&&Be.callback({values:{...o},...n,...Qe,defaultValues:i})}}).unsubscribe,Ue=Be=>(l.mount=!0,y={...y,...Be.formState},Me({...Be,formState:y})),Ie=(Be,Qe={})=>{for(const tt of Be?aA(Be):a.mount)a.mount.delete(tt),a.array.delete(tt),Qe.keepValue||(vc(s,tt),vc(o,tt)),!Qe.keepError&&vc(n.errors,tt),!Qe.keepDirty&&vc(n.dirtyFields,tt),!Qe.keepTouched&&vc(n.touchedFields,tt),!Qe.keepIsValidating&&vc(n.validatingFields,tt),!t.shouldUnregister&&!Qe.keepDefaultValue&&vc(i,tt);w.state.next({values:Dc(o)}),w.state.next({...n,...Qe.keepDirty?{isDirty:ue()}:{}}),!Qe.keepIsValid&&C()},Ke=({disabled:Be,name:Qe})=>{(Fh(Be)&&l.mount||Be||a.disabled.has(Qe))&&(Be?a.disabled.add(Qe):a.disabled.delete(Qe))},Re=(Be,Qe={})=>{let tt=Gn(s,Be);const ht=Fh(Qe.disabled)||Fh(t.disabled);return bo(s,Be,{...tt||{},_f:{...tt&&tt._f?tt._f:{ref:{name:Be}},name:Be,mount:!0,...Qe}}),a.mount.add(Be),tt?Ke({disabled:Fh(Qe.disabled)?Qe.disabled:t.disabled,name:Be}):z(Be,!0,Qe.value),{...ht?{disabled:Qe.disabled||t.disabled}:{},...t.progressive?{required:!!Qe.required,min:OM(Qe.min),max:OM(Qe.max),minLength:OM(Qe.minLength),maxLength:OM(Qe.maxLength),pattern:OM(Qe.pattern)}:{},name:Be,onChange:fe,onBlur:fe,ref:wt=>{if(wt){Re(Be,Qe),tt=Gn(s,Be);const Ct=sc(wt.value)&&wt.querySelectorAll&&wt.querySelectorAll("input,select,textarea")[0]||wt,It=qlt(Ct),jt=tt._f.refs||[];if(It?jt.find(rr=>rr===Ct):Ct===tt._f.ref)return;bo(s,Be,{_f:{...tt._f,...It?{refs:[...jt.filter(Wle),Ct,...Array.isArray(Gn(i,Be))?[{}]:[]],ref:{type:Ct.type,name:Be}}:{ref:Ct}}}),z(Be,!1,void 0,Ct)}else tt=Gn(s,Be,{}),tt._f&&(tt._f.mount=!1),(t.shouldUnregister||Qe.shouldUnregister)&&!(JLe(a.array,Be)&&l.action)&&a.unMount.add(Be)}}},Ce=()=>t.shouldFocusError&&oA(s,de,a.mount),Je=Be=>{Fh(Be)&&(w.state.next({disabled:Be}),oA(s,(Qe,tt)=>{const ht=Gn(s,tt);ht&&(Qe.disabled=ht._f.disabled||Be,Array.isArray(ht._f.refs)&&ht._f.refs.forEach(wt=>{wt.disabled=ht._f.disabled||Be}))},0,!1))},Te=(Be,Qe)=>async tt=>{let ht;tt&&(tt.preventDefault&&tt.preventDefault(),tt.persist&&tt.persist());let wt=Dc(o);if(w.state.next({isSubmitting:!0}),t.resolver){const{errors:Ct,values:It}=await H();n.errors=Ct,wt=Dc(It)}else await Z(s);if(a.disabled.size)for(const Ct of a.disabled)vc(wt,Ct);if(vc(n.errors,"root"),sh(n.errors)){w.state.next({errors:{}});try{await Be(wt,tt)}catch(Ct){ht=Ct}}else Qe&&await Qe({...n.errors},tt),Ce(),setTimeout(Ce);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:sh(n.errors)&&!ht,submitCount:n.submitCount+1,errors:n.errors}),ht)throw ht},Ye=(Be,Qe={})=>{Gn(s,Be)&&(sc(Qe.defaultValue)?ie(Be,Dc(Gn(i,Be))):(ie(Be,Qe.defaultValue),bo(i,Be,Dc(Qe.defaultValue))),Qe.keepTouched||vc(n.touchedFields,Be),Qe.keepDirty||(vc(n.dirtyFields,Be),n.isDirty=Qe.defaultValue?ue(Be,Dc(Gn(i,Be))):ue()),Qe.keepError||(vc(n.errors,Be),x.isValid&&C()),w.state.next({...n}))},xe=(Be,Qe={})=>{const tt=Be?Dc(Be):i,ht=Dc(tt),wt=sh(Be),Ct=wt?i:ht;if(Qe.keepDefaultValues||(i=tt),!Qe.keepValues){if(Qe.keepDirtyValues){const It=new Set([...a.mount,...Object.keys(LM(i,o))]);for(const jt of Array.from(It))Gn(n.dirtyFields,jt)?bo(Ct,jt,Gn(o,jt)):ie(jt,Gn(Ct,jt))}else{if(Yge&&sc(Be))for(const It of a.mount){const jt=Gn(s,It);if(jt&&jt._f){const rr=Array.isArray(jt._f.refs)?jt._f.refs[0]:jt._f.ref;if(hte(rr)){const Ar=rr.closest("form");if(Ar){Ar.reset();break}}}}if(Qe.keepFieldsRef)for(const It of a.mount)ie(It,Gn(Ct,It));else s={}}o=t.shouldUnregister?Qe.keepDefaultValues?Dc(i):{}:Dc(Ct),w.array.next({values:{...Ct}}),w.state.next({values:{...Ct}})}a={mount:Qe.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Qe.keepIsValid||!!Qe.keepDirtyValues,l.watch=!!t.shouldUnregister,w.state.next({submitCount:Qe.keepSubmitCount?n.submitCount:0,isDirty:wt?!1:Qe.keepDirty?n.isDirty:!!(Qe.keepDefaultValues&&!Tx(Be,i)),isSubmitted:Qe.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:wt?{}:Qe.keepDirtyValues?Qe.keepDefaultValues&&o?LM(i,o):n.dirtyFields:Qe.keepDefaultValues&&Be?LM(i,Be):Qe.keepDirty?n.dirtyFields:{},touchedFields:Qe.keepTouched?n.touchedFields:{},errors:Qe.keepErrors?n.errors:{},isSubmitSuccessful:Qe.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},mt=(Be,Qe)=>xe(rm(Be)?Be(o):Be,Qe),et=(Be,Qe={})=>{const tt=Gn(s,Be),ht=tt&&tt._f;if(ht){const wt=ht.refs?ht.refs[0]:ht.ref;wt.focus&&(wt.focus(),Qe.shouldSelect&&rm(wt.select)&&wt.select())}},nt=Be=>{n={...n,...Be}},pt={control:{register:Re,unregister:Ie,getFieldState:ke,handleSubmit:Te,setError:ae,_subscribe:Me,_runSchema:H,_focusError:Ce,_getWatch:he,_getDirty:ue,_setValid:C,_setFieldArray:E,_setDisabledField:Ke,_setErrors:O,_getFieldArray:be,_reset:xe,_resetDefaultValues:()=>rm(t.defaultValues)&&t.defaultValues().then(Be=>{mt(Be,t.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:Je,_subjects:w,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return l},set _state(Be){l=Be},get _defaultValues(){return i},get _names(){return a},set _names(Be){a=Be},get _formState(){return n},get _options(){return t},set _options(Be){t={...t,...Be}}},subscribe:Ue,trigger:_e,register:Re,handleSubmit:Te,watch:ge,setValue:ie,getValues:Ee,reset:mt,resetField:Ye,clearErrors:pe,unregister:Ie,setError:ae,setFocus:et,getFieldState:ke};return{...pt,formControl:pt}}function dse(e={}){const t=rt.useRef(void 0),n=rt.useRef(void 0),[s,i]=rt.useState({isDirty:!1,isValidating:!1,isLoading:rm(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:rm(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!rm(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...a}=tct(e);t.current={...a,formState:s}}const o=t.current.control;return o._options=e,exe(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(a=>({...a,isReady:!0})),o._formState.isReady=!0,l},[o]),rt.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),rt.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),rt.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),rt.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),rt.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),rt.useEffect(()=>{e.values&&!Tx(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=e.values,i(l=>({...l}))):o._resetDefaultValues()},[o,e.values]),rt.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=e8e(s,o),t.current}const Xje=(e,t,n)=>{if(e&&"reportValidity"in e){const s=Gn(n,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},c8e=(e,t)=>{for(const n in t.fields){const s=t.fields[n];s&&s.ref&&"reportValidity"in s.ref?Xje(s.ref,n,e):s.refs&&s.refs.forEach(i=>Xje(i,n,e))}},rct=(e,t)=>{t.shouldUseNativeValidation&&c8e(e,t);const n={};for(const s in e){const i=Gn(t.fields,s),o=Object.assign(e[s]||{},{ref:i&&i.ref});if(nct(t.names||Object.keys(e),s)){const l=Object.assign({},Gn(n,s));bo(l,"root",o),bo(n,s,l)}else bo(n,s,o)}return n},nct=(e,t)=>e.some(n=>n.startsWith(t+"."));var sct=function(e,t){for(var n={};e.length;){var s=e[0],i=s.code,o=s.message,l=s.path.join(".");if(!n[l])if("unionErrors"in s){var a=s.unionErrors[0].errors[0];n[l]={message:a.message,type:a.code}}else n[l]={message:o,type:i};if("unionErrors"in s&&s.unionErrors.forEach(function(x){return x.errors.forEach(function(y){return e.push(y)})}),t){var h=n[l].types,p=h&&h[s.code];n[l]=r8e(l,t,n,i,p?[].concat(p,s.message):s.message)}e.shift()}return n},use=function(e,t,n){return n===void 0&&(n={}),function(s,i,o){try{return Promise.resolve(function(l,a){try{var h=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](s,t)).then(function(p){return o.shouldUseNativeValidation&&c8e({},o),{errors:{},values:n.raw?s:p}})}catch(p){return a(p)}return h&&h.then?h.then(void 0,a):h}(0,function(l){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(l))return{values:{},errors:rct(sct(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const hse=Flt,d8e=P.createContext({}),Ml=({...e})=>r.jsx(d8e.Provider,{value:{name:e.name},children:r.jsx(Ult,{...e})}),fse=()=>{const e=P.useContext(d8e),t=P.useContext(u8e),{getFieldState:n,formState:s}=cse(),i=n(e.name,s);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},u8e=P.createContext({}),vl=P.forwardRef(({className:e,...t},n)=>{const s=P.useId();return r.jsx(u8e.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:$t("space-y-2",e),...t})})});vl.displayName="FormItem";const _l=P.forwardRef(({className:e,...t},n)=>{const{error:s,formItemId:i}=fse();return r.jsx(Ve,{ref:n,className:$t(s&&"text-destructive",e),htmlFor:i,...t})});_l.displayName="FormLabel";const bl=P.forwardRef(({...e},t)=>{const{error:n,formItemId:s,formDescriptionId:i,formMessageId:o}=fse();return r.jsx($me,{ref:t,id:s,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...e})});bl.displayName="FormControl";const oee=P.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:s}=fse();return r.jsx("p",{ref:n,id:s,className:$t("text-sm text-muted-foreground",e),...t})});oee.displayName="FormDescription";const bu=P.forwardRef(({className:e,children:t,...n},s)=>{const{error:i,formMessageId:o}=fse(),l=i?String(i==null?void 0:i.message):t;return l?r.jsx("p",{ref:s,id:o,className:$t("text-sm font-medium text-destructive",e),...n,children:l}):null});bu.displayName="FormMessage";const ms=P.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:$t("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",e),ref:n,...t}));ms.displayName="Textarea";const ict=d3({category:I6e(["general","technology","crm","marketing"]),subject:nc().min(5,"Subject must be at least 5 characters").max(200),description:nc().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),act={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function yhe({trigger:e}){const[t,n]=P.useState(!1),[s,i]=P.useState(!1),{user:o}=zr(),l=dse({resolver:use(ict),defaultValues:{category:"general",subject:"",description:""}}),a=async h=>{if(!o){ze.error("You must be logged in to submit a ticket");return}i(!0);try{const{error:p}=await ee.from("support_tickets").insert({user_id:o.id,category:h.category,subject:h.subject,description:h.description});if(p)throw p;try{await ee.functions.invoke("support-ticket-notify",{body:{category:act[h.category],subject:h.subject}})}catch(x){console.log("Notification send attempted:",x)}ze.success("Support ticket submitted successfully!"),l.reset(),n(!1)}catch(p){console.error("Error submitting ticket:",p),ze.error("Failed to submit ticket. Please try again.")}finally{i(!1)}};return r.jsxs(Br,{open:t,onOpenChange:n,children:[r.jsx(Fo,{asChild:!0,children:e||r.jsxs(J,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(DT,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Fr,{className:"sm:max-w-[500px]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Need Help?"}),r.jsx(es,{children:"Submit a support ticket and we'll get back to you as soon as possible."})]}),r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg mb-4",children:[r.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["You can also text us at: ",r.jsx("span",{className:"font-medium text-foreground",children:"1-866-527-8668"})]})]}),r.jsx(hse,{...l,children:r.jsxs("form",{onSubmit:l.handleSubmit(a),className:"space-y-4",children:[r.jsx(Ml,{control:l.control,name:"category",render:({field:h})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Category"}),r.jsxs(bn,{onValueChange:h.onChange,defaultValue:h.value,children:[r.jsx(bl,{children:r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select a category"})})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"general",children:"General Support"}),r.jsx(Kt,{value:"technology",children:"Technology Support"}),r.jsx(Kt,{value:"crm",children:"CRM Support"}),r.jsx(Kt,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(bu,{})]})}),r.jsx(Ml,{control:l.control,name:"subject",render:({field:h})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Subject"}),r.jsx(bl,{children:r.jsx(ct,{placeholder:"Brief description of your issue",...h})}),r.jsx(bu,{})]})}),r.jsx(Ml,{control:l.control,name:"description",render:({field:h})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Description"}),r.jsx(bl,{children:r.jsx(ms,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...h})}),r.jsx(bu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(J,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function ws(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function jo(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Vl(e,t){const n=ws(e);return isNaN(t)?jo(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function tp(e,t){const n=ws(e);if(isNaN(t))return jo(e,NaN);if(!t)return n;const s=n.getDate(),i=jo(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}function h8e(e,t){const n=+ws(e);return jo(e,n+t)}const nxe=6048e5,oct=864e5,f8e=6e4,p8e=36e5,lct=1e3,_L=43200,Qje=1440;function vhe(e,t){return h8e(e,t*p8e)}let cct={};function nv(){return cct}function sf(e,t){var a,h,p,x;const n=nv(),s=(t==null?void 0:t.weekStartsOn)??((h=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,i=ws(e),o=i.getDay(),l=(o=i.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function af(e){const t=ws(e);return t.setHours(0,0,0,0),t}function z1(e){const t=ws(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function om(e,t){const n=af(e),s=af(t),i=+n-z1(n),o=+s-z1(s);return Math.round((i-o)/oct)}function dct(e){const t=m8e(e),n=jo(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),ay(n)}function uct(e,t){return h8e(e,t*f8e)}function _he(e,t){const n=t*7;return Vl(e,n)}function hct(e,t){return tp(e,t*12)}function fct(e){let t;return e.forEach(function(n){const s=ws(n);(t===void 0||t{const s=ws(n);(!t||t>s||isNaN(+s))&&(t=s)}),t||new Date(NaN)}function lee(e,t){const n=ws(e),s=ws(t),i=n.getTime()-s.getTime();return i<0?-1:i>0?1:i}function mct(e){return jo(e,Date.now())}function Kl(e,t){const n=af(e),s=af(t);return+n==+s}function sxe(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function bhe(e){if(!sxe(e)&&typeof e!="number")return!1;const t=ws(e);return!isNaN(Number(t))}function pC(e,t){const n=ws(e),s=ws(t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function gct(e,t,n){const s=sf(e,n),i=sf(t,n),o=+s-z1(s),l=+i-z1(i);return Math.round((o-l)/nxe)}function mC(e,t){const n=ws(e),s=ws(t),i=Jje(n,s),o=Math.abs(om(n,s));n.setDate(n.getDate()-i*o);const l=+(Jje(n,s)===-i),a=i*(o-l);return a===0?0:a}function Jje(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function xct(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function yct(e,t){return+ws(e)-+ws(t)}function vct(e){const t=ws(e);return t.setHours(23,59,59,999),t}function pse(e){const t=ws(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function _ct(e){const t=ws(e);return+vct(t)==+pse(t)}function bct(e,t){const n=ws(e),s=ws(t),i=lee(n,s),o=Math.abs(pC(n,s));let l;if(o<1)l=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*o);let a=lee(n,s)===-i;_ct(ws(e))&&o===1&&lee(e,s)===1&&(a=!1),l=i*(o-Number(a))}return l===0?0:l}function wct(e,t,n){const s=yct(e,t)/1e3;return xct(n==null?void 0:n.roundingMethod)(s)}function xh(e){const t=ws(e);return t.setDate(1),t.setHours(0,0,0,0),t}function g8e(e){const t=ws(e),n=jo(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ixe(e,t){var a,h,p,x;const n=nv(),s=(t==null?void 0:t.weekStartsOn)??((h=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,i=ws(e),o=i.getDay(),l=(o{let s;const i=jct[e];return typeof i=="string"?s=i:t===1?s=i.one:s=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Gle(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Nct={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Sct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Cct={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Mct={date:Gle({formats:Nct,defaultWidth:"full"}),time:Gle({formats:Sct,defaultWidth:"full"}),dateTime:Gle({formats:Cct,defaultWidth:"full"})},Tct={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Act=(e,t,n,s)=>Tct[e];function DM(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let i;if(s==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):l;i=e.formattingValues[a]||e.formattingValues[l]}else{const l=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[l]}const o=e.argumentCallback?e.argumentCallback(t):t;return i[o]}}const Ect={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ict={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Pct={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"]},Lct={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"]},Oct={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"}},Dct={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"}},Rct=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Fct={ordinalNumber:Rct,era:DM({values:Ect,defaultWidth:"wide"}),quarter:DM({values:Ict,defaultWidth:"wide",argumentCallback:e=>e-1}),month:DM({values:Pct,defaultWidth:"wide"}),day:DM({values:Lct,defaultWidth:"wide"}),dayPeriod:DM({values:Oct,defaultWidth:"wide",formattingValues:Dct,defaultFormattingWidth:"wide"})};function RM(e){return(t,n={})=>{const s=n.width,i=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const l=o[0],a=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],h=Array.isArray(a)?Bct(a,y=>y.test(l)):zct(a,y=>y.test(l));let p;p=e.valueCallback?e.valueCallback(h):h,p=n.valueCallback?n.valueCallback(p):p;const x=t.slice(l.length);return{value:p,rest:x}}}function zct(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Bct(e,t){for(let n=0;n{const s=t.match(e.matchPattern);if(!s)return null;const i=s[0],o=t.match(e.parsePattern);if(!o)return null;let l=e.valueCallback?e.valueCallback(o[0]):o[0];l=n.valueCallback?n.valueCallback(l):l;const a=t.slice(i.length);return{value:l,rest:a}}}const Uct=/^(\d+)(th|st|nd|rd)?/i,qct=/\d+/i,Vct={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},Hct={any:[/^b/i,/^(a|c)/i]},Wct={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Gct={any:[/1/i,/2/i,/3/i,/4/i]},Kct={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},Zct={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]},Yct={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},Xct={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]},Qct={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},Jct={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}},edt={ordinalNumber:$ct({matchPattern:Uct,parsePattern:qct,valueCallback:e=>parseInt(e,10)}),era:RM({matchPatterns:Vct,defaultMatchWidth:"wide",parsePatterns:Hct,defaultParseWidth:"any"}),quarter:RM({matchPatterns:Wct,defaultMatchWidth:"wide",parsePatterns:Gct,defaultParseWidth:"any",valueCallback:e=>e+1}),month:RM({matchPatterns:Kct,defaultMatchWidth:"wide",parsePatterns:Zct,defaultParseWidth:"any"}),day:RM({matchPatterns:Yct,defaultMatchWidth:"wide",parsePatterns:Xct,defaultParseWidth:"any"}),dayPeriod:RM({matchPatterns:Qct,defaultMatchWidth:"any",parsePatterns:Jct,defaultParseWidth:"any"})},mse={code:"en-US",formatDistance:kct,formatLong:Mct,formatRelative:Act,localize:Fct,match:edt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tdt(e){const t=ws(e);return om(t,g8e(t))+1}function axe(e){const t=ws(e),n=+ay(t)-+dct(t);return Math.round(n/nxe)+1}function oxe(e,t){var x,y,w,j;const n=ws(e),s=n.getFullYear(),i=nv(),o=(t==null?void 0:t.firstWeekContainsDate)??((y=(x=t==null?void 0:t.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??i.firstWeekContainsDate??((j=(w=i.locale)==null?void 0:w.options)==null?void 0:j.firstWeekContainsDate)??1,l=jo(e,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const a=sf(l,t),h=jo(e,0);h.setFullYear(s,0,o),h.setHours(0,0,0,0);const p=sf(h,t);return n.getTime()>=a.getTime()?s+1:n.getTime()>=p.getTime()?s:s-1}function rdt(e,t){var a,h,p,x;const n=nv(),s=(t==null?void 0:t.firstWeekContainsDate)??((h=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.firstWeekContainsDate)??1,i=oxe(e,t),o=jo(e,0);return o.setFullYear(i,0,s),o.setHours(0,0,0,0),sf(o,t)}function lxe(e,t){const n=ws(e),s=+sf(n,t)-+rdt(n,t);return Math.round(s/nxe)+1}function wo(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const s0={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return wo(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):wo(n+1,2)},d(e,t){return wo(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return wo(e.getHours()%12||12,t.length)},H(e,t){return wo(e.getHours(),t.length)},m(e,t){return wo(e.getMinutes(),t.length)},s(e,t){return wo(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),i=Math.trunc(s*Math.pow(10,n-3));return wo(i,t.length)}},r4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},eke={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),i=s>0?s:1-s;return n.ordinalNumber(i,{unit:"year"})}return s0.y(e,t)},Y:function(e,t,n,s){const i=oxe(e,s),o=i>0?i:1-i;if(t==="YY"){const l=o%100;return wo(l,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):wo(o,t.length)},R:function(e,t){const n=m8e(e);return wo(n,t.length)},u:function(e,t){const n=e.getFullYear();return wo(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return wo(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return wo(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return s0.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return wo(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const i=lxe(e,s);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):wo(i,t.length)},I:function(e,t,n){const s=axe(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):wo(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):s0.d(e,t)},D:function(e,t,n){const s=tdt(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):wo(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const i=e.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return wo(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const i=e.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return wo(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),i=s===0?7:s;switch(t){case"i":return String(i);case"ii":return wo(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let i;switch(s===12?i=r4.noon:s===0?i=r4.midnight:i=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let i;switch(s>=17?i=r4.evening:s>=12?i=r4.afternoon:s>=4?i=r4.morning:i=r4.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return s0.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):s0.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):wo(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):wo(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):s0.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):s0.s(e,t)},S:function(e,t){return s0.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return rke(s);case"XXXX":case"XX":return Nw(s);case"XXXXX":case"XXX":default:return Nw(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return rke(s);case"xxxx":case"xx":return Nw(s);case"xxxxx":case"xxx":default:return Nw(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+tke(s,":");case"OOOO":default:return"GMT"+Nw(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+tke(s,":");case"zzzz":default:return"GMT"+Nw(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return wo(s,t.length)},T:function(e,t,n){const s=e.getTime();return wo(s,t.length)}};function tke(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),i=Math.trunc(s/60),o=s%60;return o===0?n+String(i):n+String(i)+t+wo(o,2)}function rke(e,t){return e%60===0?(e>0?"-":"+")+wo(Math.abs(e)/60,2):Nw(e,t)}function Nw(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),i=wo(Math.trunc(s/60),2),o=wo(s%60,2);return n+i+t+o}const nke=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},y8e=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ndt=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return nke(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",nke(s,t)).replace("{{time}}",y8e(i,t))},whe={p:y8e,P:ndt},sdt=/^D+$/,idt=/^Y+$/,adt=["D","DD","YY","YYYY"];function v8e(e){return sdt.test(e)}function _8e(e){return idt.test(e)}function jhe(e,t,n){const s=odt(e,t,n);if(console.warn(s),adt.includes(e))throw new RangeError(s)}function odt(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ldt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,cdt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ddt=/^'([^]*?)'?$/,udt=/''/g,hdt=/[a-zA-Z]/;function fn(e,t,n){var x,y,w,j,S,C,A,E;const s=nv(),i=(n==null?void 0:n.locale)??s.locale??mse,o=(n==null?void 0:n.firstWeekContainsDate)??((y=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??s.firstWeekContainsDate??((j=(w=s.locale)==null?void 0:w.options)==null?void 0:j.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((C=(S=n==null?void 0:n.locale)==null?void 0:S.options)==null?void 0:C.weekStartsOn)??s.weekStartsOn??((E=(A=s.locale)==null?void 0:A.options)==null?void 0:E.weekStartsOn)??0,a=ws(e);if(!bhe(a))throw new RangeError("Invalid time value");let h=t.match(cdt).map(T=>{const O=T[0];if(O==="p"||O==="P"){const z=whe[O];return z(T,i.formatLong)}return T}).join("").match(ldt).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const O=T[0];if(O==="'")return{isToken:!1,value:fdt(T)};if(eke[O])return{isToken:!0,value:T};if(O.match(hdt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+O+"`");return{isToken:!1,value:T}});i.localize.preprocessor&&(h=i.localize.preprocessor(a,h));const p={firstWeekContainsDate:o,weekStartsOn:l,locale:i};return h.map(T=>{if(!T.isToken)return T.value;const O=T.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&_8e(O)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&v8e(O))&&jhe(O,t,String(e));const z=eke[O[0]];return z(a,O,i.localize,p)}).join("")}function fdt(e){const t=e.match(ddt);return t?t[1].replace(udt,"'"):e}function pdt(e,t,n){const s=nv(),i=(n==null?void 0:n.locale)??s.locale??mse,o=2520,l=lee(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:l});let h,p;l>0?(h=ws(t),p=ws(e)):(h=ws(e),p=ws(t));const x=wct(p,h),y=(z1(p)-z1(h))/1e3,w=Math.round((x-y)/60);let j;if(w<2)return n!=null&&n.includeSeconds?x<5?i.formatDistance("lessThanXSeconds",5,a):x<10?i.formatDistance("lessThanXSeconds",10,a):x<20?i.formatDistance("lessThanXSeconds",20,a):x<40?i.formatDistance("halfAMinute",0,a):x<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):w===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",w,a);if(w<45)return i.formatDistance("xMinutes",w,a);if(w<90)return i.formatDistance("aboutXHours",1,a);if(ws.getTime()}function gse(e,t){const n=ws(e),s=ws(t);return+n<+s}function bdt(e){return+ws(e)>Date.now()}function wdt(e,t){const n=t instanceof Date?jo(t,0):new t(0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}const jdt=10;class b8e{constructor(){Wn(this,"subPriority",0)}validate(t,n){return!0}}class kdt extends b8e{constructor(t,n,s,i,o){super(),this.value=t,this.validateValue=n,this.setValue=s,this.priority=i,o&&(this.subPriority=o)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,s){return this.setValue(t,n,this.value,s)}}class Ndt extends b8e{constructor(){super(...arguments);Wn(this,"priority",jdt);Wn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:jo(n,wdt(n,Date))}}class uo{run(t,n,s,i){const o=this.parse(t,n,s,i);return o?{setter:new kdt(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,s){return!0}}class Sdt extends uo{constructor(){super(...arguments);Wn(this,"priority",140);Wn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,i){switch(s){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})||i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"})}}set(n,s,i){return s.era=i,n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}const oc={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},cg={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function lc(e,t){return e&&{value:t(e.value),rest:e.rest}}function Il(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function dg(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const s=n[1]==="+"?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,l=n[5]?parseInt(n[5],10):0;return{value:s*(i*p8e+o*f8e+l*lct),rest:t.slice(n[0].length)}}function w8e(e){return Il(oc.anyDigitsSigned,e)}function Xl(e,t){switch(e){case 1:return Il(oc.singleDigit,t);case 2:return Il(oc.twoDigits,t);case 3:return Il(oc.threeDigits,t);case 4:return Il(oc.fourDigits,t);default:return Il(new RegExp("^\\d{1,"+e+"}"),t)}}function gte(e,t){switch(e){case 1:return Il(oc.singleDigitSigned,t);case 2:return Il(oc.twoDigitsSigned,t);case 3:return Il(oc.threeDigitsSigned,t);case 4:return Il(oc.fourDigitsSigned,t);default:return Il(new RegExp("^-?\\d{1,"+e+"}"),t)}}function cxe(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function j8e(e,t){const n=t>0,s=n?t:1-t;let i;if(s<=50)i=e||100;else{const o=s+50,l=Math.trunc(o/100)*100,a=e>=o%100;i=e+l-(a?100:0)}return n?i:1-i}function k8e(e){return e%400===0||e%4===0&&e%100!==0}class Cdt extends uo{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,i){const o=l=>({year:l,isTwoDigitYear:s==="yy"});switch(s){case"y":return lc(Xl(4,n),o);case"yo":return lc(i.ordinalNumber(n,{unit:"year"}),o);default:return lc(Xl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i){const o=n.getFullYear();if(i.isTwoDigitYear){const a=j8e(i.year,o);return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}const l=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(l,0,1),n.setHours(0,0,0,0),n}}class Mdt extends uo{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,i){const o=l=>({year:l,isTwoDigitYear:s==="YY"});switch(s){case"Y":return lc(Xl(4,n),o);case"Yo":return lc(i.ordinalNumber(n,{unit:"year"}),o);default:return lc(Xl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i,o){const l=oxe(n,o);if(i.isTwoDigitYear){const h=j8e(i.year,l);return n.setFullYear(h,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),sf(n,o)}const a=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(a,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),sf(n,o)}}class Tdt extends uo{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return gte(s==="R"?4:s.length,n)}set(n,s,i){const o=jo(n,0);return o.setFullYear(i,0,4),o.setHours(0,0,0,0),ay(o)}}class Adt extends uo{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return gte(s==="u"?4:s.length,n)}set(n,s,i){return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class Edt extends uo{constructor(){super(...arguments);Wn(this,"priority",120);Wn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"Q":case"QQ":return Xl(s.length,n);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})||i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class Idt extends uo{constructor(){super(...arguments);Wn(this,"priority",120);Wn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"q":case"qq":return Xl(s.length,n);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})||i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class Pdt extends uo{constructor(){super(...arguments);Wn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Wn(this,"priority",110)}parse(n,s,i){const o=l=>l-1;switch(s){case"M":return lc(Il(oc.month,n),o);case"MM":return lc(Xl(2,n),o);case"Mo":return lc(i.ordinalNumber(n,{unit:"month"}),o);case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})||i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}class Ldt extends uo{constructor(){super(...arguments);Wn(this,"priority",110);Wn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,i){const o=l=>l-1;switch(s){case"L":return lc(Il(oc.month,n),o);case"LL":return lc(Xl(2,n),o);case"Lo":return lc(i.ordinalNumber(n,{unit:"month"}),o);case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})||i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}function Odt(e,t,n){const s=ws(e),i=lxe(s,n)-t;return s.setDate(s.getDate()-i*7),s}class Ddt extends uo{constructor(){super(...arguments);Wn(this,"priority",100);Wn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,i){switch(s){case"w":return Il(oc.week,n);case"wo":return i.ordinalNumber(n,{unit:"week"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i,o){return sf(Odt(n,i,o),o)}}function Rdt(e,t){const n=ws(e),s=axe(n)-t;return n.setDate(n.getDate()-s*7),n}class Fdt extends uo{constructor(){super(...arguments);Wn(this,"priority",100);Wn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,i){switch(s){case"I":return Il(oc.week,n);case"Io":return i.ordinalNumber(n,{unit:"week"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i){return ay(Rdt(n,i))}}const zdt=[31,28,31,30,31,30,31,31,30,31,30,31],Bdt=[31,29,31,30,31,30,31,31,30,31,30,31];class $dt extends uo{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"subPriority",1);Wn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"d":return Il(oc.date,n);case"do":return i.ordinalNumber(n,{unit:"date"});default:return Xl(s.length,n)}}validate(n,s){const i=n.getFullYear(),o=k8e(i),l=n.getMonth();return o?s>=1&&s<=Bdt[l]:s>=1&&s<=zdt[l]}set(n,s,i){return n.setDate(i),n.setHours(0,0,0,0),n}}class Udt extends uo{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"subpriority",1);Wn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,i){switch(s){case"D":case"DD":return Il(oc.dayOfYear,n);case"Do":return i.ordinalNumber(n,{unit:"date"});default:return Xl(s.length,n)}}validate(n,s){const i=n.getFullYear();return k8e(i)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,i){return n.setMonth(0,i),n.setHours(0,0,0,0),n}}function dxe(e,t,n){var y,w,j,S;const s=nv(),i=(n==null?void 0:n.weekStartsOn)??((w=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:w.weekStartsOn)??s.weekStartsOn??((S=(j=s.locale)==null?void 0:j.options)==null?void 0:S.weekStartsOn)??0,o=ws(e),l=o.getDay(),h=(t%7+7)%7,p=7-i,x=t<0||t>6?t-(l+p)%7:(h+p)%7-(l+p)%7;return Vl(o,x)}class qdt extends uo{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=dxe(n,i,o),n.setHours(0,0,0,0),n}}class Vdt extends uo{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,i,o){const l=a=>{const h=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+h};switch(s){case"e":case"ee":return lc(Xl(s.length,n),l);case"eo":return lc(i.ordinalNumber(n,{unit:"day"}),l);case"eee":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeeee":return i.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=dxe(n,i,o),n.setHours(0,0,0,0),n}}class Hdt extends uo{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,i,o){const l=a=>{const h=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+h};switch(s){case"c":case"cc":return lc(Xl(s.length,n),l);case"co":return lc(i.ordinalNumber(n,{unit:"day"}),l);case"ccc":return i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"ccccc":return i.day(n,{width:"narrow",context:"standalone"});case"cccccc":return i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(n,{width:"wide",context:"standalone"})||i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=dxe(n,i,o),n.setHours(0,0,0,0),n}}function Wdt(e,t){const n=ws(e),s=xdt(n),i=t-s;return Vl(n,i)}class Gdt extends uo{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,i){const o=l=>l===0?7:l;switch(s){case"i":case"ii":return Xl(s.length,n);case"io":return i.ordinalNumber(n,{unit:"day"});case"iii":return lc(i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return lc(i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return lc(i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return lc(i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,i){return n=Wdt(n,i),n.setHours(0,0,0,0),n}}class Kdt extends uo{constructor(){super(...arguments);Wn(this,"priority",80);Wn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,i){switch(s){case"a":case"aa":case"aaa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(cxe(i),0,0,0),n}}class Zdt extends uo{constructor(){super(...arguments);Wn(this,"priority",80);Wn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,i){switch(s){case"b":case"bb":case"bbb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(cxe(i),0,0,0),n}}class Ydt extends uo{constructor(){super(...arguments);Wn(this,"priority",80);Wn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,i){switch(s){case"B":case"BB":case"BBB":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(cxe(i),0,0,0),n}}class Xdt extends uo{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,i){switch(s){case"h":return Il(oc.hour12h,n);case"ho":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,i){const o=n.getHours()>=12;return o&&i<12?n.setHours(i+12,0,0,0):!o&&i===12?n.setHours(0,0,0,0):n.setHours(i,0,0,0),n}}class Qdt extends uo{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,i){switch(s){case"H":return Il(oc.hour23h,n);case"Ho":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,i){return n.setHours(i,0,0,0),n}}class Jdt extends uo{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,i){switch(s){case"K":return Il(oc.hour11h,n);case"Ko":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.getHours()>=12&&i<12?n.setHours(i+12,0,0,0):n.setHours(i,0,0,0),n}}class eut extends uo{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,i){switch(s){case"k":return Il(oc.hour24h,n);case"ko":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,i){const o=i<=24?i%24:i;return n.setHours(o,0,0,0),n}}class tut extends uo{constructor(){super(...arguments);Wn(this,"priority",60);Wn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"m":return Il(oc.minute,n);case"mo":return i.ordinalNumber(n,{unit:"minute"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setMinutes(i,0,0),n}}class rut extends uo{constructor(){super(...arguments);Wn(this,"priority",50);Wn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"s":return Il(oc.second,n);case"so":return i.ordinalNumber(n,{unit:"second"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setSeconds(i,0),n}}class nut extends uo{constructor(){super(...arguments);Wn(this,"priority",30);Wn(this,"incompatibleTokens",["t","T"])}parse(n,s){const i=o=>Math.trunc(o*Math.pow(10,-s.length+3));return lc(Xl(s.length,n),i)}set(n,s,i){return n.setMilliseconds(i),n}}class sut extends uo{constructor(){super(...arguments);Wn(this,"priority",10);Wn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return dg(cg.basicOptionalMinutes,n);case"XX":return dg(cg.basic,n);case"XXXX":return dg(cg.basicOptionalSeconds,n);case"XXXXX":return dg(cg.extendedOptionalSeconds,n);case"XXX":default:return dg(cg.extended,n)}}set(n,s,i){return s.timestampIsSet?n:jo(n,n.getTime()-z1(n)-i)}}class iut extends uo{constructor(){super(...arguments);Wn(this,"priority",10);Wn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return dg(cg.basicOptionalMinutes,n);case"xx":return dg(cg.basic,n);case"xxxx":return dg(cg.basicOptionalSeconds,n);case"xxxxx":return dg(cg.extendedOptionalSeconds,n);case"xxx":default:return dg(cg.extended,n)}}set(n,s,i){return s.timestampIsSet?n:jo(n,n.getTime()-z1(n)-i)}}class aut extends uo{constructor(){super(...arguments);Wn(this,"priority",40);Wn(this,"incompatibleTokens","*")}parse(n){return w8e(n)}set(n,s,i){return[jo(n,i*1e3),{timestampIsSet:!0}]}}class out extends uo{constructor(){super(...arguments);Wn(this,"priority",20);Wn(this,"incompatibleTokens","*")}parse(n){return w8e(n)}set(n,s,i){return[jo(n,i),{timestampIsSet:!0}]}}const lut={G:new Sdt,y:new Cdt,Y:new Mdt,R:new Tdt,u:new Adt,Q:new Edt,q:new Idt,M:new Pdt,L:new Ldt,w:new Ddt,I:new Fdt,d:new $dt,D:new Udt,E:new qdt,e:new Vdt,c:new Hdt,i:new Gdt,a:new Kdt,b:new Zdt,B:new Ydt,h:new Xdt,H:new Qdt,K:new Jdt,k:new eut,m:new tut,s:new rut,S:new nut,X:new sut,x:new iut,t:new aut,T:new out},cut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,dut=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,uut=/^'([^]*?)'?$/,hut=/''/g,fut=/\S/,put=/[a-zA-Z]/;function uxe(e,t,n,s){var C,A,E,T;const i=gdt(),o=i.locale??mse,l=i.firstWeekContainsDate??((A=(C=i.locale)==null?void 0:C.options)==null?void 0:A.firstWeekContainsDate)??1,a=i.weekStartsOn??((T=(E=i.locale)==null?void 0:E.options)==null?void 0:T.weekStartsOn)??0;if(t==="")return e===""?ws(n):jo(n,NaN);const h={firstWeekContainsDate:l,weekStartsOn:a,locale:o},p=[new Ndt],x=t.match(dut).map(O=>{const z=O[0];if(z in whe){const F=whe[z];return F(O,o.formatLong)}return O}).join("").match(cut),y=[];for(let O of x){_8e(O)&&jhe(O,t,e),v8e(O)&&jhe(O,t,e);const z=O[0],F=lut[z];if(F){const{incompatibleTokens:q}=F;if(Array.isArray(q)){const K=y.find(Z=>q.includes(Z.token)||Z.token===z);if(K)throw new RangeError(`The format string mustn't contain \`${K.fullToken}\` and \`${O}\` at the same time`)}else if(F.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${O}\` and any other token at the same time`);y.push({token:z,fullToken:O});const H=F.run(e,O,o.match,h);if(!H)return jo(n,NaN);p.push(H.setter),e=H.rest}else{if(z.match(put))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");if(O==="''"?O="'":z==="'"&&(O=mut(O)),e.indexOf(O)===0)e=e.slice(O.length);else return jo(n,NaN)}}if(e.length>0&&fut.test(e))return jo(n,NaN);const w=p.map(O=>O.priority).sort((O,z)=>z-O).filter((O,z,F)=>F.indexOf(O)===z).map(O=>p.filter(z=>z.priority===O).sort((z,F)=>F.subPriority-z.subPriority)).map(O=>O[0]);let j=ws(n);if(isNaN(j.getTime()))return jo(n,NaN);const S={};for(const O of w){if(!O.validate(j,h))return jo(n,NaN);const z=O.set(j,S,h);Array.isArray(z)?(j=z[0],Object.assign(S,z[1])):j=z}return jo(n,j)}function mut(e){return e.match(uut)[1].replace(hut,"'")}function gut(e){return+ws(e)o-l);return n>=s&&n<=i}function Kle(e,t){return Vl(e,-t)}function Zle(e,t){const n=ws(e),s=n.getFullYear(),i=n.getDate(),o=jo(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=mdt(o);return n.setMonth(t,Math.min(i,l)),n}function N8e(e,t){const n=ws(e);return n.setHours(t),n}function S8e(e,t){const n=ws(e);return n.setMinutes(t),n}function ake(e,t){const n=ws(e);return isNaN(+n)?jo(e,NaN):(n.setFullYear(t),n)}function yut(e,t){return tp(e,-12)}const vut=()=>{const{user:e}=zr(),t=ns(),[n,s]=P.useState([]),[i,o]=P.useState(0),[l,a]=P.useState(!1),[h,p]=P.useState(null);P.useEffect(()=>{if(!e)return;const S=`notification_last_read_${e.id}`;let C=h;if(!C){const T=localStorage.getItem(S);T&&(C=T,p(T))}(async()=>{const{data:T,error:O}=await ee.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!O&&T){s(T);const z=C?new Date(C):null,F=T.filter(q=>z?new Date(q.created_at)>z:!0);o(F.length)}})();const E=ee.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},T=>{const O=T.new;s(F=>[O,...F].slice(0,20));const z=C?new Date(C):null;(!z||new Date(O.created_at)>z)&&o(F=>F+1),Notification.permission==="granted"&&new Notification(O.title,{body:O.body,icon:"/favicon.ico"})}).subscribe();return()=>{ee.removeChannel(E)}},[e,h]);const x=S=>{const C=S.toLowerCase();return C.includes("community")||C.includes("post")?Po:C.includes("academy")||C.includes("video")?Fi:C.includes("template")?Ld:C.includes("event")?Ys:C.includes("newsletter")?Vx:C.includes("brokerage")?gh:C.includes("swag")||C.includes("social")?Va:C.includes("toolbox")||C.includes("tool")?Gx:C.includes("brief")?Ss:Po},y=S=>{a(!1),S.url&&S.url!=="/"&&t(S.url)},w=()=>{if(!e)return;const S=new Date().toISOString(),C=`notification_last_read_${e.id}`;localStorage.setItem(C,S),p(S),o(0)},j=S=>{a(S),S&&i>0&&w()};return r.jsxs(Sm,{open:l,onOpenChange:j,children:[r.jsx(Cm,{asChild:!0,children:r.jsxs(J,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(vg,{className:"h-5 w-5"}),i>0&&r.jsx(Ft,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:i>9?"9+":i})]})}),r.jsxs(ap,{align:"end",className:"w-80",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[r.jsx("span",{className:"font-semibold",children:"Notifications"}),n.length>0&&r.jsx(J,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:w,children:"Mark all read"})]}),r.jsx(Jo,{className:"h-[300px]",children:n.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):n.map(S=>{const C=x(S.title);return r.jsxs(po,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>y(S),children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx(C,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"font-medium text-sm",children:S.title}),r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:S.body}),r.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:tu(new Date(S.created_at),{addSuffix:!0})})]})]},S.id)})})]})]})};var oke=1,_ut=.9,but=.8,wut=.17,Yle=.1,Xle=.999,jut=.9999,kut=.99,Nut=/[\\\/_+.#"@\[\(\{&]/,Sut=/[\\\/_+.#"@\[\(\{&]/g,Cut=/[\s-]/,C8e=/[\s-]/g;function khe(e,t,n,s,i,o,l){if(o===t.length)return i===e.length?oke:kut;var a=`${i},${o}`;if(l[a]!==void 0)return l[a];for(var h=s.charAt(o),p=n.indexOf(h,i),x=0,y,w,j,S;p>=0;)y=khe(e,t,n,s,p+1,o+1,l),y>x&&(p===i?y*=oke:Nut.test(e.charAt(p-1))?(y*=but,j=e.slice(i,p-1).match(Sut),j&&i>0&&(y*=Math.pow(Xle,j.length))):Cut.test(e.charAt(p-1))?(y*=_ut,S=e.slice(i,p-1).match(C8e),S&&i>0&&(y*=Math.pow(Xle,S.length))):(y*=wut,i>0&&(y*=Math.pow(Xle,p-i))),e.charAt(p)!==t.charAt(o)&&(y*=jut)),(yy&&(y=w*Yle)),y>x&&(x=y),p=n.indexOf(h,p+1);return l[a]=x,x}function lke(e){return e.toLowerCase().replace(C8e," ")}function Mut(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,khe(e,t,lke(e),lke(t),0,0,{})}var FM='[cmdk-group=""]',Qle='[cmdk-group-items=""]',Tut='[cmdk-group-heading=""]',M8e='[cmdk-item=""]',cke=`${M8e}:not([aria-disabled="true"])`,Nhe="cmdk-item-select",x4="data-value",Aut=(e,t,n)=>Mut(e,t,n),T8e=P.createContext(void 0),NI=()=>P.useContext(T8e),A8e=P.createContext(void 0),fxe=()=>P.useContext(A8e),E8e=P.createContext(void 0),I8e=P.forwardRef((e,t)=>{let n=y4(()=>{var pe,ae;return{search:"",value:(ae=(pe=e.value)!=null?pe:e.defaultValue)!=null?ae:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=y4(()=>new Set),i=y4(()=>new Map),o=y4(()=>new Map),l=y4(()=>new Set),a=P8e(e),{label:h,children:p,value:x,onValueChange:y,filter:w,shouldFilter:j,loop:S,disablePointerSelection:C=!1,vimBindings:A=!0,...E}=e,T=Vc(),O=Vc(),z=Vc(),F=P.useRef(null),q=$ut();zj(()=>{if(x!==void 0){let pe=x.trim();n.current.value=pe,H.emit()}},[x]),zj(()=>{q(6,be)},[]);let H=P.useMemo(()=>({subscribe:pe=>(l.current.add(pe),()=>l.current.delete(pe)),snapshot:()=>n.current,setState:(pe,ae,ge)=>{var Me,Ue,Ie,Ke;if(!Object.is(n.current[pe],ae)){if(n.current[pe]=ae,pe==="search")he(),re(),q(1,ue);else if(pe==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Re=document.getElementById(z);Re?Re.focus():(Me=document.getElementById(T))==null||Me.focus()}if(q(7,()=>{var Re;n.current.selectedItemId=(Re=ne())==null?void 0:Re.id,H.emit()}),ge||q(5,be),((Ue=a.current)==null?void 0:Ue.value)!==void 0){let Re=ae??"";(Ke=(Ie=a.current).onValueChange)==null||Ke.call(Ie,Re);return}}H.emit()}},emit:()=>{l.current.forEach(pe=>pe())}}),[]),K=P.useMemo(()=>({value:(pe,ae,ge)=>{var Me;ae!==((Me=o.current.get(pe))==null?void 0:Me.value)&&(o.current.set(pe,{value:ae,keywords:ge}),n.current.filtered.items.set(pe,Z(ae,ge)),q(2,()=>{re(),H.emit()}))},item:(pe,ae)=>(s.current.add(pe),ae&&(i.current.has(ae)?i.current.get(ae).add(pe):i.current.set(ae,new Set([pe]))),q(3,()=>{he(),re(),n.current.value||ue(),H.emit()}),()=>{o.current.delete(pe),s.current.delete(pe),n.current.filtered.items.delete(pe);let ge=ne();q(4,()=>{he(),(ge==null?void 0:ge.getAttribute("id"))===pe&&ue(),H.emit()})}),group:pe=>(i.current.has(pe)||i.current.set(pe,new Set),()=>{o.current.delete(pe),i.current.delete(pe)}),filter:()=>a.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:T,inputId:z,labelId:O,listInnerRef:F}),[]);function Z(pe,ae){var ge,Me;let Ue=(Me=(ge=a.current)==null?void 0:ge.filter)!=null?Me:Aut;return pe?Ue(pe,n.current.search,ae):0}function re(){if(!n.current.search||a.current.shouldFilter===!1)return;let pe=n.current.filtered.items,ae=[];n.current.filtered.groups.forEach(Me=>{let Ue=i.current.get(Me),Ie=0;Ue.forEach(Ke=>{let Re=pe.get(Ke);Ie=Math.max(Re,Ie)}),ae.push([Me,Ie])});let ge=F.current;ye().sort((Me,Ue)=>{var Ie,Ke;let Re=Me.getAttribute("id"),Ce=Ue.getAttribute("id");return((Ie=pe.get(Ce))!=null?Ie:0)-((Ke=pe.get(Re))!=null?Ke:0)}).forEach(Me=>{let Ue=Me.closest(Qle);Ue?Ue.appendChild(Me.parentElement===Ue?Me:Me.closest(`${Qle} > *`)):ge.appendChild(Me.parentElement===ge?Me:Me.closest(`${Qle} > *`))}),ae.sort((Me,Ue)=>Ue[1]-Me[1]).forEach(Me=>{var Ue;let Ie=(Ue=F.current)==null?void 0:Ue.querySelector(`${FM}[${x4}="${encodeURIComponent(Me[0])}"]`);Ie==null||Ie.parentElement.appendChild(Ie)})}function ue(){let pe=ye().find(ge=>ge.getAttribute("aria-disabled")!=="true"),ae=pe==null?void 0:pe.getAttribute(x4);H.setState("value",ae||void 0)}function he(){var pe,ae,ge,Me;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Ue=0;for(let Ie of s.current){let Ke=(ae=(pe=o.current.get(Ie))==null?void 0:pe.value)!=null?ae:"",Re=(Me=(ge=o.current.get(Ie))==null?void 0:ge.keywords)!=null?Me:[],Ce=Z(Ke,Re);n.current.filtered.items.set(Ie,Ce),Ce>0&&Ue++}for(let[Ie,Ke]of i.current)for(let Re of Ke)if(n.current.filtered.items.get(Re)>0){n.current.filtered.groups.add(Ie);break}n.current.filtered.count=Ue}function be(){var pe,ae,ge;let Me=ne();Me&&(((pe=Me.parentElement)==null?void 0:pe.firstChild)===Me&&((ge=(ae=Me.closest(FM))==null?void 0:ae.querySelector(Tut))==null||ge.scrollIntoView({block:"nearest"})),Me.scrollIntoView({block:"nearest"}))}function ne(){var pe;return(pe=F.current)==null?void 0:pe.querySelector(`${M8e}[aria-selected="true"]`)}function ye(){var pe;return Array.from(((pe=F.current)==null?void 0:pe.querySelectorAll(cke))||[])}function ie(pe){let ae=ye()[pe];ae&&H.setState("value",ae.getAttribute(x4))}function fe(pe){var ae;let ge=ne(),Me=ye(),Ue=Me.findIndex(Ke=>Ke===ge),Ie=Me[Ue+pe];(ae=a.current)!=null&&ae.loop&&(Ie=Ue+pe<0?Me[Me.length-1]:Ue+pe===Me.length?Me[0]:Me[Ue+pe]),Ie&&H.setState("value",Ie.getAttribute(x4))}function de(pe){let ae=ne(),ge=ae==null?void 0:ae.closest(FM),Me;for(;ge&&!Me;)ge=pe>0?zut(ge,FM):But(ge,FM),Me=ge==null?void 0:ge.querySelector(cke);Me?H.setState("value",Me.getAttribute(x4)):fe(pe)}let _e=()=>ie(ye().length-1),Ee=pe=>{pe.preventDefault(),pe.metaKey?_e():pe.altKey?de(1):fe(1)},ke=pe=>{pe.preventDefault(),pe.metaKey?ie(0):pe.altKey?de(-1):fe(-1)};return P.createElement(Rn.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:pe=>{var ae;(ae=E.onKeyDown)==null||ae.call(E,pe);let ge=pe.nativeEvent.isComposing||pe.keyCode===229;if(!(pe.defaultPrevented||ge))switch(pe.key){case"n":case"j":{A&&pe.ctrlKey&&Ee(pe);break}case"ArrowDown":{Ee(pe);break}case"p":case"k":{A&&pe.ctrlKey&&ke(pe);break}case"ArrowUp":{ke(pe);break}case"Home":{pe.preventDefault(),ie(0);break}case"End":{pe.preventDefault(),_e();break}case"Enter":{pe.preventDefault();let Me=ne();if(Me){let Ue=new Event(Nhe);Me.dispatchEvent(Ue)}}}}},P.createElement("label",{"cmdk-label":"",htmlFor:K.inputId,id:K.labelId,style:qut},h),xse(e,pe=>P.createElement(A8e.Provider,{value:H},P.createElement(T8e.Provider,{value:K},pe))))}),Eut=P.forwardRef((e,t)=>{var n,s;let i=Vc(),o=P.useRef(null),l=P.useContext(E8e),a=NI(),h=P8e(e),p=(s=(n=h.current)==null?void 0:n.forceMount)!=null?s:l==null?void 0:l.forceMount;zj(()=>{if(!p)return a.item(i,l==null?void 0:l.id)},[p]);let x=L8e(i,o,[e.value,e.children,o],e.keywords),y=fxe(),w=B1(q=>q.value&&q.value===x.current),j=B1(q=>p||a.filter()===!1?!0:q.search?q.filtered.items.get(i)>0:!0);P.useEffect(()=>{let q=o.current;if(!(!q||e.disabled))return q.addEventListener(Nhe,S),()=>q.removeEventListener(Nhe,S)},[j,e.onSelect,e.disabled]);function S(){var q,H;C(),(H=(q=h.current).onSelect)==null||H.call(q,x.current)}function C(){y.setState("value",x.current,!0)}if(!j)return null;let{disabled:A,value:E,onSelect:T,forceMount:O,keywords:z,...F}=e;return P.createElement(Rn.div,{ref:ny(o,t),...F,id:i,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!w,"data-disabled":!!A,"data-selected":!!w,onPointerMove:A||a.getDisablePointerSelection()?void 0:C,onClick:A?void 0:S},e.children)}),Iut=P.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:i,...o}=e,l=Vc(),a=P.useRef(null),h=P.useRef(null),p=Vc(),x=NI(),y=B1(j=>i||x.filter()===!1?!0:j.search?j.filtered.groups.has(l):!0);zj(()=>x.group(l),[]),L8e(l,a,[e.value,e.heading,h]);let w=P.useMemo(()=>({id:l,forceMount:i}),[i]);return P.createElement(Rn.div,{ref:ny(a,t),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&P.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:p},n),xse(e,j=>P.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?p:void 0},P.createElement(E8e.Provider,{value:w},j))))}),Put=P.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,i=P.useRef(null),o=B1(l=>!l.search);return!n&&!o?null:P.createElement(Rn.div,{ref:ny(i,t),...s,"cmdk-separator":"",role:"separator"})}),Lut=P.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,i=e.value!=null,o=fxe(),l=B1(p=>p.search),a=B1(p=>p.selectedItemId),h=NI();return P.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),P.createElement(Rn.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":a,id:h.inputId,type:"text",value:i?e.value:l,onChange:p=>{i||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),Out=P.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...i}=e,o=P.useRef(null),l=P.useRef(null),a=B1(p=>p.selectedItemId),h=NI();return P.useEffect(()=>{if(l.current&&o.current){let p=l.current,x=o.current,y,w=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let j=p.offsetHeight;x.style.setProperty("--cmdk-list-height",j.toFixed(1)+"px")})});return w.observe(p),()=>{cancelAnimationFrame(y),w.unobserve(p)}}},[]),P.createElement(Rn.div,{ref:ny(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":s,id:h.listId},xse(e,p=>P.createElement("div",{ref:ny(l,h.listInnerRef),"cmdk-list-sizer":""},p)))}),Dut=P.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:i,contentClassName:o,container:l,...a}=e;return P.createElement(Vne,{open:n,onOpenChange:s},P.createElement(Hne,{container:l},P.createElement(o3,{"cmdk-overlay":"",className:i}),P.createElement(l3,{"aria-label":e.label,"cmdk-dialog":"",className:o},P.createElement(I8e,{ref:t,...a}))))}),Rut=P.forwardRef((e,t)=>B1(n=>n.filtered.count===0)?P.createElement(Rn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Fut=P.forwardRef((e,t)=>{let{progress:n,children:s,label:i="Loading...",...o}=e;return P.createElement(Rn.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},xse(e,l=>P.createElement("div",{"aria-hidden":!0},l)))}),wh=Object.assign(I8e,{List:Out,Item:Eut,Input:Lut,Group:Iut,Separator:Put,Dialog:Dut,Empty:Rut,Loading:Fut});function zut(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function But(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function P8e(e){let t=P.useRef(e);return zj(()=>{t.current=e}),t}var zj=typeof window>"u"?P.useEffect:P.useLayoutEffect;function y4(e){let t=P.useRef();return t.current===void 0&&(t.current=e()),t}function B1(e){let t=fxe(),n=()=>e(t.snapshot());return P.useSyncExternalStore(t.subscribe,n,n)}function L8e(e,t,n,s=[]){let i=P.useRef(),o=NI();return zj(()=>{var l;let a=(()=>{var p;for(let x of n){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(p=x.current.textContent)==null?void 0:p.trim():i.current}})(),h=s.map(p=>p.trim());o.value(e,a,h),(l=t.current)==null||l.setAttribute(x4,a),i.current=a}),i}var $ut=()=>{let[e,t]=P.useState(),n=y4(()=>new Map);return zj(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,i)=>{n.current.set(s,i),t({})}};function Uut(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function xse({asChild:e,children:t},n){return e&&P.isValidElement(t)?P.cloneElement(Uut(t),{ref:t.ref},n(t.props.children)):n(t)}var qut={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const $1=P.forwardRef(({className:e,...t},n)=>r.jsx(wh,{ref:n,className:$t("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));$1.displayName=wh.displayName;const Vut=({children:e,...t})=>r.jsx(Br,{...t,children:r.jsx(Fr,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx($1,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),U1=P.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(Mi,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(wh.Input,{ref:n,className:$t("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));U1.displayName=wh.Input.displayName;const q1=P.forwardRef(({className:e,...t},n)=>r.jsx(wh.List,{ref:n,className:$t("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));q1.displayName=wh.List.displayName;const V1=P.forwardRef((e,t)=>r.jsx(wh.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));V1.displayName=wh.Empty.displayName;const H1=P.forwardRef(({className:e,...t},n)=>r.jsx(wh.Group,{ref:n,className:$t("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));H1.displayName=wh.Group.displayName;const Hut=P.forwardRef(({className:e,...t},n)=>r.jsx(wh.Separator,{ref:n,className:$t("-mx-1 h-px bg-border",e),...t}));Hut.displayName=wh.Separator.displayName;const W1=P.forwardRef(({className:e,...t},n)=>r.jsx(wh.Item,{ref:n,className:$t("group relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-primary/80 data-[selected=true]:text-primary-foreground data-[disabled=true]:opacity-50",e),...t}));W1.displayName=wh.Item.displayName;const Wut={event:{label:"Events",icon:um,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Ld,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:h1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:Gx,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Ss,color:"bg-fuchsia-500/10 text-fuchsia-600"}},dke=()=>{const[e,t]=P.useState(!1),[n,s]=P.useState(""),[i,o]=P.useState([]),[l,a]=P.useState(!1),h=ns();P.useEffect(()=>{const w=j=>{j.key==="k"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),t(S=>!S))};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[]);const p=P.useCallback(async w=>{if(!w.trim()){o([]);return}a(!0);const j=`%${w}%`;try{const[S,C,A,E,T]=await Promise.all([ee.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),ee.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${j},description.ilike.${j}`).limit(5),ee.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),ee.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${j},description.ilike.${j}`).limit(5),ee.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5)]),O=[];S.data&&S.data.forEach(z=>{O.push({id:z.id,title:z.title,description:z.description,type:"event",date:z.event_date,path:`/event/${z.id}`})}),C.data&&C.data.forEach(z=>{O.push({id:z.id,title:z.name,description:z.description,type:"template",date:z.publish_date,path:`/templates/${z.id}`})}),A.data&&A.data.forEach(z=>{O.push({id:z.id,title:z.title,description:z.description,type:"academy",date:z.publish_date,path:`/academy/${z.id}`})}),E.data&&E.data.forEach(z=>{O.push({id:z.id,title:z.name,description:z.description,type:"toolbox",date:z.publish_date,path:`/toolbox/${z.id}`})}),T.data&&T.data.forEach(z=>{O.push({id:z.id,title:z.title,description:z.description,type:"social-swag",date:z.publish_date,path:`/social-swag/${z.id}`})}),o(O)}catch(S){console.error("Search error:",S)}finally{a(!1)}},[]);P.useEffect(()=>{const w=setTimeout(()=>{p(n)},300);return()=>clearTimeout(w)},[n,p]);const x=w=>{t(!1),s(""),h(w)},y=i.reduce((w,j)=>(w[j.type]||(w[j.type]=[]),w[j.type].push(j),w),{});return r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-9 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>t(!0),children:[r.jsx(Mi,{className:"h-4 w-4 xl:mr-2"}),r.jsx("span",{className:"hidden xl:inline-flex text-muted-foreground text-sm",children:"Search..."}),r.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-1.5 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsxs(Vut,{open:e,onOpenChange:t,children:[r.jsx(U1,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(q1,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&i.length===0&&r.jsxs(V1,{children:['No results found for "',n,'"']}),!l&&!n&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search across all content..."}),Object.entries(y).map(([w,j])=>{const S=Wut[w],C=S.icon;return r.jsx(H1,{heading:S.label,children:j.map(A=>r.jsxs(W1,{value:`${A.type}-${A.id}-${A.title}`,onSelect:()=>x(A.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[r.jsx("div",{className:`p-2 rounded-md ${S.color}`,children:r.jsx(C,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:A.title}),A.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:A.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Ft,{variant:"secondary",className:"text-xs",children:S.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:tu(new Date(A.date),{addSuffix:!0})})]})]},`${A.type}-${A.id}`))},w)})]})]})]})},Gut=({expiresAt:e,className:t,showUpgradeButton:n=!0})=>{const[s,i]=P.useState(null),o=ns();if(P.useEffect(()=>{const p=()=>{const y=new Date().getTime(),j=new Date(e).getTime()-y;if(j<=0){i({days:0,hours:0,minutes:0});return}const S=Math.floor(j/(1e3*60*60*24)),C=Math.floor(j%(1e3*60*60*24)/(1e3*60*60)),A=Math.floor(j%(1e3*60*60)/(1e3*60));i({days:S,hours:C,minutes:A})};p();const x=setInterval(p,6e4);return()=>clearInterval(x)},[e]),!s)return null;const l=s.days===0&&s.hours===0&&s.minutes===0,a=s.days<=1,h=s.days<=3&&!a;return l?r.jsxs("div",{className:$t("flex items-center justify-between gap-3 px-4 py-2 rounded-lg bg-destructive/10 border border-destructive/20",t),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zh,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),n&&r.jsxs(J,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):r.jsxs("div",{className:$t("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",a?"bg-destructive/10 border-destructive/20":h?"bg-amber-500/10 border-amber-500/20":"bg-primary/10 border-primary/20",t),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ki,{className:$t("h-4 w-4",a?"text-destructive":h?"text-amber-500":"text-primary")}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:$t("text-sm font-medium",a?"text-destructive":h?"text-amber-600":"text-primary"),children:"Free Trial:"}),r.jsxs("div",{className:"flex items-center gap-1",children:[s.days>0&&r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:$t("text-xs",a?"text-destructive/70":h?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(J,{size:"sm",onClick:()=>o("/subscription"),variant:a?"destructive":h?"default":"outline",className:$t("text-xs h-7 px-3",h&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Kut=()=>{const e=ns();return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:r.jsxs(We,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-destructive/10 flex items-center justify-center",children:r.jsx(zh,{className:"h-8 w-8 text-destructive"})}),r.jsx(Xt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(En,{className:"text-base",children:"Your 7-day free trial has expired. Upgrade now to continue accessing all the powerful tools and resources LevelUp has to offer!"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(We,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(Xe,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Kn,{className:"h-6 w-6 text-primary"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Individual Agent"}),r.jsxs("p",{className:"text-2xl font-bold text-primary mb-2",children:["$39",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Perfect for solo agents ready to level up"}),r.jsxs(J,{className:"w-full",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(We,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(Xe,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-6 w-6 text-amber-600"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Brokerage"}),r.jsxs("p",{className:"text-2xl font-bold text-amber-600 mb-2",children:["$299",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"For teams and brokerages"}),r.jsxs(J,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(na,{className:"h-4 w-4 mr-2"}),"Choose Brokerage"]})]})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"With a full membership, you'll get:"}),r.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground grid sm:grid-cols-2 gap-x-4",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Unlimited access to all marketing templates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Complete Academy training library"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," AI-powered tools and resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Community forums and support"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Exclusive member events and workshops"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Deal pipeline & scorecard tracking"]})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[r.jsx("p",{className:"text-sm font-medium text-center",children:"Questions? Contact us:"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Zs,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Zut=({hasUnseenBrief:e,onClick:t,className:n})=>r.jsxs(Ng,{children:[r.jsx(Sg,{asChild:!0,children:r.jsxs(J,{variant:"ghost",size:"icon",onClick:t,className:$t("relative transition-colors",e&&"text-primary hover:text-primary",n),children:[r.jsx(mm,{className:"h-5 w-5"}),e&&r.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-primary animate-pulse"})]})}),r.jsx(ym,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var yse="Checkbox",[Yut]=Ql(yse),[Xut,pxe]=Yut(yse);function Qut(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:i,disabled:o,form:l,name:a,onCheckedChange:h,required:p,value:x="on",internal_do_not_use_render:y}=e,[w,j]=Lu({prop:n,defaultProp:i??!1,onChange:h,caller:yse}),[S,C]=P.useState(null),[A,E]=P.useState(null),T=P.useRef(!1),O=S?!!l||!!S.closest("form"):!0,z={checked:w,disabled:o,setChecked:j,control:S,setControl:C,name:a,form:l,value:x,hasConsumerStoppedPropagationRef:T,required:p,defaultChecked:k1(i)?!1:i,isFormControl:O,bubbleInput:A,setBubbleInput:E};return r.jsx(Xut,{scope:t,...z,children:Jut(y)?y(z):s})}var O8e="CheckboxTrigger",D8e=P.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},i)=>{const{control:o,value:l,disabled:a,checked:h,required:p,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:w,isFormControl:j,bubbleInput:S}=pxe(O8e,e),C=ei(i,x),A=P.useRef(h);return P.useEffect(()=>{const E=o==null?void 0:o.form;if(E){const T=()=>y(A.current);return E.addEventListener("reset",T),()=>E.removeEventListener("reset",T)}},[o,y]),r.jsx(Rn.button,{type:"button",role:"checkbox","aria-checked":k1(h)?"mixed":h,"aria-required":p,"data-state":$8e(h),"data-disabled":a?"":void 0,disabled:a,value:l,...s,ref:C,onKeyDown:cn(t,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:cn(n,E=>{y(T=>k1(T)?!0:!T),S&&j&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})})});D8e.displayName=O8e;var mxe=P.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:i,defaultChecked:o,required:l,disabled:a,value:h,onCheckedChange:p,form:x,...y}=e;return r.jsx(Qut,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:l,onCheckedChange:p,name:s,form:x,value:h,internal_do_not_use_render:({isFormControl:w})=>r.jsxs(r.Fragment,{children:[r.jsx(D8e,{...y,ref:t,__scopeCheckbox:n}),w&&r.jsx(B8e,{__scopeCheckbox:n})]})})});mxe.displayName=yse;var R8e="CheckboxIndicator",F8e=P.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...i}=e,o=pxe(R8e,n);return r.jsx(fc,{present:s||k1(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{"data-state":$8e(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});F8e.displayName=R8e;var z8e="CheckboxBubbleInput",B8e=P.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:l,required:a,disabled:h,name:p,value:x,form:y,bubbleInput:w,setBubbleInput:j}=pxe(z8e,e),S=ei(n,j),C=vI(o),A=cI(s);P.useEffect(()=>{const T=w;if(!T)return;const O=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(O,"checked").set,q=!i.current;if(C!==o&&F){const H=new Event("click",{bubbles:q});T.indeterminate=k1(o),F.call(T,k1(o)?!1:o),T.dispatchEvent(H)}},[w,C,o,i]);const E=P.useRef(k1(o)?!1:o);return r.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??E.current,required:a,disabled:h,name:p,value:x,form:y,...t,tabIndex:-1,ref:S,style:{...t.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});B8e.displayName=z8e;function Jut(e){return typeof e=="function"}function k1(e){return e==="indeterminate"}function $8e(e){return k1(e)?"indeterminate":e?"checked":"unchecked"}const cc=P.forwardRef(({className:e,...t},n)=>r.jsx(mxe,{ref:n,className:$t("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",e),...t,children:r.jsx(F8e,{className:$t("flex items-center justify-center text-current"),children:r.jsx(Ca,{className:"h-4 w-4"})})}));cc.displayName=mxe.displayName;var gxe="Radio",[eht,U8e]=Ql(gxe),[tht,rht]=eht(gxe),q8e=P.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:i=!1,required:o,disabled:l,value:a="on",onCheck:h,form:p,...x}=e,[y,w]=P.useState(null),j=ei(t,A=>w(A)),S=P.useRef(!1),C=y?p||!!y.closest("form"):!0;return r.jsxs(tht,{scope:n,checked:i,disabled:l,children:[r.jsx(Rn.button,{type:"button",role:"radio","aria-checked":i,"data-state":G8e(i),"data-disabled":l?"":void 0,disabled:l,value:a,...x,ref:j,onClick:cn(e.onClick,A=>{i||h==null||h(),C&&(S.current=A.isPropagationStopped(),S.current||A.stopPropagation())})}),C&&r.jsx(W8e,{control:y,bubbles:!S.current,name:s,value:a,checked:i,required:o,disabled:l,form:p,style:{transform:"translateX(-100%)"}})]})});q8e.displayName=gxe;var V8e="RadioIndicator",H8e=P.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...i}=e,o=rht(V8e,n);return r.jsx(fc,{present:s||o.checked,children:r.jsx(Rn.span,{"data-state":G8e(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t})})});H8e.displayName=V8e;var nht="RadioBubbleInput",W8e=P.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:s=!0,...i},o)=>{const l=P.useRef(null),a=ei(l,o),h=vI(n),p=cI(t);return P.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const S=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(S)}},[h,n,s]),r.jsx(Rn.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});W8e.displayName=nht;function G8e(e){return e?"checked":"unchecked"}var sht=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],vse="RadioGroup",[iht]=Ql(vse,[u3,U8e]),K8e=u3(),Z8e=U8e(),[aht,oht]=iht(vse),Y8e=P.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,defaultValue:i,value:o,required:l=!1,disabled:a=!1,orientation:h,dir:p,loop:x=!0,onValueChange:y,...w}=e,j=K8e(n),S=rk(p),[C,A]=Lu({prop:o,defaultProp:i??null,onChange:y,caller:vse});return r.jsx(aht,{scope:n,name:s,required:l,disabled:a,value:C,onValueChange:A,children:r.jsx(Fge,{asChild:!0,...j,orientation:h,dir:S,loop:x,children:r.jsx(Rn.div,{role:"radiogroup","aria-required":l,"aria-orientation":h,"data-disabled":a?"":void 0,dir:S,...w,ref:t})})})});Y8e.displayName=vse;var X8e="RadioGroupItem",Q8e=P.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:s,...i}=e,o=oht(X8e,n),l=o.disabled||s,a=K8e(n),h=Z8e(n),p=P.useRef(null),x=ei(t,p),y=o.value===i.value,w=P.useRef(!1);return P.useEffect(()=>{const j=C=>{sht.includes(C.key)&&(w.current=!0)},S=()=>w.current=!1;return document.addEventListener("keydown",j),document.addEventListener("keyup",S),()=>{document.removeEventListener("keydown",j),document.removeEventListener("keyup",S)}},[]),r.jsx(zge,{asChild:!0,...a,focusable:!l,active:y,children:r.jsx(q8e,{disabled:l,required:o.required,checked:y,...h,...i,name:o.name,ref:x,onCheck:()=>o.onValueChange(i.value),onKeyDown:cn(j=>{j.key==="Enter"&&j.preventDefault()}),onFocus:cn(i.onFocus,()=>{var j;w.current&&((j=p.current)==null||j.click())})})})});Q8e.displayName=X8e;var lht="RadioGroupIndicator",J8e=P.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,i=Z8e(n);return r.jsx(H8e,{...i,...s,ref:t})});J8e.displayName=lht;var eOe=Y8e,tOe=Q8e,cht=J8e;const rOe=P.forwardRef(({className:e,...t},n)=>r.jsx(eOe,{className:$t("grid gap-2",e),...t,ref:n}));rOe.displayName=eOe.displayName;const nOe=P.forwardRef(({className:e,...t},n)=>r.jsx(tOe,{ref:n,className:$t("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",e),...t,children:r.jsx(cht,{className:"flex items-center justify-center",children:r.jsx(Pu,{className:"h-2.5 w-2.5 fill-current text-current"})})}));nOe.displayName=tOe.displayName;const dht=({brief:e,open:t,onClose:n,onDismiss:s})=>{const{user:i}=zr(),[o,l]=P.useState({}),[a,h]=P.useState({}),[p,x]=P.useState([]);P.useEffect(()=>{t&&i&&e.polls.length>0&&y()},[t,i,e.polls]);const y=async()=>{if(!i)return;const A=e.polls.map(T=>T.id),{data:E}=await ee.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",i.id).in("poll_id",A);if(E){const T={};E.forEach(O=>{T[O.poll_id]||(T[O.poll_id]=[]),T[O.poll_id].push(O.option_id)}),h(T)}},w=(A,E)=>{l(T=>({...T,[A]:E}))},j=(A,E,T)=>{l(O=>{const z=O[A]||[];return T?{...O,[A]:[...z,E]}:{...O,[A]:z.filter(F=>F!==E)}})},S=async A=>{if(!i)return;const E=o[A];if(!E||Array.isArray(E)&&E.length===0){ze.error("Please select an option");return}x(T=>[...T,A]);try{await ee.from("levelup_brief_poll_responses").delete().eq("poll_id",A).eq("user_id",i.id);const T=Array.isArray(E)?E:[E],O=T.map(F=>({poll_id:A,option_id:F,user_id:i.id})),{error:z}=await ee.from("levelup_brief_poll_responses").insert(O);if(z)throw z;h(F=>({...F,[A]:T})),ze.success("Response submitted!")}catch(T){console.error("Error submitting poll response:",T),ze.error("Failed to submit response")}finally{x(T=>T.filter(O=>O!==A))}},C=A=>(A.includes("mediadelivery.net")||A.includes("bunny"),A);return r.jsx(Br,{open:t,onOpenChange:A=>!A&&n(),children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] p-0 overflow-hidden [&>button]:hidden",children:[r.jsxs("div",{className:"bg-gradient-to-r from-primary to-primary/80 p-4 pr-12 text-primary-foreground relative",children:[r.jsx("button",{onClick:n,className:"absolute top-3 right-3 p-1.5 rounded-full bg-white/30 hover:bg-white/50 transition-colors","aria-label":"Close",children:r.jsx(Ts,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-white/20 rounded-lg",children:r.jsx(mm,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Ft,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(qr,{className:"text-xl font-bold text-white",children:e.brief.title})]})]})]}),r.jsx(Jo,{className:"max-h-[calc(90vh-240px)]",children:r.jsxs("div",{className:"p-6 space-y-6",children:[e.brief.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:e.brief.description}}),e.brief.video_url&&r.jsx("div",{className:"relative w-full aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:C(e.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),e.brief.graphic_url&&!e.brief.video_url&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted",children:e.brief.graphic_link_url?r.jsx("a",{href:e.brief.graphic_link_url,target:"_blank",rel:"noopener noreferrer",className:"block",children:r.jsx("img",{src:e.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain cursor-pointer hover:opacity-90 transition-opacity"})}):r.jsx("img",{src:e.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain"})}),e.links.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:"Quick Links"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.links.map(A=>r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>window.open(A.url,"_blank"),className:"gap-2",children:[r.jsx(Ls,{className:"h-4 w-4"}),A.title]},A.id))})]}),e.polls.map(A=>{var O,z;const E=((O=a[A.id])==null?void 0:O.length)>0,T=p.includes(A.id);return r.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:A.question}),E&&r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Za,{className:"h-3 w-3"}),"Responded"]})]}),A.poll_type==="single"?r.jsx(rOe,{value:o[A.id]||((z=a[A.id])==null?void 0:z[0])||"",onValueChange:F=>w(A.id,F),className:"space-y-2",children:A.options.map(F=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(nOe,{value:F.id,id:F.id}),r.jsx(Ve,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id))}):r.jsx("div",{className:"space-y-2",children:A.options.map(F=>{const H=(o[A.id]||a[A.id]||[]).includes(F.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(cc,{id:F.id,checked:H,onCheckedChange:K=>j(A.id,F.id,K)}),r.jsx(Ve,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id)})}),r.jsx(J,{size:"sm",onClick:()=>S(A.id),disabled:T,children:T?"Submitting...":E?"Update Response":"Submit"})]},A.id)})]})}),r.jsxs("div",{className:"p-4 pb-[calc(1rem+env(safe-area-inset-bottom))] border-t bg-muted/30 flex flex-col items-center gap-2 sticky bottom-0 z-10",children:[r.jsx(J,{onClick:n,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(J,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"})]})]})})},uht=()=>{const{user:e}=zr(),[t,n]=P.useState(null),[s,i]=P.useState(!1),[o,l]=P.useState(!0),[a,h]=P.useState(!1),p=P.useCallback(async()=>{if(!e){l(!1);return}try{const{data:S,error:C}=await ee.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(C||!S){l(!1);return}const{data:A}=await ee.from("levelup_brief_views").select("*").eq("brief_id",S.id).eq("user_id",e.id).maybeSingle(),[E,T]=await Promise.all([ee.from("levelup_brief_links").select("*").eq("brief_id",S.id).order("sort_order"),ee.from("levelup_brief_polls").select("*").eq("brief_id",S.id).order("sort_order")]),O=[];if(T.data)for(const H of T.data){const{data:K}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",H.id).order("sort_order");O.push({...H,options:K||[]})}const z={brief:S,links:E.data||[],polls:O};n(z);const F=!!A,q=(A==null?void 0:A.dismissed_at)!==null;if(!F)i(!0),h(!0);else if(S.show_frequency==="every_login"&&!q)i(!0),h(!0);else if(S.show_frequency==="daily"){const H=new Date(A.viewed_at);(new Date().getTime()-H.getTime())/(1e3*60*60)>=24&&!q&&(i(!0),h(!0))}else h(!q)}catch(S){console.error("Error fetching brief:",S)}finally{l(!1)}},[e]);P.useEffect(()=>{p()},[p]);const x=async()=>{if(!(!e||!t))try{const{data:S}=await ee.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();S?await ee.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",S.id):await ee.from("levelup_brief_views").insert({brief_id:t.brief.id,user_id:e.id})}catch(S){console.error("Error marking brief as viewed:",S)}};return{currentBrief:t,shouldShowPopup:s,hasUnseenBrief:a,loading:o,openBrief:()=>{i(!0)},closeBrief:()=>{i(!1),x()},dismissBrief:async()=>{if(!(!e||!t))try{const{data:S}=await ee.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();S?await ee.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",S.id):await ee.from("levelup_brief_views").insert({brief_id:t.brief.id,user_id:e.id,dismissed_at:new Date().toISOString()}),i(!1),h(!1)}catch(S){console.error("Error dismissing brief:",S)}},refetch:p}};function hht(){const[e,t]=P.useState(!1),[n,s]=P.useState(!1),[i,o]=P.useState(null);P.useEffect(()=>{if(localStorage.getItem("install-banner-dismissed")||window.matchMedia("(display-mode: standalone)").matches||!/iPhone|iPad|iPod|Android/i.test(navigator.userAgent))return;const y=/iPhone|iPad|iPod/i.test(navigator.userAgent);s(y),t(!0);const w=j=>{j.preventDefault(),o(j)};return window.addEventListener("beforeinstallprompt",w),()=>{window.removeEventListener("beforeinstallprompt",w)}},[]);const l=()=>{localStorage.setItem("install-banner-dismissed","true"),t(!1)},a=async()=>{if(i){await i.prompt();const{outcome:h}=await i.userChoice;h==="accepted"&&l(),o(null)}};return e?r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 p-4 bg-primary text-primary-foreground shadow-lg animate-in slide-in-from-bottom duration-300",children:r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"flex-shrink-0 p-2 bg-primary-foreground/10 rounded-full",children:r.jsx(Xa,{className:"h-5 w-5"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Add LevelUp to your home screen"}),n?r.jsxs("p",{className:"text-xs opacity-80 flex items-center gap-1",children:["Tap ",r.jsx(HT,{className:"h-3 w-3 inline"}),' then "Add to Home Screen"']}):r.jsx("p",{className:"text-xs opacity-80",children:"Quick access anytime"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!n&&i&&r.jsx(J,{size:"sm",variant:"secondary",onClick:a,className:"text-xs",children:"Install"}),r.jsx("button",{onClick:l,className:"p-1.5 hover:bg-primary-foreground/10 rounded-full transition-colors","aria-label":"Dismiss",children:r.jsx(Ts,{className:"h-4 w-4"})})]})]})}):null}const fht=({children:e,onRefresh:t})=>{const[n,s]=P.useState(!1),[i,o]=P.useState(0),[l,a]=P.useState(!1),h=P.useRef(null),p=P.useRef(0),x=Wr(),y=80,w=120,j=P.useCallback(T=>{const O=h.current;O&&O.scrollTop<=0&&(p.current=T.touches[0].clientY,s(!0))},[]),S=P.useCallback(T=>{if(!n||l)return;const O=h.current;if(!O||O.scrollTop>0){s(!1),o(0);return}const F=T.touches[0].clientY-p.current;if(F>0){const H=Math.min(F*.5,w);o(H),H>10&&T.preventDefault()}},[n,l]),C=P.useCallback(async()=>{if(n)if(s(!1),i>=y&&!l){a(!0),o(y);try{t?await t():await x.invalidateQueries()}catch(T){console.error("Refresh failed:",T)}finally{a(!1),o(0)}}else o(0)},[n,i,l,t,x]),A=Math.min(i/y,1),E=A*180;return r.jsxs("div",{ref:h,className:"h-full overflow-auto",onTouchStart:j,onTouchMove:S,onTouchEnd:C,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:i>0?i:0,opacity:A},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${l?"animate-spin":""}`,style:{transform:l?void 0:`rotate(${E}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:r.jsx(ql,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:i>0?`translateY(${Math.max(0,i-60)}px)`:void 0,transition:n?void 0:"transform 0.2s ease-out"},children:e})]})},sOe=()=>{const{user:e}=zr(),[t,n]=P.useState(!1),[s,i]=P.useState(!1),[o,l]=P.useState(0),[a,h]=P.useState(!0);P.useEffect(()=>{(async()=>{if(!e){h(!1);return}try{const{data:j}=await ee.from("membership_reviews").select("id").eq("user_id",e.id).maybeSingle();if(j){i(!0),n(!1),h(!1);return}const{data:S}=await ee.from("profiles").select("login_count").eq("id",e.id).single(),C=(S==null?void 0:S.login_count)||0;l(C);const A=sessionStorage.getItem("review-prompt-dismissed");n(C>=4&&!A)}catch(j){console.error("Error checking review eligibility:",j)}finally{h(!1)}})()},[e]);const p=P.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=P.useCallback(async(w,j)=>{if(!e)return{success:!1,error:"Not authenticated"};try{const{error:S}=await ee.from("membership_reviews").insert({user_id:e.id,rating:w,review_text:j});if(S)throw S;const{data:C,error:A}=await ee.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",e.id).maybeSingle();A&&console.error("Error fetching current stats:",A);const E=(C==null?void 0:C.spendable_points)||0,T=(C==null?void 0:C.total_points)||0,O=E+25,z=T+25,{error:F}=await ee.from("agent_attendance_stats").upsert({user_id:e.id,total_points:z,spendable_points:O,updated_at:new Date().toISOString()},{onConflict:"user_id"});F&&console.error("Error upserting attendance stats:",F);const{error:q}=await ee.from("agent_points").insert({user_id:e.id,points:25,reason:"Left a membership review"});return q&&console.error("Error logging points:",q),i(!0),n(!1),{success:!0,pointsAwarded:25}}catch(S){return console.error("Error submitting review:",S),{success:!1,error:S.message}}},[e]),y=P.useCallback(async()=>{if(e)try{await ee.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",e.id)}catch(w){console.error("Error updating Google review status:",w)}},[e]);return{shouldShowPrompt:t,hasSubmittedReview:s,loginCount:o,isLoading:a,dismissPrompt:p,submitReview:x,markPostedToGoogle:y}},pht="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",mht=()=>{const{shouldShowPrompt:e,isLoading:t,dismissPrompt:n,submitReview:s,markPostedToGoogle:i}=sOe(),[o,l]=P.useState(!1),[a,h]=P.useState("review"),[p,x]=P.useState(0),[y,w]=P.useState(0),[j,S]=P.useState(""),[C,A]=P.useState(!1),[E,T]=P.useState(!1);if(t||!e&&!E)return null;const O=async()=>{if(p===0){$i({title:"Please select a rating",variant:"destructive"});return}A(!0);const q=await s(p,j);A(!1),q.success?(T(!0),$i({title:"Thank you for your feedback!",description:"Your review helps us improve."}),h("google")):$i({title:"Error submitting review",description:q.error,variant:"destructive"})},z=async q=>{q&&(await navigator.clipboard.writeText(j||`${p} star rating for LevelUp!`),$i({title:"Review copied!",description:"Paste it on Google Reviews."}),await i(),window.open(pht,"_blank")),l(!1),n()},F=()=>{l(!1),n()};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>l(!0),className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-40 flex items-center gap-2 rounded-full bg-primary/90 px-3 py-2 text-xs text-primary-foreground shadow-lg backdrop-blur-sm transition-all hover:bg-primary hover:scale-105 md:bottom-6",children:[r.jsx(vs,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Br,{open:o,onOpenChange:F,children:r.jsx(Fr,{className:"sm:max-w-md",children:a==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(es,{className:"text-center",children:"Your feedback helps us improve the experience for all members."})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsx("div",{className:"flex justify-center gap-1",children:[1,2,3,4,5].map(q=>r.jsx("button",{type:"button",onClick:()=>x(q),onMouseEnter:()=>w(q),onMouseLeave:()=>w(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(vs,{className:$t("h-8 w-8 transition-colors",(y||p)>=q?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},q))}),r.jsx(ms,{placeholder:"Tell us about your experience (optional)",value:j,onChange:q=>S(q.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{variant:"outline",onClick:F,className:"flex-1",children:"Maybe Later"}),r.jsx(J,{onClick:O,disabled:C||p===0,className:"flex-1",children:C?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(es,{className:"text-center",children:"Would you mind sharing your review on Google? It really helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"We'll copy your review so you can easily paste it."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>z(!1),className:"flex-1",children:"No Thanks"}),r.jsx(J,{onClick:()=>z(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function ght(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(n),i=new Uint8Array(s.length);for(let o=0;o{if(!y){l(!1);return}(async()=>{try{const{data:C,error:A}=await ee.functions.invoke("get-vapid-public-key",{body:{}});if(A)throw A;const E=C==null?void 0:C.vapidPublicKey;if(!E)throw new Error("Missing VAPID public key");x(E);const T=await navigator.serviceWorker.register("/push-sw.js");h(T),n(Notification.permission);const O=await T.pushManager.getSubscription();i(!!O)}catch(C){console.error("Error initializing push notifications:",C)}finally{l(!1)}})()},[y]);const w=P.useCallback(async()=>{if(!y||!a||!e)return console.error("Push notifications not supported or user not logged in"),!1;if(!p)return ze.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const S=await a.pushManager.getSubscription();if(S){try{await S.unsubscribe()}catch(z){console.warn("Failed to unsubscribe existing push subscription:",z)}const{error:O}=await ee.from("push_subscriptions").delete().eq("user_id",e.id);O&&console.warn("Failed to cleanup push_subscriptions rows:",O)}if(Notification.permission!=="granted"){const O=await Notification.requestPermission();if(n(O),O!=="granted")return O==="denied"?ze.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):ze.error("Notification permission was dismissed. Please try again."),!1}const C=ght(p);let A;try{A=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:C})}catch(O){console.error("PushManager.subscribe() failed:",O);const z=(O==null?void 0:O.message)||String(O);return z.includes("permission")?ze.error("Push permission denied. Check your browser notification settings."):z.includes("key")||z.includes("VAPID")?ze.error("Push configuration error. Please contact support."):z.includes("AbortError")?ze.error("Push subscription was cancelled. Please try again."):ze.error(`Failed to subscribe: ${z}`),!1}const E=A.toJSON(),{error:T}=await ee.from("push_subscriptions").upsert({user_id:e.id,endpoint:E.endpoint,p256dh_key:E.keys.p256dh,auth_key:E.keys.auth},{onConflict:"user_id,endpoint"});if(T)throw console.error("Error saving subscription:",T),ze.error("Failed to save notification preferences. Please try again."),T;return i(!0),ze.success("Push notifications enabled!"),!0}catch(S){if(console.error("Error subscribing to push notifications:",S),!(S instanceof Error&&S.message.includes("toast"))){const C=S instanceof Error?S.message:"Unknown error";ze.error("Failed to enable push notifications: "+C)}return!1}finally{l(!1)}},[y,a,e,p]),j=P.useCallback(async()=>{if(!a||!e)return!1;try{l(!0);const S=await a.pushManager.getSubscription();return S&&await S.unsubscribe(),await ee.from("push_subscriptions").delete().eq("user_id",e.id),i(!1),ze.success("Push notifications disabled"),!0}catch(S){console.error("Error unsubscribing:",S);const C=S instanceof Error?S.message:"Unknown error";return ze.error("Failed to disable push notifications: "+C),!1}finally{l(!1)}},[a,e]);return{isSupported:y,permission:t,isSubscribed:s,isLoading:o,vapidPublicKey:p,subscribe:w,unsubscribe:j}}const uke="push_notification_prompt_dismissed",xht=()=>{const{user:e}=zr(),{isSupported:t,isSubscribed:n,isLoading:s,subscribe:i}=iOe(),[o,l]=P.useState(!1),[a,h]=P.useState(!1);P.useEffect(()=>{if(!e||!t||n||s||localStorage.getItem(`${uke}_${e.id}`))return;const w=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(w)},[e,t,n,s]);const p=async()=>{h(!0);const y=await i();h(!1),y&&l(!1)},x=()=>{e&&localStorage.setItem(`${uke}_${e.id}`,"true"),l(!1)};return!t||n?null:r.jsx(Br,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:r.jsx(vg,{className:"h-6 w-6 text-primary"})}),r.jsx(qr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(es,{className:"text-center",children:"Enable push notifications to get alerted when:"})]}),r.jsxs("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New events go live"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Fresh templates are added"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New toolbox resources drop"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Social swag updates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New newsletters arrive"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Posts in your community groups"]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(J,{onClick:p,disabled:a,className:"w-full",children:a?"Enabling...":"Enable Notifications"}),r.jsx(J,{variant:"ghost",onClick:x,className:"w-full",children:"Not Now"})]}),r.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can always change this in your Profile settings."})]})})},hke=e=>{let t;const n=new Set,s=(p,x)=>{const y=typeof p=="function"?p(t):p;if(!Object.is(y,t)){const w=t;t=x??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(j=>j(t,w))}},i=()=>t,a={setState:s,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(s,i,a);return a},yht=e=>e?hke(e):hke,vht=e=>e;function _ht(e,t=vht){const n=rt.useSyncExternalStore(e.subscribe,rt.useCallback(()=>t(e.getState()),[e,t]),rt.useCallback(()=>t(e.getInitialState()),[e,t]));return rt.useDebugValue(n),n}const bht=e=>{const t=yht(e),n=s=>_ht(t,s);return Object.assign(n,t),n},wht=e=>bht;function jht(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var o;const l=h=>h===null?null:JSON.parse(h,void 0),a=(o=n.getItem(i))!=null?o:null;return a instanceof Promise?a.then(l):l(a)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const She=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return She(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return She(s)(n)}}}},kht=(e,t)=>(n,s,i)=>{let o={storage:jht(()=>localStorage),partialize:C=>C,version:0,merge:(C,A)=>({...A,...C}),...t},l=!1;const a=new Set,h=new Set;let p=o.storage;if(!p)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...C)},s,i);const x=()=>{const C=o.partialize({...s()});return p.setItem(o.name,{state:C,version:o.version})},y=i.setState;i.setState=(C,A)=>(y(C,A),x());const w=e((...C)=>(n(...C),x()),s,i);i.getInitialState=()=>w;let j;const S=()=>{var C,A;if(!p)return;l=!1,a.forEach(T=>{var O;return T((O=s())!=null?O:w)});const E=((A=o.onRehydrateStorage)==null?void 0:A.call(o,(C=s())!=null?C:w))||void 0;return She(p.getItem.bind(p))(o.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==o.version){if(o.migrate){const O=o.migrate(T.state,T.version);return O instanceof Promise?O.then(z=>[!0,z]):[!0,O]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var O;const[z,F]=T;if(j=o.merge(F,(O=s())!=null?O:w),n(j,!0),z)return x()}).then(()=>{E==null||E(j,void 0),j=s(),l=!0,h.forEach(T=>T(j))}).catch(T=>{E==null||E(void 0,T)})};return i.persist={setOptions:C=>{o={...o,...C},C.storage&&(p=C.storage)},clearStorage:()=>{p==null||p.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:C=>(a.add(C),()=>{a.delete(C)}),onFinishHydration:C=>(h.add(C),()=>{h.delete(C)})},o.skipHydration||S(),j||w},Nht=kht,_se=wht()(Nht((e,t)=>({cartItems:[],addToCart:(n,s,i=1,o)=>{e(l=>{const a=l.cartItems.findIndex(h=>{var p;return h.product.id===n.id&&((p=h.variant)==null?void 0:p.id)===(s==null?void 0:s.id)});if(a>=0){const h=[...l.cartItems];return h[a].quantity+=i,o&&(h[a].artworkUrl=o),{cartItems:h}}return{cartItems:[...l.cartItems,{product:n,variant:s,quantity:i,artworkUrl:o}]}})},removeFromCart:(n,s)=>{e(i=>({cartItems:i.cartItems.filter(o=>{var l;return!(o.product.id===n&&((l=o.variant)==null?void 0:l.id)===s)})}))},updateQuantity:(n,s,i)=>{e(o=>({cartItems:o.cartItems.map(l=>{var a;return l.product.id===n&&((a=l.variant)==null?void 0:a.id)===s?{...l,quantity:Math.max(1,i)}:l})}))},updateArtwork:(n,s,i)=>{e(o=>({cartItems:o.cartItems.map(l=>{var a;return l.product.id===n&&((a=l.variant)==null?void 0:a.id)===s?{...l,artworkUrl:i}:l})}))},clearCart:()=>e({cartItems:[]}),getItemPrice:n=>{const s=Number(n.product.base_price),i=n.variant?Number(n.variant.price_adjustment):0;return s+i},getSubtotal:()=>{const{cartItems:n,getItemPrice:s}=t();return n.reduce((i,o)=>i+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=t();return n.reduce((s,i)=>s+Number(i.product.shipping_fee)*i.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=t();return n()+s()}}),{name:"marketplace-cart",partialize:e=>({cartItems:e.cartItems})})),aOe=P.createContext({onlineUsers:[],totalOnline:0}),Sht=async e=>{try{const{data:t}=await ee.storage.from("avatars").list(`${e}`);if(t&&t.length>0){const{data:n}=ee.storage.from("avatars").getPublicUrl(`${e}/${t[0].name}`);return n.publicUrl}}catch{}},Cht=({children:e})=>{const{user:t,brokerageId:n,isAdmin:s}=zr(),[i,o]=P.useState([]),[l,a]=P.useState(null);P.useEffect(()=>{if(!t)return;const p=ee.channel("app-presence",{config:{presence:{key:t.id}}});return p.on("presence",{event:"sync"},()=>{const x=p.presenceState(),y=[];Object.entries(x).forEach(([w,j])=>{if(j&&j.length>0){const S=j[0];y.push({id:w,name:S.name||"Unknown",avatarUrl:S.avatarUrl,brokerageId:S.brokerageId,onlineSince:S.onlineSince})}}),o(y)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async x=>{var y;if(x==="SUBSCRIBED"){const{data:w}=await ee.from("profiles").select("name, brokerage_id").eq("id",t.id).single(),j=await Sht(t.id);await p.track({name:(w==null?void 0:w.name)||((y=t.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:j,brokerageId:w==null?void 0:w.brokerage_id,onlineSince:new Date().toISOString()})}}),a(p),()=>{p.unsubscribe()}},[t]);const h=i.filter(p=>p.id===(t==null?void 0:t.id)?!1:!!(s||n&&p.brokerageId===n||!n&&!p.brokerageId));return r.jsx(aOe.Provider,{value:{onlineUsers:h,totalOnline:i.length},children:e})},oOe=()=>P.useContext(aOe),fke="dashboard-sidebar-collapsed",Or=({children:e,title:t})=>{var _e,Ee,ke;const{user:n,signOut:s,isAdmin:i,isBrokerageManager:o,brokerageId:l}=zr(),{avatarUrl:a}=Ege(n==null?void 0:n.id),{isTrial:h,isExpired:p,expiresAt:x}=qat(n==null?void 0:n.id),{isMarketplaceEnabled:y}=L6e(),{currentBrief:w,shouldShowPopup:j,hasUnseenBrief:S,openBrief:C,closeBrief:A,dismissBrief:E}=uht(),{unreadCount:T}=Vat(),{openCount:O}=Hat(),F=_se(pe=>pe.cartItems).reduce((pe,ae)=>pe+ae.quantity,0),q=ns(),H=km(),[K,Z]=P.useState(()=>typeof window<"u"?localStorage.getItem(fke)==="true":!1);P.useEffect(()=>{localStorage.setItem(fke,String(K))},[K]);const[re,ue]=P.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),he=pe=>{ue(ae=>({...ae,[pe]:!ae[pe]}))},be=pe=>pe.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),ne=pe=>H.pathname===pe,ye=pe=>pe.some(ae=>H.pathname===ae),ie=({path:pe,icon:ae,label:ge,badgeCount:Me})=>{const Ue=r.jsxs(J,{variant:"ghost",size:"sm",className:$t("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ne(pe)&&"bg-sidebar-accent text-sidebar-accent-foreground",K?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>q(pe),children:[r.jsxs("div",{className:"relative",children:[r.jsx(ae,{className:"h-4 w-4 shrink-0"}),K&&Me!=null&&Me>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]}),!K&&ge,!K&&Me!=null&&Me>0&&r.jsx("span",{className:"ml-auto flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Me>9?"9+":Me})]});return K?r.jsxs(Ng,{delayDuration:0,children:[r.jsx(Sg,{asChild:!0,children:Ue}),r.jsxs(ym,{side:"right",className:"flex items-center gap-2",children:[ge,Me!=null&&Me>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Me>9?"9+":Me})]})]}):Ue},fe=({id:pe,label:ae,icon:ge,children:Me,activePaths:Ue,showBetaBadge:Ie,defaultPath:Ke,badgeCount:Re})=>{if(K){const Ce=Ke||Ue[0];return r.jsxs(Ng,{delayDuration:0,children:[r.jsx(Sg,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"sm",className:$t("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ye(Ue)&&"text-primary"),onClick:()=>q(Ce),children:r.jsxs("div",{className:"relative",children:[r.jsx(ge,{className:"h-4 w-4"}),Re!=null&&Re>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]})})}),r.jsxs(ym,{side:"right",className:"flex items-center gap-2",children:[ae,Ie&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600",children:"Beta"}),Re!=null&&Re>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Re>9?"9+":Re})]})]})}return r.jsxs(kS,{open:re[pe],onOpenChange:()=>he(pe),children:[r.jsx(NS,{asChild:!0,children:r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye(Ue)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(ge,{className:"h-4 w-4"}),ae,Ie&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("span",{className:"flex items-center gap-1",children:[Re!=null&&Re>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Re>9?"9+":Re}),r.jsx(Iu,{className:$t("h-4 w-4 transition-transform duration-200",re[pe]&&"rotate-180")})]})]})}),r.jsx(SS,{className:"pl-4 space-y-1 mt-1",children:Me})]})},de=({isMobile:pe=!1})=>{const ae=pe?!1:K;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:$t("p-3 border-b border-sidebar-border",ae?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[ae?r.jsx("img",{src:Olt,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:zje,alt:"LevelUp",className:"h-8 w-auto"}),!pe&&r.jsxs(Ng,{delayDuration:0,children:[r.jsx(Sg,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>Z(!ae),children:r.jsx(qc,{className:$t("h-4 w-4 transition-transform duration-300",ae&&"rotate-180")})})}),r.jsx(ym,{side:"right",children:ae?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(Jo,{className:"flex-1",children:r.jsxs("nav",{className:$t("p-3 space-y-1",ae&&"flex flex-col items-center"),children:[r.jsx(ie,{path:"/dashboard",icon:sS,label:"Dashboard"}),r.jsx(ie,{path:"/events",icon:um,label:"Events"}),r.jsxs(fe,{id:"agentos",label:"Agent OS",icon:Q4,activePaths:["/mission-control","/mission-control/contacts","/mission-control/plans","/mission-control/popbys","/mission-control/video-library","/mission-control/scorecard","/mission-control/listings","/mission-control/pipeline"],showBetaBadge:!0,defaultPath:"/mission-control",children:[r.jsx(ie,{path:"/mission-control",icon:oa,label:"Mission Control"}),r.jsx(ie,{path:"/mission-control/contacts",icon:Kn,label:"Contacts"}),r.jsx(ie,{path:"/mission-control/plans",icon:um,label:"TouchPlans"}),r.jsx(ie,{path:"/mission-control/pipeline",icon:f1,label:"Deal Pipeline"}),r.jsx(ie,{path:"/mission-control/popbys",icon:Va,label:"Popbys"}),r.jsx(ie,{path:"/mission-control/video-library",icon:Fi,label:"Video Library"}),r.jsx(ie,{path:"/mission-control/scorecard",icon:ac,label:"Scorecard"}),r.jsx(ie,{path:"/mission-control/listings",icon:na,label:"Listing Exchange"})]}),r.jsxs(fe,{id:"tools",label:"Tools",icon:Oh,activePaths:["/apps","/ai-toolkit","/mission-control/my-card"],defaultPath:"/apps",children:[r.jsx(ie,{path:"/apps",icon:Oh,label:"Apps"}),!ae&&r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/mission-control/my-card"),children:[r.jsx(hm,{className:"h-4 w-4"}),"Digital Card",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),ae&&r.jsx(ie,{path:"/mission-control/my-card",icon:hm,label:"Digital Card"})]}),r.jsxs(fe,{id:"marketing",label:"Marketing",icon:mm,activePaths:["/templates","/social-swag-2","/newsletters","/listing-swag"],defaultPath:"/templates",children:[r.jsx(ie,{path:"/templates",icon:Ld,label:"Templates"}),!ae&&r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/social-swag-2")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/social-swag-2"),children:[r.jsx(gm,{className:"h-4 w-4"}),"Social Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),ae&&r.jsx(ie,{path:"/social-swag-2",icon:gm,label:"Social Swag"}),r.jsx(ie,{path:"/newsletters",icon:Vx,label:"Newsletters"}),i&&!ae&&r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/listing-swag")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/listing-swag"),children:[r.jsx(Zo,{className:"h-4 w-4"}),"Listing Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-amber-500 text-white",children:"Beta"})]}),i&&ae&&r.jsx(ie,{path:"/listing-swag",icon:Zo,label:"Listing Swag"})]}),r.jsxs(fe,{id:"learning",label:"Learning",icon:CT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(ie,{path:"/academy",icon:h1,label:"Academy"}),r.jsx(ie,{path:"/toolbox",icon:Gx,label:"Toolbox"})]}),r.jsxs(fe,{id:"community",label:"Community",icon:Po,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:T,children:[r.jsx(ie,{path:"/community",icon:Kn,label:"Community",badgeCount:T}),r.jsx(ie,{path:"/wishlist",icon:p1,label:"Wishlist",badgeCount:O}),!ae&&r.jsxs(J,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>window.open("https://www.facebook.com/share/g/1CC6thti2V/","_blank"),children:[r.jsx(Ls,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(fe,{id:"goods",label:"The Goods",icon:dh,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[y&&!ae&&r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",H.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/marketplace"),children:[r.jsx(dh,{className:"h-4 w-4"}),"Marketplace",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground",children:"New"})]}),y&&ae&&r.jsx(ie,{path:"/marketplace",icon:dh,label:"Marketplace"}),r.jsx(ie,{path:"/reward-store",icon:Ha,label:"Reward Store"})]}),r.jsxs(fe,{id:"help",label:"Help & Services",icon:Nx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(ie,{path:"/support",icon:aS,label:"Support"}),r.jsx(ie,{path:"/additional-services",icon:Ss,label:"Additional Services"})]}),i&&r.jsxs(r.Fragment,{children:[!ae&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Admin"})}),ae?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(ie,{path:"/admin",icon:Wf,label:"Admin Dashboard"})}):r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",H.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/admin"),children:[r.jsx(Wf,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!i&&r.jsxs(r.Fragment,{children:[!ae&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"My Brokerage"})}),ae?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(ie,{path:"/my-brokerage",icon:na,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{path:"/brokerage/dashboard",icon:hd,label:"Manage Brokerages"}),r.jsx(ie,{path:"/brokerage-resources",icon:gh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/my-brokerage"),children:[r.jsx(na,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage/dashboard"),children:[r.jsx(hd,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage-resources"),children:[r.jsx(gh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(J,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/profile"),children:[r.jsx(Cc,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(J,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:s,children:[r.jsx(cS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(Cht,{children:r.jsx(fI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[h&&p&&r.jsx(Kut,{}),typeof document<"u"&&hy.createPortal(r.jsx("aside",{className:$t("hidden md:flex flex-col bg-card border-r border-border fixed top-0 left-0 h-screen z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",K?"w-16":"w-52"),children:r.jsx(de,{})}),document.body),r.jsxs("div",{className:$t("flex-1 flex flex-col h-screen overflow-hidden transition-all duration-300",K?"md:ml-16":"md:ml-52"),children:[r.jsx("header",{className:"sticky top-0 z-40 bg-card border-b border-border flex-shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[r.jsxs(Jne,{children:[r.jsx(Ige,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(OT,{className:"h-5 w-5"})})}),r.jsx(_I,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(de,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:zje,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(dke,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[h&&!p&&x&&r.jsx(Gut,{expiresAt:x,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(dke,{})}),w&&r.jsx(Zut,{hasUnseenBrief:S,onClick:C}),y&&r.jsxs(J,{variant:"ghost",size:"icon",className:"relative",onClick:()=>q("/marketplace/cart"),children:[r.jsx(dh,{className:"h-5 w-5"}),F>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-5 w-5 rounded-full bg-primary text-primary-foreground text-xs font-medium flex items-center justify-center",children:F>99?"99+":F})]}),r.jsx(vut,{}),r.jsx(yhe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Ee=(_e=n==null?void 0:n.user_metadata)==null?void 0:_e.name)==null?void 0:Ee.split(" ")[0])||"User","!"]}),r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsx("button",{className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-full",children:r.jsxs(ci,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Wa,{src:a||void 0}),r.jsx(di,{className:"bg-primary text-primary-foreground font-medium text-sm",children:be(((ke=n==null?void 0:n.user_metadata)==null?void 0:ke.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(ap,{align:"end",className:"w-48",children:[r.jsxs(po,{onClick:()=>q("/profile"),className:"cursor-pointer",children:[r.jsx(Cc,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsx(fC,{}),r.jsxs(po,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(cS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(fht,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:e})}),w&&r.jsx(dht,{brief:w,open:j,onClose:A,onDismiss:E}),r.jsx(hht,{}),r.jsx(mht,{}),r.jsx(xht,{})]})]})})})},Mht=()=>{const{user:e}=zr(),[t,n]=P.useState(!1),[s,i]=P.useState(null),[o,l]=P.useState(""),a=async y=>{var w;if(!(e!=null&&e.email)){ze.error("Please sign in to upgrade");return}n(!0),i(y);try{const{data:j,error:S}=await ee.functions.invoke("create-checkout",{body:{tier:y,email:e.email,name:((w=e.user_metadata)==null?void 0:w.full_name)||e.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(S)throw S;if(j!=null&&j.url)window.open(j.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(j){console.error("Checkout error:",j),ze.error(j.message||"Failed to start checkout. Please try again.")}finally{n(!1),i(null)}},h=["Unlimited access to all marketing templates","Complete Academy training library","AI-powered tools and resources","Community forums and support","Exclusive member events and workshops","Deal pipeline & scorecard tracking","Listing exchange access","Social media content library"],p=["Everything in Individual plan","Up to 25 agent seats","Brokerage admin dashboard","Team performance analytics","Custom branding options","Priority support","Agent onboarding tools","Brokerage-wide announcements"],x=["Everything in Brokerage plan","Unlimited agent seats","Dedicated account manager","Advanced analytics & reporting","White-label options","API access","Custom integrations","Enterprise-level support"];return r.jsx(Or,{children:r.jsxs("div",{className:"container max-w-6xl py-8 px-4",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Upgrade Your Membership"}),r.jsx("p",{className:"text-muted-foreground text-lg",children:"Choose the plan that's right for you and unlock the full power of LevelUp"})]}),r.jsxs("div",{className:"max-w-md mx-auto mb-8",children:[r.jsx(Ve,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(ct,{id:"coupon",placeholder:"Enter discount code",value:o,onChange:y=>l(y.target.value),className:"mt-1"})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6 mb-8",children:[r.jsxs(We,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors relative overflow-hidden",children:[r.jsx("div",{className:"absolute top-0 right-0 bg-primary text-primary-foreground text-xs px-3 py-1 rounded-bl-lg font-medium",children:"Popular"}),r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Kn,{className:"h-7 w-7 text-primary"})}),r.jsx(Xt,{className:"text-xl",children:"Individual Agent"}),r.jsx(En,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:h.map((y,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ca,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},w))}),r.jsxs(J,{className:"w-full",size:"lg",onClick:()=>a("individual_agent"),disabled:t,children:[t&&s==="individual_agent"?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(We,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Xt,{className:"text-xl",children:"Brokerage"}),r.jsx(En,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-amber-600",children:"$299"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:p.map((y,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ca,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},w))}),r.jsxs(J,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>a("brokerage_under_25"),disabled:t,children:[t&&s==="brokerage_under_25"?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(na,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(We,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-purple-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Xt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(En,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-purple-600",children:"$499"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:x.map((y,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ca,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},w))}),r.jsxs(J,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>a("brokerage_over_25"),disabled:t,children:[t&&s==="brokerage_over_25"?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(na,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(We,{className:"bg-muted/50",children:r.jsxs(Xe,{className:"py-6",children:[r.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Zs,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},Tht=()=>{const{user:e,loading:t,isBrokerageManager:n,brokerageId:s}=zr(),i=ns(),[o,l]=P.useState(""),[a,h]=P.useState(!1),[p,x]=P.useState(!1);P.useEffect(()=>{!t&&!e&&i("/auth")},[e,t,i]),P.useEffect(()=>{!t&&e&&s&&i("/profile?setup=true")},[e,t,s,i]);const y=async()=>{if(!o.trim()){ze.error("Please enter a brokerage name");return}const{data:w}=await ee.auth.getSession(),j=w.session;if(!e||!j){ze.error("Please sign in again to create your brokerage."),i("/auth");return}h(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!e,hasSession:!!j,userId:e==null?void 0:e.id});const{data:S,error:C}=await ee.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:S,error:C}),C)throw C;if(!(S!=null&&S.ok))throw new Error((S==null?void 0:S.error)||"Failed to create brokerage");h(!1),x(!0),ze.success("Brokerage created! Setting up your account..."),setTimeout(()=>{i("/profile?setup=true")},2e3)}catch(S){console.error("Error creating brokerage:",S),ze.error(S.message||"Failed to create brokerage"),h(!1)}};return t?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p?r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(We,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(nn,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Xt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(En,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(qa,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{children:"Brokerage created"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(nn,{className:"w-5 h-5 animate-spin text-primary"}),r.jsx("span",{children:"Assigning you as manager..."})]}),r.jsx("p",{className:"text-center text-sm text-muted-foreground mt-4",children:"You'll be redirected to complete your profile setup in a moment."})]})]})}):r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(We,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(na,{className:"w-10 h-10 text-primary"})}),r.jsx(Xt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(En,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(ct,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:w=>l(w.target.value),onKeyDown:w=>w.key==="Enter"&&y()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is how your brokerage will appear to your agents"})]}),r.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 space-y-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(Kn,{className:"w-4 h-4 text-primary"}),"What you can do as a Brokerage Manager:"]}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Invite agents to join your brokerage"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Track your team's activity and engagement"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(J,{onClick:y,className:"w-full",disabled:a||!o.trim(),children:[a?"Creating...":"Create Brokerage",r.jsx(Ko,{className:"w-4 h-4 ml-2"})]})]})]})})},pke=()=>{const e=ns(),[t,n]=P.useState("verifying"),[s,i]=P.useState("");P.useEffect(()=>{(async()=>{try{const{data:{session:a},error:h}=await ee.auth.getSession();if(h)throw h;if(a!=null&&a.user){const{data:p}=await ee.from("profiles").select("login_count").eq("id",a.user.id).single();if(((p==null?void 0:p.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",a.user.email),n("success");try{await ee.functions.invoke("trial-claim-hook",{body:{userId:a.user.id}})}catch(x){console.log("Trial claim hook (non-critical):",x)}setTimeout(()=>{e("/profile?setup=true")},1500)}else setTimeout(()=>{n("already_claimed")},2e3)}catch(a){console.error("Claim error:",a),n("already_claimed")}})()},[e]);const o=()=>{window.location.href="https://dashboard.relevelup.com/auth"};return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(We,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"space-y-1 text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:[t==="verifying"&&r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),t==="success"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t==="already_claimed"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),t==="error"&&r.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),r.jsxs(Xt,{className:"text-2xl",children:[t==="verifying"&&"Claiming Your Account...",t==="success"&&"Account Claimed!",t==="already_claimed"&&"Account Already Claimed",t==="error"&&"Claim Failed"]}),r.jsxs(En,{children:[t==="verifying"&&"Please wait while we verify your account...",t==="success"&&"Redirecting you to complete your profile...",t==="already_claimed"&&"This account has already been set up. Please log in to access your dashboard.",t==="error"&&s]})]}),(t==="already_claimed"||t==="error")&&r.jsx(Xe,{children:r.jsx(J,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},Aht=()=>{const e=ns(),[t]=Fd(),[n,s]=P.useState(t.get("code")||""),[i,o]=P.useState(""),[l,a]=P.useState(""),[h,p]=P.useState(""),[x,y]=P.useState(!1),[w,j]=P.useState(!1),[S,C]=P.useState(!1),[A,E]=P.useState(!1),[T,O]=P.useState(null),[z,F]=P.useState(null),[q,H]=P.useState(null),[K,Z]=P.useState(null);P.useEffect(()=>{const be=t.get("code");be&&(s(be),re(be))},[t]);const re=async be=>{C(!0);const{data:ne,error:ye}=await ee.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",be.toUpperCase().trim()).single();if(ye||!ne){ze.error("Invalid invite code"),C(!1);return}if(!ne.is_active){ze.error("This invite code is no longer active"),C(!1);return}if(ne.max_uses&&ne.uses_count>=ne.max_uses){ze.error("This invite code has reached its maximum uses"),C(!1);return}if(ne.expires_at&&new Date(ne.expires_at){be.preventDefault(),re(n)},he=async be=>{var ne;if(be.preventDefault(),!h.trim()){ze.error("Please enter your name");return}if(l.length<6){ze.error("Password must be at least 6 characters");return}j(!0);try{const ye=`${window.location.origin}/`,{data:ie,error:fe}=await ee.auth.signUp({email:i.trim(),password:l,options:{emailRedirectTo:ye,data:{name:h.trim()}}});if(fe){fe.message.includes("already registered")?ze.error("This email is already registered. Please sign in instead."):ze.error(fe.message);return}ie.user&&(await ee.rpc("add_default_signup_tag",{user_id:ie.user.id}),z?await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,brokerageId:z}}):K?await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,trialDays:K}}):await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,grandfathered:!0}}),T&&await ee.from("invite_codes").update({uses_count:((ne=(await ee.from("invite_codes").select("uses_count").eq("id",T).single()).data)==null?void 0:ne.uses_count)+1}).eq("id",T),ze.success("Account created! You can now access the dashboard."),e("/dashboard"))}catch(ye){console.error("Signup error:",ye),ze.error("An unexpected error occurred")}finally{j(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(We,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx(Xt,{className:"text-2xl font-bold text-primary",children:q?`Join ${q}`:"Join LevelUp"}),r.jsx(En,{children:A?q?`Create your account to join ${q}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(Xe,{children:A?r.jsxs("form",{onSubmit:he,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Full Name"}),r.jsx(ct,{id:"name",type:"text",placeholder:"John Doe",value:h,onChange:be=>p(be.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"email",children:"Email"}),r.jsx(ct,{id:"email",type:"email",placeholder:"you@example.com",value:i,onChange:be=>o(be.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(ct,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:be=>a(be.target.value),required:!0,minLength:6}),r.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>y(!x),children:x?r.jsx(c1,{className:"h-4 w-4"}):r.jsx(Qo,{className:"h-4 w-4"})})]})]}),r.jsx(J,{type:"submit",className:"w-full",disabled:w,children:w?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:ue,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(ct,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:be=>s(be.target.value),required:!0,autoFocus:!0})]}),r.jsx(J,{type:"submit",className:"w-full",disabled:S,children:S?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},Eht="/assets/testimonial-avatar-1-BsCQFauB.jpg",Iht="/assets/testimonial-avatar-2-B6VPVc2t.jpg",Pht="/assets/testimonial-avatar-3-GuEFwYUE.jpg",Lht="/assets/testimonial-avatar-4-98iKMtkB.jpg",Oht="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",Dht=[Eht,Iht,Pht,Lht,Oht],Rht=d3({name:nc().trim().min(2,"Name must be at least 2 characters").max(100),email:nc().trim().email("Please enter a valid email address").max(255),phone:nc().trim().min(10,"Please enter a valid phone number").max(20).optional().or(Oje("")),brokerage:nc().trim().max(200).optional().or(Oje(""))}),Fht=[{icon:Of,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Ld,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Ys,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Zl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Ai,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Va,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],zht=[{icon:Kn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ss,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:ca,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Gh,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:pl,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:ac,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:oa,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:jg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Bht=[{name:"Sarah M.",role:"Top Producer, RE/MAX",quote:"LevelUp completely transformed how I run my business. The templates alone save me hours every week."},{name:"Mike T.",role:"Brokerage Owner",quote:"Onboarding new agents used to take weeks. Now they're productive from day one with all the training resources."},{name:"Jessica L.",role:"Team Lead",quote:"The community is incredible. I've learned more from other agents here than any conference I've attended."}],$ht=()=>{const e=ns(),[t,n]=P.useState(!1),[s,i]=P.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=P.useState({}),a=async h=>{var x,y;h.preventDefault(),l({});const p=Rht.safeParse(s);if(!p.success){const w={};p.error.errors.forEach(j=>{j.path[0]&&(w[j.path[0]]=j.message)}),l(w);return}n(!0);try{const{data:w,error:j}=await ee.functions.invoke("create-trial-signup",{body:{name:s.name.trim(),email:s.email.trim().toLowerCase(),phone:((x=s.phone)==null?void 0:x.trim())||void 0,brokerage:((y=s.brokerage)==null?void 0:y.trim())||void 0}});if(j){console.error("Trial signup error:",j),ze.error(j.message||"Something went wrong. Please try again.");return}if(w!=null&&w.error){ze.error(w.error);return}ze.success("🎉 Welcome aboard! Check your email to claim your account."),e("/trial/success")}catch(w){console.error("Trial signup error:",w),ze.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Start Your Free 7-Day Trial | LevelUp Dashboard"}),r.jsx("meta",{name:"description",content:"Take LevelUp for a free 7-day test drive. No credit card required. The all-in-one platform for real estate agents and brokerages."}),r.jsx("meta",{property:"og:title",content:"Start Your Free 7-Day Trial | LevelUp"}),r.jsx("meta",{property:"og:description",content:"Take LevelUp for a free 7-day test drive. No credit card required."}),r.jsx("meta",{property:"og:type",content:"website"})]}),r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(J,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var h;return(h=document.getElementById("features"))==null?void 0:h.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(J,{onClick:()=>e("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-8 text-center lg:text-left",children:[r.jsx("div",{className:"flex justify-center lg:justify-start",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-24 md:h-32 drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium",children:[r.jsx(Ss,{className:"h-4 w-4 text-yellow-400"}),r.jsx("span",{children:"7-Day Free Trial • No Credit Card Required"})]}),r.jsxs("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white leading-tight font-sans",children:["Take LevelUp for a"," ",r.jsx("span",{className:"italic",children:"Free Test Drive"})]}),r.jsxs("p",{className:"text-lg md:text-xl text-white/80 max-w-xl mx-auto lg:mx-0 font-sans",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Za,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"No credit card required"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Za,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"Full access to all features"})]})]}),r.jsxs("div",{className:"flex items-center gap-4 justify-center lg:justify-start pt-4",children:[r.jsx("div",{className:"flex -space-x-3",children:Dht.map((h,p)=>r.jsx("img",{src:h,alt:`Agent ${p+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},p))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(h=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},h))}),r.jsx("p",{className:"text-sm text-white/60",children:"Trusted by 3,000+ agents"})]})]})]}),r.jsx("div",{className:"lg:pl-8",children:r.jsx(We,{className:"bg-white shadow-2xl border-0",children:r.jsxs(Xe,{className:"p-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:r.jsx(_g,{className:"h-8 w-8 text-white"})}),r.jsx("h2",{className:"text-2xl font-bold text-foreground font-sans",children:"Start Your Free Trial"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Get instant access • No credit card needed"})]}),r.jsxs("form",{onSubmit:a,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Full Name *"}),r.jsx(ct,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:h=>i({...s,name:h.target.value}),required:!0}),o.name&&r.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"email",children:"Email Address *"}),r.jsx(ct,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:h=>i({...s,email:h.target.value}),required:!0}),o.email&&r.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"phone",children:"Phone Number"}),r.jsx(ct,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:h=>i({...s,phone:h.target.value})}),o.phone&&r.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(ct,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:h=>i({...s,brokerage:h.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(J,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:t,children:t?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(Ko,{className:"ml-2 h-5 w-5"})]})}),r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["By signing up, you agree to our"," ",r.jsx("a",{href:"/terms-of-service",className:"text-[#4a6b6d] hover:underline",children:"Terms"})," ","and"," ",r.jsx("a",{href:"/privacy-policy",className:"text-[#4a6b6d] hover:underline",children:"Privacy Policy"})]})]})]})})})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Fht.map((h,p)=>r.jsxs(We,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Wt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(h.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Xt,{className:"text-xl font-sans",children:h.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:h.description})})]},p))})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Ss,{className:"w-4 h-4"}),"Included with Your Trial"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:zht.map((h,p)=>r.jsxs(We,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(h.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Xt,{className:"text-lg font-semibold text-white",children:h.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:h.description})})]},p))})]})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4 font-sans",children:"Loved by Top Producers"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what agents are saying about LevelUp"})]}),r.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:Bht.map((h,p)=>r.jsx(We,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(Xe,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',h.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:h.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:h.role})]})]})},p))})]})}),r.jsx("section",{className:"py-16 bg-muted/30",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-wrap justify-center gap-8 md:gap-16",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Gf,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Secure & Private"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Bank-level encryption"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(jg,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Fast Setup"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Start in 2 minutes"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Kn,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Expert Support"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Real estate pros"})]})]})]})})}),r.jsx("section",{id:"free-trial",className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs(We,{className:"bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] border-0 shadow-2xl overflow-hidden relative",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs(Xe,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(J,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),size:"lg",className:"h-14 px-8 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 rounded-full",children:["Start Your Free Trial Now",r.jsx(Ko,{className:"ml-2 h-5 w-5"})]})]})]})})}),r.jsx("footer",{className:"bg-[#1e3a4c] py-12",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-6",children:[r.jsx("img",{src:Cge,alt:"LevelUp",className:"h-8"}),r.jsxs("div",{className:"flex gap-6 text-sm text-white/60",children:[r.jsx("a",{href:"/privacy-policy",className:"hover:text-white transition-colors",children:"Privacy Policy"}),r.jsx("a",{href:"/terms-of-service",className:"hover:text-white transition-colors",children:"Terms of Service"})]}),r.jsx("p",{className:"text-sm text-white/40",children:"© 2025 LevelUp Consulting Group. All rights reserved."})]})})})]})]})},Uht=()=>{const e=ns();return r.jsxs(r.Fragment,{children:[r.jsx(np,{children:r.jsx("title",{children:"Welcome to LevelUp! | Check Your Email"})}),r.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(J,{onClick:()=>e("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})}),r.jsxs("section",{className:"relative pt-24 pb-12 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden flex-1 flex items-center",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsx("div",{className:"flex justify-center",children:r.jsx(We,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(Xe,{className:"p-8 md:p-12 text-center",children:[r.jsxs("div",{className:"relative inline-block mb-8",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] flex items-center justify-center",children:r.jsx(Za,{className:"h-12 w-12 text-white"})}),r.jsx("div",{className:"absolute -top-2 -right-2 w-10 h-10 rounded-full bg-yellow-500 flex items-center justify-center animate-bounce",children:r.jsx(Nc,{className:"h-5 w-5 text-white"})})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4 font-sans",children:"You're In! 🎉"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Your 7-day LevelUp adventure starts now!"}),r.jsxs("div",{className:"bg-[#4a6b6d]/10 rounded-xl p-6 mb-8",children:[r.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(Zs,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Check Your Inbox"})]}),r.jsx("p",{className:"text-muted-foreground",children:"We just sent you a magic link to claim your account and set up your password. Click the link in your email to get started!"})]}),r.jsxs("div",{className:"text-left space-y-3 mb-8",children:[r.jsx("p",{className:"text-sm text-muted-foreground font-medium uppercase tracking-wide",children:"What happens next:"}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"1"})}),r.jsx("p",{className:"text-foreground",children:"Check your email for the welcome message"})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"2"})}),r.jsx("p",{className:"text-foreground",children:'Click "Claim Your Account" to set your password'})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"3"})}),r.jsx("p",{className:"text-foreground",children:"Start exploring all the features!"})]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Didn't receive the email? Check your spam folder or"," ",r.jsx("button",{onClick:()=>e("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),r.jsxs(J,{onClick:()=>e("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(Ko,{className:"ml-2 h-4 w-4"})]})]})})})})]}),r.jsx("footer",{className:"bg-[#1e3a4c] py-8",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[r.jsx("img",{src:Cge,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},qht=d3({viewerName:nc().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:nc().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:nc().max(20,"Phone must be less than 20 characters").optional(),message:nc().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Vht({shareToken:e,agentName:t,hasContact:n}){const[s,i]=P.useState(!1),[o,l]=P.useState(!1),[a,h]=P.useState(null),p=dse({resolver:use(qht),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async y=>{i(!0),h(null);try{const{data:w,error:j}=await ee.functions.invoke("video-reply-notify",{body:{shareToken:e,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(j)throw new Error(j.message);if(!(w!=null&&w.success))throw new Error((w==null?void 0:w.error)||"Failed to send reply");l(!0)}catch(w){console.error("Failed to submit reply:",w),h(w.message||"Something went wrong. Please try again.")}finally{i(!1)}};return o?r.jsx(We,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(Xe,{className:"py-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:r.jsx(Za,{className:"h-8 w-8 text-primary"})}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Message Sent!"}),r.jsxs("p",{className:"text-muted-foreground",children:[t?`${t} will`:"They'll"," get back to you soon."]})]})}):r.jsxs(We,{children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Zl,{className:"h-5 w-5 text-primary"}),r.jsx(Xt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(En,{children:n?`Have a question or want to connect? Send ${t||"them"} a message.`:`Interested? Share your info and ${t||"your agent"} will be in touch.`})]}),r.jsx(Xe,{children:r.jsx(hse,{...p,children:r.jsxs("form",{onSubmit:p.handleSubmit(x),className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsx(Ml,{control:p.control,name:"viewerName",render:({field:y})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Your Name *"}),r.jsx(bl,{children:r.jsx(ct,{placeholder:"John Smith",...y})}),r.jsx(bu,{})]})}),r.jsx(Ml,{control:p.control,name:"viewerEmail",render:({field:y})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Email *"}),r.jsx(bl,{children:r.jsx(ct,{type:"email",placeholder:"john@example.com",...y})}),r.jsx(bu,{})]})})]}),!n&&r.jsx(Ml,{control:p.control,name:"viewerPhone",render:({field:y})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Phone (optional)"}),r.jsx(bl,{children:r.jsx(ct,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx(bu,{})]})}),r.jsx(Ml,{control:p.control,name:"message",render:({field:y})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Message *"}),r.jsx(bl,{children:r.jsx(ms,{placeholder:n?"Thanks for the video! I had a question about...":"I'm interested in learning more about...",className:"min-h-[100px] resize-none",...y})}),r.jsx(bu,{})]})}),a&&r.jsx("p",{className:"text-sm text-destructive",children:a}),r.jsx(J,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Hht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsxs("div",{className:"absolute inset-0 opacity-[0.08]",children:[r.jsx("div",{className:"absolute top-0 left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[16%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[32%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[48%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[64%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[80%] left-0 right-0 h-[8%] bg-red-600"})]}),r.jsx("div",{className:"absolute top-0 left-0 w-[35%] h-[45%] bg-blue-900/10 rounded-br-3xl"}),r.jsx(vs,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(vs,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(vs,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(Bx,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Wht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-500/5 via-transparent to-blue-500/5"}),r.jsxs("div",{className:"absolute top-[10%] left-[15%] w-32 h-32",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-red-400/20 animate-ping",style:{animationDuration:"3s"}}),r.jsx(Ss,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 text-red-400/40"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[20%] w-24 h-24",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-blue-400/20 animate-ping",style:{animationDuration:"4s",animationDelay:"1s"}}),r.jsx(vs,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 text-blue-400/40 fill-blue-400/20"})]}),r.jsxs("div",{className:"absolute top-[20%] left-[50%] w-20 h-20",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border border-white/10 animate-ping",style:{animationDuration:"3.5s",animationDelay:"0.5s"}}),r.jsx(Ss,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 text-amber-400/40"})]}),r.jsx(vs,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(vs,{className:"absolute bottom-[15%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse",style:{animationDelay:"0.5s"}}),r.jsx(Bx,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),Ght=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-200/20 via-rose-100/10 to-purple-200/15"}),r.jsx("div",{className:"absolute top-[5%] left-[5%] opacity-20",children:r.jsx(im,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(im,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(im,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(im,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(oa,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(oa,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-300/40 fill-pink-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(oa,{className:"absolute top-[10%] left-[60%] w-4 h-4 text-rose-400/30 fill-rose-400/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx("div",{className:"absolute top-[8%] left-[45%] w-8 h-8 rounded-full bg-pink-300/10 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[30%] w-6 h-6 rounded-full bg-rose-300/10 blur-sm"})]}),Kht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/5 via-slate-800/3 to-indigo-900/5"}),r.jsx("div",{className:"absolute top-[5%] right-[10%] opacity-15",children:r.jsxs("div",{className:"w-12 h-24 relative",children:[r.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-10 h-3 bg-blue-600 rounded-full"}),r.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-[20px] border-r-[20px] border-t-[60px] border-l-transparent border-r-transparent border-t-blue-500"})]})}),r.jsx(Pl,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(vs,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(Pl,{className:"absolute bottom-[20%] right-[8%] w-14 h-14 text-indigo-500/12"}),r.jsx("div",{className:"absolute top-[3%] left-[40%] opacity-12",children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tr-none rotate-6"}),r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tl-none -rotate-6"})]})}),r.jsx(vs,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(vs,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),Zht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-100/20 via-purple-100/15 to-sky-100/20"}),r.jsx("div",{className:"absolute top-[5%] left-[8%] w-12 h-16 rounded-full bg-gradient-to-b from-pink-300/25 to-pink-400/18 rotate-12"}),r.jsx("div",{className:"absolute top-[8%] right-[12%] w-10 h-14 rounded-full bg-gradient-to-b from-purple-300/25 to-purple-400/18 -rotate-6"}),r.jsx("div",{className:"absolute bottom-[18%] left-[15%] w-11 h-15 rounded-full bg-gradient-to-b from-sky-300/20 to-sky-400/12 rotate-6"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-12 h-16 rounded-full bg-gradient-to-b from-yellow-300/20 to-yellow-400/12 -rotate-12"}),r.jsx("div",{className:"absolute top-[10%] left-[10%] w-6 h-1 bg-white/30 rounded-full rotate-12"}),r.jsx("div",{className:"absolute top-[12%] right-[15%] w-5 h-1 bg-white/25 rounded-full -rotate-6"}),r.jsx(im,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(im,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(J4,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),Yht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/12 via-purple-900/8 to-slate-900/12"}),r.jsx(fj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(fj,{className:"absolute top-[10%] right-[12%] w-12 h-12 text-purple-400/20 animate-pulse"}),r.jsxs("div",{className:"absolute bottom-[18%] left-[8%]",children:[r.jsx("div",{className:"w-14 h-12 rounded-full bg-orange-500/20"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-4 bg-green-600/25 rounded-t-full"})]}),r.jsxs("div",{className:"absolute bottom-[22%] right-[12%]",children:[r.jsx("div",{className:"w-12 h-10 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 w-1.5 h-3 bg-green-600/20 rounded-t-full"})]}),r.jsx("div",{className:"absolute top-[15%] left-[40%] opacity-20",children:r.jsx("svg",{viewBox:"0 0 24 12",className:"w-10 h-5 text-slate-800 fill-current",children:r.jsx("path",{d:"M12 6c-2-4-6-6-12-6 4 2 6 4 6 6s-2 4-6 6c6 0 10-2 12-6zm0 0c2-4 6-6 12-6-4 2-6 4-6 6s2 4 6 6c-6 0-10-2-12-6z"})})}),r.jsx(Ss,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Ss,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),Xht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-900/8 via-green-900/5 to-emerald-900/8"}),r.jsx(v1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(v1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(v1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx($0,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx($0,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx($0,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx($0,{className:"absolute top-[8%] left-[70%] w-8 h-8 text-blue-200/20 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[12%] left-[10%] w-5 h-5 rounded-full bg-red-500/25"}),r.jsx("div",{className:"absolute top-[15%] right-[15%] w-4 h-4 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"absolute top-[20%] left-[55%] w-4 h-4 rounded-full bg-green-500/20"}),r.jsx(vs,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),Qht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/10 via-amber-800/6 to-red-900/10"}),r.jsx("div",{className:"absolute top-[5%] left-[10%] w-10 h-8 rounded-full bg-orange-500/25 rotate-45"}),r.jsx("div",{className:"absolute top-[10%] right-[15%] w-8 h-6 rounded-full bg-red-500/20 -rotate-12"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-7 h-5 rounded-full bg-amber-500/22 rotate-30"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-10 h-7 rounded-full bg-yellow-600/18 -rotate-45"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-9 h-6 rounded-full bg-orange-600/15 rotate-12"}),r.jsxs("div",{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2",children:[r.jsx("div",{className:"w-16 h-14 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-5 bg-green-600/18 rounded-t-full"})]}),r.jsx(oa,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(oa,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Jht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-900/8 via-amber-900/4 to-purple-900/8"}),r.jsx(vs,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(vs,{className:"absolute top-[8%] right-[12%] w-10 h-10 text-amber-400/30 fill-amber-400/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(vs,{className:"absolute top-[15%] left-[40%] w-7 h-7 text-yellow-300/25 fill-yellow-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(vs,{className:"absolute top-[12%] right-[35%] w-8 h-8 text-amber-300/28 fill-amber-300/18 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[20%] left-[25%] w-4 h-4 rounded-full bg-pink-400/30"}),r.jsx("div",{className:"absolute top-[18%] right-[30%] w-3 h-3 rounded-full bg-sky-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[60%] w-2.5 h-2.5 rounded-full bg-emerald-400/30"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-3 h-3 rounded-full bg-purple-400/30"}),r.jsx(Ss,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(Nc,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(Nc,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),eft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsxs("div",{className:"absolute bottom-[12%] left-1/2 -translate-x-1/2 flex items-end gap-3",children:[r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2.5 h-20 bg-blue-500/22 rounded-full"})," ",r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"})]}),r.jsx("div",{className:"absolute bottom-[38%] left-[calc(50%-42px)] w-3 h-4 bg-yellow-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[35%] left-[calc(50%-28px)] w-2.5 h-3 bg-yellow-300/25 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[40%] left-[calc(50%-14px)] w-3 h-4 bg-amber-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[45%] left-1/2 -translate-x-1/2 w-4 h-5 bg-yellow-400/35 rounded-full blur-sm"}),r.jsx(vs,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Ss,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Ss,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),tft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/12 via-emerald-900/6 to-teal-900/10"}),r.jsx(Px,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(Px,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(Px,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(Px,{className:"absolute bottom-[22%] right-[10%] w-11 h-11 text-emerald-400/18"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-6 h-6 rounded-full bg-yellow-500/30 border-2 border-yellow-600/25"}),r.jsx("div",{className:"absolute top-[20%] right-[28%] w-5 h-5 rounded-full bg-amber-500/25 border-2 border-amber-600/20"}),r.jsx("div",{className:"absolute bottom-[28%] left-[45%] w-5 h-5 rounded-full bg-yellow-400/25 border-2 border-yellow-500/20"}),r.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 opacity-12 rounded-bl-full overflow-hidden",children:r.jsx("div",{className:"absolute inset-0 bg-gradient-to-bl from-red-400/60 via-yellow-400/60 to-green-400/60"})}),r.jsxs("div",{className:"absolute bottom-[10%] right-[5%] opacity-15",children:[r.jsx("div",{className:"w-12 h-8 bg-slate-700 rounded-b-full"}),r.jsx("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 w-10 h-3 bg-slate-600 rounded-full"}),r.jsxs("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 flex gap-0.5",children:[r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"})]})]})]}),rft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsx("div",{className:"absolute top-[8%] left-[12%] w-16 h-16 rounded-full border-4 border-blue-500/18"}),r.jsx("div",{className:"absolute top-[10%] right-[10%] w-14 h-14 rounded-full border-4 border-indigo-500/15"}),r.jsx("div",{className:"absolute bottom-[18%] left-[18%] w-12 h-12 rounded-full border-3 border-sky-500/12"}),r.jsx(vs,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(vs,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(Pl,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(Pl,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(Bx,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),nft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/6 via-rose-900/6 to-purple-900/6"}),r.jsx(Gh,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-amber-400/18"}),r.jsxs("div",{className:"absolute top-[5%] left-[15%]",children:[r.jsx("div",{className:"w-12 h-14 rounded-full bg-rose-400/25"}),r.jsx("div",{className:"w-0.5 h-10 bg-rose-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[3%] left-[25%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-sky-400/25"}),r.jsx("div",{className:"w-0.5 h-12 bg-sky-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[8%] right-[18%]",children:[r.jsx("div",{className:"w-11 h-13 rounded-full bg-purple-400/25"}),r.jsx("div",{className:"w-0.5 h-9 bg-purple-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[10%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"w-0.5 h-11 bg-amber-400/18 mx-auto"})]}),r.jsx("div",{className:"absolute top-[20%] left-[35%] w-3 h-3 bg-pink-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[18%] right-[40%] w-2.5 h-2.5 bg-emerald-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-2 h-2 bg-amber-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[30%] w-2.5 h-2.5 bg-sky-400/35 rounded-full"}),r.jsx(Nc,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(Va,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),sft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-rose-900/12 via-pink-900/8 to-red-900/12"}),r.jsx(oa,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(oa,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(oa,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(oa,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(oa,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(oa,{className:"absolute top-[20%] right-[35%] w-5 h-5 text-rose-300/35 fill-rose-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(oa,{className:"absolute top-[12%] left-[55%] w-5 h-5 text-red-300/30 fill-red-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(oa,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-400/30 fill-pink-400/15 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[18%] left-[45%] w-8 h-8 rounded-full bg-rose-300/18 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[40%] w-6 h-6 rounded-full bg-pink-300/15 blur-sm"})]}),ift=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsxs("div",{className:"absolute top-[5%] right-[12%]",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-yellow-400/25 blur-sm"}),r.jsx(y1,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-14 h-14 text-amber-400/45"})]}),r.jsx("div",{className:"absolute bottom-[12%] left-[20%] w-20 h-10 bg-slate-800/12 rounded-full blur-md"}),r.jsx(y1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(Ss,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(y1,{className:"absolute bottom-[22%] right-[25%] w-8 h-8 text-orange-400/25"}),r.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[15%] bg-gradient-to-t from-amber-900/10 to-transparent"})]}),aft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-cyan-900/6 to-emerald-900/10"}),r.jsx(fi,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(fi,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(Zh,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(Zh,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(oa,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(oa,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(Ss,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(Nc,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),oft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-900/10 via-teal-900/6 to-cyan-900/10"}),r.jsx(Nc,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(Nc,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(Zh,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(fi,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(Ss,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Ss,{className:"absolute top-[20%] right-[32%] w-7 h-7 text-cyan-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-3 h-3 bg-amber-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-2.5 h-2.5 bg-teal-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[28%] left-[35%] w-2 h-2 bg-emerald-400/30 rounded-full"})]}),lft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsx(Zh,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(Zh,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(Zh,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(fi,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(Nc,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(Ss,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(vs,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),cft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-emerald-900/6 to-green-900/10"}),r.jsx(fi,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-teal-500/22"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-12 h-10 bg-amber-400/18 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[20%] left-[20%] w-10 h-8 bg-orange-400/15 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[16%] right-[15%] w-11 h-9 bg-amber-300/18 rounded-sm"}),r.jsx(Zh,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(oa,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(Ss,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(l1,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),mke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute top-4 left-[10%] w-3 h-3 bg-amber-400/60 rounded-full animate-pulse"}),r.jsx("div",{className:"absolute top-12 right-[15%] w-2 h-2 bg-rose-400/60 rounded-full animate-pulse delay-100"}),r.jsx("div",{className:"absolute top-8 left-[30%] w-2.5 h-2.5 bg-sky-400/60 rounded-full animate-pulse delay-200"}),r.jsx("div",{className:"absolute top-16 right-[25%] w-2 h-2 bg-emerald-400/60 rounded-full animate-pulse delay-300"})]}),dft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(oa,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(oa,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(oa,{className:"absolute top-4 left-[40%] w-2.5 h-2.5 text-rose-400/40 fill-rose-400/20 animate-pulse delay-300"}),r.jsx(oa,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),uft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(l1,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(Ss,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(fi,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),hft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(dj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(dS,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(dj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),zM=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ss,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(Nc,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Ss,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),gke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(fi,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Ss,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(fi,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),Che=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Ss,{className:"h-5 w-5"}),category:"general",headerText:()=>"Video Message",subText:"A personal video just for you",gradientClasses:"from-background to-muted/30",accentColor:"primary"},{id:"thank_you",name:"Thank You",description:"Express your gratitude",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thank You, ${e}!`:"Thank You!",subText:"Your support means the world to me",gradientClasses:"from-rose-50/70 via-pink-50/50 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(dft,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(MT,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thinking of You, ${e}`:"Thinking of You",subText:"Just wanted to reach out and say hello",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(zM,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(dj,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Hey ${e}!`:"Hey There!",subText:"Just checking in to see how you're doing",gradientClasses:"from-amber-50/70 via-orange-50/50 to-yellow-50/40 dark:from-amber-950/30 dark:via-orange-950/20 dark:to-yellow-950/20",accentColor:"amber",decorativeElement:r.jsx(hft,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(ac,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Market Update for ${e}`:"Market Update",subText:"The latest insights from your local market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue"},{id:"referral_thank_you",name:"Referral Thank You",description:"Thank someone for a referral",icon:r.jsx(Kn,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thank You for the Referral, ${e}!`:"Thank You for the Referral!",subText:"Your trust in me means everything",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx(zM,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"So proud of your accomplishment",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(mke,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(pl,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Welcome to the Neighborhood, ${e}!`:"Welcome to the Neighborhood!",subText:"So excited to have you as our new neighbor",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-sky-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-sky-950/20",accentColor:"teal",decorativeElement:r.jsx(gke,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(dS,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Hey ${e}!`:"Hey There!",subText:"No reason needed – just wanted to connect",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx(zM,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(Gh,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Birthday, ${e}!`:"Happy Birthday!",subText:"Wishing you an amazing year ahead",gradientClasses:"from-amber-50/80 via-rose-50/60 to-purple-50/40 dark:from-amber-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"amber",decorativeElement:r.jsx(nft,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Valentine's Day, ${e}!`:"Happy Valentine's Day!",subText:"A heartfelt message from your real estate professional",gradientClasses:"from-rose-50/80 via-pink-50/60 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(sft,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(y1,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Groundhog Day, ${e}!`:"Happy Groundhog Day!",subText:"Wishing you an early spring!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(ift,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(vs,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy New Year, ${e}!`:"Happy New Year!",subText:"Wishing you a year full of success and happiness",gradientClasses:"from-yellow-50/70 via-amber-50/50 to-orange-50/40 dark:from-yellow-950/30 dark:via-amber-950/20 dark:to-orange-950/20",accentColor:"yellow",decorativeElement:r.jsx(Jht,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(J4,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Easter, ${e}!`:"Happy Easter!",subText:"Wishing you a joyful celebration",gradientClasses:"from-pink-50/70 via-purple-50/50 to-sky-50/40 dark:from-pink-950/30 dark:via-purple-950/20 dark:to-sky-950/20",accentColor:"pink",decorativeElement:r.jsx(Zht,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(im,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Mother's Day, ${e}!`:"Happy Mother's Day!",subText:"Celebrating the wonderful mothers in our lives",gradientClasses:"from-pink-50/70 via-rose-50/50 to-purple-50/40 dark:from-pink-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"pink",decorativeElement:r.jsx(Ght,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Father's Day, ${e}!`:"Happy Father's Day!",subText:"Celebrating the wonderful fathers in our lives",gradientClasses:"from-blue-50/70 via-sky-50/50 to-indigo-50/40 dark:from-blue-950/30 dark:via-sky-950/20 dark:to-indigo-950/20",accentColor:"blue",decorativeElement:r.jsx(Kht,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(Bx,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Memorial Day, ${e}`:"Happy Memorial Day",subText:"Honoring those who served our country",gradientClasses:"from-red-50/60 via-white to-blue-50/60 dark:from-red-950/30 dark:via-slate-950/20 dark:to-blue-950/30",accentColor:"blue",decorativeElement:r.jsx(Hht,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(Kh,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy 4th of July, ${e}!`:"Happy 4th of July!",subText:"Celebrating freedom and independence",gradientClasses:"from-red-50/70 via-white to-blue-50/70 dark:from-red-950/30 dark:via-slate-950/10 dark:to-blue-950/30",accentColor:"red",decorativeElement:r.jsx(Wht,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Labor Day, ${e}!`:"Happy Labor Day!",subText:"Celebrating the hard work that builds our communities",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(rft,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(fj,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Halloween, ${e}!`:"Happy Halloween!",subText:"Have a spooktacular day!",gradientClasses:"from-orange-50/70 via-amber-50/50 to-purple-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-purple-950/30",accentColor:"orange",decorativeElement:r.jsx(Yht,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Thanksgiving, ${e}!`:"Happy Thanksgiving!",subText:"Grateful for you and your friendship",gradientClasses:"from-orange-50/70 via-amber-50/50 to-red-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-red-950/20",accentColor:"orange",decorativeElement:r.jsx(Qht,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(v1,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Merry Christmas, ${e}!`:"Merry Christmas!",subText:"Wishing you joy and peace this holiday season",gradientClasses:"from-red-50/70 via-green-50/40 to-emerald-50/40 dark:from-red-950/30 dark:via-green-950/20 dark:to-emerald-950/20",accentColor:"red",decorativeElement:r.jsx(Xht,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Ss,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Hanukkah, ${e}!`:"Happy Hanukkah!",subText:"Wishing you eight nights of light and joy",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(eft,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(Px,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy St. Patrick's Day, ${e}!`:"Happy St. Patrick's Day!",subText:"Wishing you the luck of the Irish!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(tft,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(fi,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Happy Home Anniversary, ${e}!`:"Happy Home Anniversary!",subText:"Celebrating another year in your beautiful home",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-emerald-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-emerald-950/20",accentColor:"teal",decorativeElement:r.jsx(aft,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(Nc,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"You're under contract – exciting times ahead!",gradientClasses:"from-emerald-50/70 via-teal-50/50 to-cyan-50/40 dark:from-emerald-950/30 dark:via-teal-950/20 dark:to-cyan-950/20",accentColor:"emerald",decorativeElement:r.jsx(oft,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(Ys,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Exciting News, ${e}!`:"Just Listed!",subText:"A new property is now on the market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-violet-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-violet-950/20",accentColor:"blue",decorativeElement:r.jsx(gke,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(ud,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Just Sold!",subText:"Another successful transaction completed",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx(zM,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(_1,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Great News, ${e}!`:"Price Reduced!",subText:"This property just became more affordable",gradientClasses:"from-orange-50/70 via-amber-50/50 to-yellow-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-yellow-950/20",accentColor:"orange"},{id:"open_house",name:"Open House",description:"Invite to an open house event",icon:r.jsx(l1,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`You're Invited, ${e}!`:"You're Invited!",subText:"Join us for an exclusive open house",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx(uft,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(Zh,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"It's official – the keys are yours!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(lft,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(fi,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Welcome Home, ${e}!`:"Welcome Home!",subText:"Wishing you all the best in your new home",gradientClasses:"from-teal-50/70 via-emerald-50/50 to-green-50/40 dark:from-teal-950/30 dark:via-emerald-950/20 dark:to-green-950/20",accentColor:"teal",decorativeElement:r.jsx(cft,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(Od,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Amazing News, ${e}!`:"Offer Accepted!",subText:"Your offer has been accepted – congratulations!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(zM,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"You're pre-approved and ready to find your dream home",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(mke,{})}],fft=[{id:"general",name:"General Touch",description:"Everyday connection templates"},{id:"holidays",name:"Holidays",description:"Seasonal and holiday greetings"},{id:"transactional",name:"Transactional",description:"Real estate milestone templates"}];function pft(e){return Che.filter(t=>t.category===e)}function CS(e){return Che.find(t=>t.id===e)||Che[0]}function mft(){const{shareToken:e}=Wc(),[t,n]=P.useState(null),[s,i]=P.useState(null),[o,l]=P.useState(null),[a,h]=P.useState(!0),[p,x]=P.useState(null),[y,w]=P.useState(!0);P.useEffect(()=>{const q=()=>{['[id*="lc_text_widget"]','[class*="lc-text-widget"]','[id*="chat-widget"]','[class*="chat-widget"]','iframe[src*="widgets.leadconnectorhq"]','iframe[src*="msgsndr"]',"[data-chat-widget]"].forEach(re=>{document.querySelectorAll(re).forEach(ue=>{ue.style.display="none"})})};q();const H=[setTimeout(q,500),setTimeout(q,1500),setTimeout(q,3e3)],K=new MutationObserver(q);return K.observe(document.body,{childList:!0,subtree:!0}),()=>{H.forEach(clearTimeout),K.disconnect()}},[]),P.useEffect(()=>{(async()=>{if(!e){x("Invalid share link"),h(!1);return}const{data:H,error:K}=await ee.from("agent_videos").select("id, title, playback_url, thumbnail_url, preview_url, duration_seconds, share_token, owner_user_id, contact_id, page_template, recipient_name").eq("share_token",e).eq("is_deleted",!1).single();if(K||!H){x("Video not found or has been removed"),h(!1);return}n(H);try{await ee.rpc("log_video_view",{p_video_id:H.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(Z){console.warn("Failed to log video view:",Z)}if(H.owner_user_id){const{data:Z}=await ee.from("profiles").select("id, name, email, phone").eq("id",H.owner_user_id).single();if(Z){i(Z);try{const{data:re}=await ee.storage.from("avatars").list(`${H.owner_user_id}`);if(re&&re.length>0){const{data:ue}=ee.storage.from("avatars").getPublicUrl(`${H.owner_user_id}/${re[0].name}`);l(ue.publicUrl)}}catch{}}}h(!1)})()},[e]);const j=q=>{if(!q)return"0:00";const H=Math.floor(q/60),K=q%60;return`${H}:${K.toString().padStart(2,"0")}`},S=q=>q.includes("iframe.mediadelivery.net/play/")?q.replace("/play/","/embed/")+"?autoplay=true&responsive=true":q,C=q=>{if(!q)return"?";const H=q.split(" ");return H.length>=2?`${H[0][0]}${H[1][0]}`.toUpperCase():q.substring(0,2).toUpperCase()},A=CS((t==null?void 0:t.page_template)||"default"),E=(t==null?void 0:t.recipient_name)||null,T=A.headerText(E),z=`https://dashboard.relevelup.com/share/video/${e}`;if(a)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-primary"})});if(p||!t)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(We,{className:"max-w-md w-full",children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Video Not Found"}),r.jsx("p",{className:"text-muted-foreground",children:p||"This video is no longer available."})]})})});const F=A.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:T}),r.jsx("meta",{name:"description",content:A.subText}),r.jsx("meta",{property:"og:title",content:T}),r.jsx("meta",{property:"og:description",content:A.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:z}),t.preview_url&&r.jsx("meta",{property:"og:image",content:t.preview_url}),!t.preview_url&&t.thumbnail_url&&r.jsx("meta",{property:"og:image",content:t.thumbnail_url}),t.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{property:"og:video",content:t.playback_url}),r.jsx("meta",{property:"og:video:type",content:"text/html"}),r.jsx("meta",{property:"og:video:width",content:"1280"}),r.jsx("meta",{property:"og:video:height",content:"720"})]}),r.jsx("meta",{name:"twitter:card",content:"player"}),r.jsx("meta",{name:"twitter:title",content:T}),r.jsx("meta",{name:"twitter:description",content:A.subText}),t.preview_url&&r.jsx("meta",{name:"twitter:image",content:t.preview_url}),t.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{name:"twitter:player",content:t.playback_url}),r.jsx("meta",{name:"twitter:player:width",content:"1280"}),r.jsx("meta",{name:"twitter:player:height",content:"720"})]})]}),r.jsxs("div",{className:$t("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",A.gradientClasses),children:[F&&A.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[F&&r.jsxs("div",{className:"text-center py-4 animate-fade-in",children:[r.jsx("div",{className:"flex justify-center mb-3",children:r.jsx("div",{className:$t("w-14 h-14 rounded-full flex items-center justify-center shadow-sm",A.accentColor==="primary"&&"bg-primary/10 text-primary",A.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",A.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",A.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",A.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",A.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",A.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",A.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",A.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",A.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",A.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",A.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",A.accentColor==="sky"&&"bg-sky-100 text-sky-600 dark:bg-sky-900/50 dark:text-sky-400"),children:r.jsx("div",{className:"scale-150",children:A.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:T}),r.jsx("p",{className:"text-muted-foreground",children:A.subText})]}),s&&r.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card/90 backdrop-blur-sm rounded-lg border shadow-sm",children:[r.jsxs(ci,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Wa,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(di,{className:"bg-primary/10 text-primary font-semibold",children:C(s.name)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:F?"A special video from":"A personal video from"}),r.jsx("h2",{className:"text-lg font-semibold truncate",children:s.name||"Your Agent"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Real Estate Professional"})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[s.phone&&r.jsx(J,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`tel:${s.phone}`,"aria-label":"Call agent",children:r.jsx(ca,{className:"h-4 w-4"})})}),s.email&&r.jsx(J,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`mailto:${s.email}`,"aria-label":"Email agent",children:r.jsx(Zs,{className:"h-4 w-4"})})})]})]}),r.jsx(We,{className:"overflow-hidden shadow-lg",children:y&&t.playback_url?r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:r.jsx("iframe",{src:S(t.playback_url),title:t.title||"Video message",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>w(!0),children:[t.preview_url||t.thumbnail_url?r.jsx("img",{src:t.preview_url||t.thumbnail_url||"",alt:t.title?`${t.title} video preview`:"Video message preview",className:"w-full h-full object-cover",onError:q=>{var K;q.currentTarget.style.display="none";const H=(K=q.currentTarget.parentElement)==null?void 0:K.querySelector(".video-fallback");H&&(H.style.display="flex")}}):null,r.jsx("div",{className:"video-fallback w-full h-full items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",style:{display:t.preview_url||t.thumbnail_url?"none":"flex"},children:r.jsx(Fi,{className:"h-16 w-16 text-primary/50"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 group-hover:bg-black/40 transition-colors",children:r.jsx("div",{className:"w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-lg transform group-hover:scale-105 transition-transform",children:r.jsx(Sc,{className:"h-10 w-10 text-primary ml-1"})})}),t.duration_seconds&&r.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 text-white text-sm px-2 py-1 rounded",children:j(t.duration_seconds)})]})}),!F&&r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold",children:t.title||"Video Message"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:y?"Enjoy the video!":"Click to play the video"})]}),!y&&r.jsx("div",{className:"flex justify-center",children:r.jsxs(J,{size:"lg",onClick:()=>w(!0),className:"gap-2",children:[r.jsx(Sc,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Vht,{shareToken:e,agentName:(s==null?void 0:s.name)||null,hasContact:!!t.contact_id})]})]})]})}function gft(){return P.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(WJe,{})}function xft(){const{token:e}=Wc();return P.useEffect(()=>{if(!e)return;const t=`https://relzejiswnotikjgvjhz.supabase.co/functions/v1/video-og-image?token=${e}`;window.location.replace(t)},[e]),r.jsx("main",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[r.jsx(nn,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const yft={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},vft={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},n4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function _ft(){var ne,ye,ie,fe;const{slugOrId:e}=Wc(),[t]=Fd(),{data:n,isLoading:s}=l6e(e||""),i=c6e(),o=Jst(),l=t.get("ref"),[a,h]=P.useState(""),[p,x]=P.useState(""),[y,w]=P.useState(""),[j,S]=P.useState(""),[C,A]=P.useState(!1),[E,T]=P.useState(!1),[O,z]=P.useState(null),[F,q]=P.useState(!1);P.useEffect(()=>{l&&o.mutate(l)},[l]);const H=de=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(de),K=async de=>{if(de.preventDefault(),!(!a.trim()||!y.trim()||!n)){A(!0);try{await i.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:a.trim(),lastName:p.trim(),email:y.trim(),phone:j.trim(),shareToken:l}),T(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(_e){console.error("Lead submission error:",_e),ze.error(`Failed to submit: ${_e.message||"Please try again"}`)}finally{A(!1)}}},Z=(n==null?void 0:n.photos)||[],re=Z.find(de=>de.is_primary)||Z[0],ue=()=>{O!==null&&z(O===0?Z.length-1:O-1)},he=()=>{O!==null&&z(O===Z.length-1?0:O+1)};if(s)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Pr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Pr,{className:"h-10 w-48 mb-6"}),r.jsx(Pr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Pr,{className:"h-12 w-48"}),r.jsx(Pr,{className:"h-6 w-full"}),r.jsx(Pr,{className:"h-6 w-3/4"})]}),r.jsx(Pr,{className:"h-64"})]})]})]});if(!n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:QA,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(fi,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(J,{asChild:!0,children:r.jsx(co,{to:"/public/listings",children:"Browse All Listings"})})]})]});const be=n.property_address?`${n.property_address} - ${n.city}, ${n.state}`:`${n.city}, ${n.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[be," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${n4[n.property_type]} in ${n.city}, ${n.state}. ${((ne=n.description)==null?void 0:ne.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:be}),r.jsx("meta",{property:"og:description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n4[n.property_type]} in ${n.city}, ${n.state}. View photos, details, and contact the listing agent.`}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:`https://listings.relevelup.com/${n.slug||n.id}`}),re&&r.jsx("meta",{property:"og:image",content:re.photo_url}),re&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${n4[n.property_type]} for sale`}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:be}),r.jsx("meta",{name:"twitter:description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),re&&r.jsx("meta",{name:"twitter:image",content:re.photo_url}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"geo.region",content:`US-${n.state}`}),r.jsx("meta",{name:"geo.placename",content:n.city}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:n.property_address||`${n.city}, ${n.state} Home`,description:n.description||`${n4[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:Z.map(de=>de.photo_url),address:{"@type":"PostalAddress",streetAddress:n.property_address||void 0,addressLocality:n.city,addressRegion:n.state,addressCountry:"US"},geo:n.neighborhood?{"@type":"GeoCoordinates",name:n.neighborhood}:void 0,offers:{"@type":"Offer",price:n.price,priceCurrency:"USD",availability:n.status==="sold"?"https://schema.org/SoldOut":n.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:n.bedrooms||void 0,numberOfBathroomsTotal:n.bathrooms||void 0,floorSize:n.square_footage?{"@type":"QuantitativeValue",value:n.square_footage,unitCode:"FTK"}:void 0,yearBuilt:n.year_built||void 0,broker:n.agent?{"@type":"RealEstateAgent",name:n.agent.name,email:n.agent.email,worksFor:(ye=n.agent.brokerage)!=null&&ye.name?{"@type":"RealEstateAgent",name:n.agent.brokerage.name}:void 0}:void 0})})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:QA,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(co,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),Z.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>z(0),children:r.jsx("img",{src:re==null?void 0:re.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${n4[n.property_type]} main photo`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:Z.slice(1,5).map((de,_e)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>z(_e+1),children:[r.jsx("img",{src:de.photo_url,alt:`${n.property_address||n.city} - Photo ${_e+2} of ${Z.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),_e===3&&Z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",Z.length-5," more"]})]},de.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Ft,{className:`${yft[n.status]} text-white border-0`,children:vft[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:H(n.price)}),n.property_address&&r.jsx("p",{className:"text-xl font-medium",children:n.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(pl,{className:"h-4 w-4"}),n.city,", ",n.state,n.neighborhood&&` • ${n.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[n.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Vf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),n.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(qf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),n.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(xm,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),n.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(Ys,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ft,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),n4[n.property_type]]}),n.lot_size&&r.jsxs(Ft,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Ft,{variant:"secondary",children:"HOA"})]}),n.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})]}),n.agent_notes&&n.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.agent_notes})]}),n.mls_link&&r.jsx(J,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[n.video&&n.video.playback_url&&r.jsx(We,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(Xe,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>q(!0),children:[n.video.thumbnail_url?r.jsx("img",{src:n.video.thumbnail_url,alt:"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/30",children:r.jsx(Fi,{className:"h-12 w-12 text-primary"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 group-hover:bg-black/40 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"h-16 w-16 rounded-full bg-white/90 group-hover:bg-white flex items-center justify-center transition-colors shadow-lg",children:r.jsx(Sc,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(J,{onClick:()=>q(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(Sc,{className:"h-4 w-4"}),"Watch Video Tour"]}),n.video.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate",children:n.video.title})]})]})}),n.agent&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Cc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((ie=n.agent.brokerage)==null?void 0:ie.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(We,{className:"border-primary",children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Xe,{children:E?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(Zs,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:K,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"firstName",children:"First Name *"}),r.jsx(ct,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:de=>h(de.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"lastName",children:"Last Name"}),r.jsx(ct,{id:"lastName",type:"text",placeholder:"Doe",value:p,onChange:de=>x(de.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"email",children:"Email *"}),r.jsx(ct,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:de=>w(de.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"phone",children:"Phone"}),r.jsx(ct,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:j,onChange:de=>S(de.target.value)})]}),r.jsx(J,{type:"submit",className:"w-full",disabled:C,children:C?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Br,{open:O!==null,onOpenChange:()=>z(null),children:r.jsxs(Fr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Hr,{className:"sr-only",children:r.jsx(qr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>z(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ts,{className:"h-5 w-5"})}),O!==null&&Z[O]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Z[O].photo_url,alt:`Photo ${O+1}`,className:"w-full max-h-[80vh] object-contain"}),Z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:ue,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:he,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ga,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[O+1," / ",Z.length]})]})]})]})}),r.jsx(Br,{open:F,onOpenChange:q,children:r.jsxs(Fr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(Hr,{className:"sr-only",children:r.jsx(qr,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>q(!1),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ts,{className:"h-5 w-5"})}),((fe=n==null?void 0:n.video)==null?void 0:fe.playback_url)&&r.jsx("div",{className:"aspect-video w-full",children:r.jsx("iframe",{src:n.video.playback_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function bft(){var o;const{slug:e}=Wc(),{data:t,isLoading:n,error:s}=f6e(e);if(P.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),P.useEffect(()=>{t!=null&&t.id&&Sa(t.id,"card_view")},[t==null?void 0:t.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Pr,{className:"h-28 w-28 rounded-full"}),r.jsx(Pr,{className:"h-6 w-48"}),r.jsx(Pr,{className:"h-4 w-36"})]}),r.jsx(Pr,{className:"h-12 w-full"}),r.jsx(Pr,{className:"h-12 w-full"})]})});if(s||!t)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const i=((o=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[i," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.positioning_statement||`Connect with ${i}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${i} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:t.positioning_statement||`Connect with ${i}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(M6e,{card:t})]})}function BM({banners:e,autoPlayInterval:t=5e3,className:n}){const[s,i]=P.useState(0),[o,l]=P.useState(!1),a=P.useCallback(()=>{i(y=>(y+1)%e.length)},[e.length]),h=P.useCallback(()=>{i(y=>(y-1+e.length)%e.length)},[e.length]),p=P.useCallback(y=>{i(y)},[]);if(P.useEffect(()=>{if(e.length<=1||o)return;const y=setInterval(a,t);return()=>clearInterval(y)},[e.length,o,t,a]),!e||e.length===0)return null;const x=e[s];return r.jsxs("div",{className:$t("relative w-full overflow-hidden rounded-xl",n),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[r.jsxs("div",{className:"relative aspect-[21/9] md:aspect-[3/1] w-full",children:[r.jsxs("div",{className:"absolute inset-0 transition-opacity duration-500",children:[r.jsx("img",{src:x.image_url,alt:x.title,className:"w-full h-full object-cover"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent"})]}),r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-8 text-white",children:[r.jsx("h2",{className:"text-xl md:text-3xl font-bold mb-2 drop-shadow-lg",children:x.title}),x.description&&r.jsx("p",{className:"text-sm md:text-base text-white/90 mb-4 max-w-2xl drop-shadow",children:x.description}),x.link_url&&r.jsx("a",{href:x.link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:r.jsx(J,{variant:"secondary",className:"bg-white/90 hover:bg-white text-foreground font-semibold",children:x.link_text||"Learn More"})})]}),e.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"ghost",size:"icon",className:$t("absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:h,children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx(J,{variant:"ghost",size:"icon",className:$t("absolute right-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:a,children:r.jsx(Ga,{className:"h-6 w-6"})})]})]}),e.length>1&&r.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex gap-2",children:e.map((y,w)=>r.jsx("button",{onClick:()=>p(w),className:$t("w-2 h-2 rounded-full transition-all duration-300",w===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${w+1}`},w))})]})}function wft(e){return"EST"}function xte(e){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(e),s=wft();return`${n} ${s}`}function MS(e){const t=new Date,n=new Date(e),s=uct(n,-15),i=vhe(n,1);return t>i?"ended":ike(t,{start:n,end:i})?"live":ike(t,{start:s,end:n})?"starting_soon":"upcoming"}function xxe(e){const t=MS(e);return t==="starting_soon"||t==="live"}const xke=xxe,jft=({events:e,registrations:t,onNavigateToEvents:n})=>{const[s,i]=P.useState(new Date);P.useEffect(()=>{const j=setInterval(()=>{i(new Date)},3e4);return()=>clearInterval(j)},[]);const o=e.filter(j=>xxe(j.event_date));if(o.length===0)return null;const l=o[0],a=MS(l.event_date),h=t.find(j=>j.event_id===l.id),p=(h==null?void 0:h.zoom_join_url)||l.zoom_link,x=!!h,y=a==="live",w=y?{container:"from-red-500/10 via-red-500/5 to-primary/10 border-red-500/30",pulse:"from-red-500/5",indicator:"bg-red-500",text:"text-red-500",button:"bg-red-500 hover:bg-red-600",outlineButton:"border-red-500/50 text-red-500 hover:bg-red-500/10"}:{container:"from-amber-500/10 via-amber-500/5 to-primary/10 border-amber-500/30",pulse:"from-amber-500/5",indicator:"bg-amber-500",text:"text-amber-500",button:"bg-amber-500 hover:bg-amber-600",outlineButton:"border-amber-500/50 text-amber-500 hover:bg-amber-500/10"};return r.jsxs("div",{className:`relative mb-8 overflow-hidden rounded-xl bg-gradient-to-r ${w.container} border`,children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${w.pulse} to-transparent animate-pulse`}),r.jsx("div",{className:"relative p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex items-center justify-center",children:[r.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${w.indicator} opacity-75`}),r.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${w.indicator}`})]}),r.jsx("div",{className:`flex items-center gap-2 ${w.text} font-bold text-sm uppercase tracking-wider`,children:y?r.jsxs(r.Fragment,{children:[r.jsx(yj,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ki,{className:"h-4 w-4"}),"Starting Soon"]})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg text-foreground line-clamp-1",children:l.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:y?`Started at ${xte(new Date(l.event_date))}`:`Starts at ${xte(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(J,{onClick:()=>window.open(p,"_blank"),className:`${w.button} text-white gap-2`,children:[r.jsx(Ls,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(J,{variant:"outline",onClick:n,className:`${w.outlineButton} gap-2`,children:[r.jsx(Kn,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var yxe="Progress",vxe=100,[kft]=Ql(yxe),[Nft,Sft]=kft(yxe),lOe=P.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:i,getValueLabel:o=Cft,...l}=e;(i||i===0)&&!yke(i)&&console.error(Mft(`${i}`,"Progress"));const a=yke(i)?i:vxe;s!==null&&!vke(s,a)&&console.error(Tft(`${s}`,"Progress"));const h=vke(s,a)?s:null,p=yte(h)?o(h,a):void 0;return r.jsx(Nft,{scope:n,value:h,max:a,children:r.jsx(Rn.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":yte(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":uOe(h,a),"data-value":h??void 0,"data-max":a,...l,ref:t})})});lOe.displayName=yxe;var cOe="ProgressIndicator",dOe=P.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,i=Sft(cOe,n);return r.jsx(Rn.div,{"data-state":uOe(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...s,ref:t})});dOe.displayName=cOe;function Cft(e,t){return`${Math.round(e/t*100)}%`}function uOe(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function yte(e){return typeof e=="number"}function yke(e){return yte(e)&&!isNaN(e)&&e>0}function vke(e,t){return yte(e)&&!isNaN(e)&&e<=t&&e>=0}function Mft(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${vxe}\`.`}function Tft(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${vxe} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var hOe=lOe,Aft=dOe;const Hc=P.forwardRef(({className:e,value:t,...n},s)=>r.jsx(hOe,{ref:s,className:$t("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:r.jsx(Aft,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Hc.displayName=hOe.displayName;function Eft(){const{user:e,isBrokerageManager:t}=zr(),[n,s]=P.useState([]),[i,o]=P.useState([]),[l,a]=P.useState(!1),[h,p]=P.useState(!0),x=t?"brokerage_manager":"agent";P.useEffect(()=>{if(!(e!=null&&e.id)){p(!1);return}y()},[e==null?void 0:e.id,x]);const y=async()=>{if(e!=null&&e.id)try{const{data:z,error:F}=await ee.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(F)throw F;const{data:q,error:H}=await ee.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",e.id);if(H)throw H;const{data:K,error:Z}=await ee.from("onboarding_checklist_dismissed").select("id").eq("user_id",e.id).maybeSingle();if(Z)throw Z;s(z||[]),o(q||[]),a(!!K),z&&z.length>0&&await w(z,q||[])}catch(z){console.error("Error fetching checklist data:",z)}finally{p(!1)}},w=async(z,F)=>{var Ie,Ke;if(!(e!=null&&e.id))return;const q=F.map(Re=>Re.item_id),H=z.filter(Re=>!q.includes(Re.id));if(H.length===0)return;const[K,Z,re,ue,he,be,ne,ye,ie,fe,de,_e,Ee,ke]=await Promise.all([ee.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle(),ee.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",e.id),ee.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",e.id),ee.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",e.id),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","template"),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","academy_video"),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","toolbox"),ee.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id),ee.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),ee.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),ee.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),ee.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),ee.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",e.id),ee.from("innercircle_contacts").select("id").eq("owner_user_id",e.id)]),pe={},ae=(Ie=K.data)==null?void 0:Ie.brokerage_id;pe.share_resource=(Z.count||0)>0,pe.post_community=(re.count||0)>0,pe.register_event=(ue.count||0)>0,pe.view_template=(he.count||0)>0,pe.watch_academy=(be.count||0)>0,pe.use_toolbox=(ne.count||0)>0,pe.launch_app=(ye.count||0)>0,pe.add_contact=(ie.count||0)>0,pe.create_video=(fe.count||0)>0,pe.complete_touch=(de.count||0)>0,pe.add_transaction=(_e.count||0)>0,pe.add_listing=(Ee.count||0)>0;const ge=((Ke=ke.data)==null?void 0:Ke.map(Re=>Re.id))||[],Me=[];ae?Me.push(ee.from("profiles").select("id").eq("brokerage_id",ae).neq("id",e.id).then(Re=>{var Ce;pe.add_agent=(((Ce=Re.data)==null?void 0:Ce.length)||0)>0})):pe.add_agent=!1,ge.length>0?(Me.push(ee.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",ge).then(Re=>{pe.add_plan=(Re.count||0)>0})),Me.push(ee.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",ge).then(Re=>{pe.schedule_popby=(Re.count||0)>0}))):(pe.add_plan=!1,pe.schedule_popby=!1),await Promise.all(Me);const Ue=H.filter(Re=>pe[Re.action_type]);if(Ue.length>0){const Re=Ue.map(Je=>({user_id:e.id,item_id:Je.id})),{error:Ce}=await ee.from("onboarding_checklist_progress").upsert(Re,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!Ce){const Je=Ue.map(Te=>({item_id:Te.id,completed_at:new Date().toISOString()}));o(Te=>[...Te,...Je])}}},j=async z=>{if(e!=null&&e.id)try{const{error:F}=await ee.from("onboarding_checklist_progress").insert({user_id:e.id,item_id:z});if(F)throw F;o(q=>[...q,{item_id:z,completed_at:new Date().toISOString()}])}catch(F){console.error("Error marking item complete:",F)}},S=async()=>{if(e!=null&&e.id)try{const{error:z}=await ee.from("onboarding_checklist_dismissed").insert({user_id:e.id});if(z)throw z;a(!0)}catch(z){console.error("Error dismissing checklist:",z)}},C=i.length,A=n.length,E=A>0&&C>=A,T=A>0?C/A*100:0;return{items:n,progress:i,isDismissed:l,loading:h,completedCount:C,totalCount:A,isComplete:E,progressPercentage:T,isItemComplete:z=>i.some(F=>F.item_id===z),markComplete:j,dismiss:S,refetch:y}}const Ift={add_agent:r.jsx(Kn,{className:"h-4 w-4"}),share_resource:r.jsx(dc,{className:"h-4 w-4"}),post_community:r.jsx(Po,{className:"h-4 w-4"}),register_event:r.jsx(Ys,{className:"h-4 w-4"}),view_template:r.jsx(h0,{className:"h-4 w-4"}),watch_academy:r.jsx(h1,{className:"h-4 w-4"}),use_toolbox:r.jsx(Gx,{className:"h-4 w-4"}),launch_app:r.jsx(ST,{className:"h-4 w-4"})};function Pft(){const{items:e,isDismissed:t,loading:n,completedCount:s,totalCount:i,isComplete:o,progressPercentage:l,isItemComplete:a,markComplete:h,dismiss:p}=Eft(),[x,y]=P.useState(!0);return n||t||i===0||o?null:r.jsxs(We,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(_g,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Get Started with LevelUp"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Complete these steps to make the most of your membership"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>y(!x),className:"h-8 w-8 p-0",children:x?r.jsx(i1,{className:"h-4 w-4"}):r.jsx(Iu,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(Ts,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Progress"}),r.jsxs("span",{className:"font-medium",children:[s," of ",i," complete"]})]}),r.jsx(Hc,{value:l,className:"h-2"})]})]}),x&&r.jsx(Xe,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:e.map(w=>{const j=a(w.id);return r.jsxs("div",{className:$t("flex items-start gap-3 p-3 rounded-lg transition-colors",j?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>!j&&h(w.id),children:[r.jsx("div",{className:"mt-0.5",children:j?r.jsx(Za,{className:"h-5 w-5 text-primary"}):r.jsx(Pu,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:Ift[w.action_type]||r.jsx(Pu,{className:"h-4 w-4"})}),r.jsx("span",{className:$t("font-medium",j&&"line-through text-muted-foreground"),children:w.title})]}),w.description&&r.jsx("p",{className:$t("text-sm text-muted-foreground mt-1",j&&"line-through"),children:w.description})]})]},w.id)})})})]})}const Bg=()=>Jt({queryKey:["relationship-types"],queryFn:async()=>{const{data:e,error:t}=await ee.from("relationship_types").select("*").order("sort_order");if(t)throw t;return e}}),op=e=>{const{user:t}=zr(),n=1e3,s=async i=>{const o=[];let l=0;for(;;){const{data:a,error:h}=await i.range(l,l+n-1);if(h)throw h;const p=a??[];if(o.push(...p),p.length{let i=ee.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).order("created_at",{ascending:!1}).order("first_name");return await s(i)},enabled:!!t})},Lft=e=>Jt({queryKey:["innercircle-contact",e],queryFn:async()=>{const{data:t,error:n}=await ee.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).eq("id",e).maybeSingle();if(n)throw n;return t},enabled:!!e}),fOe=()=>{const{user:e}=zr();return Jt({queryKey:["innercircle-contact-counts",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return t==null||t.forEach(i=>{var o;(o=i.tags)==null||o.forEach(l=>{s[l.relationship_type_id]=(s[l.relationship_type_id]||0)+1})}),s},enabled:!!e})},_xe=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{tagIds:s,...i}=n,o={...i,birthday:i.birthday||null,home_anniversary:i.home_anniversary||null,owner_user_id:t.id},{data:l,error:a}=await ee.from("innercircle_contacts").insert(o).select().single();if(a)throw a;if(s&&s.length>0){const{error:h}=await ee.from("innercircle_contact_tags").insert(s.map(p=>({contact_id:l.id,relationship_type_id:p})));if(h)throw h}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),$i({title:"Contact created successfully"})},onError:n=>{$i({title:"Error creating contact",description:n.message,variant:"destructive"})}})},pOe=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{tagIds:s,tags:i,...o}=n,l={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:a,error:h}=await ee.from("innercircle_contacts").update(l).eq("id",t).select().single();if(h)throw h;if(s!==void 0&&(await ee.from("innercircle_contact_tags").delete().eq("contact_id",t),s.length>0)){const{error:p}=await ee.from("innercircle_contact_tags").insert(s.map(x=>({contact_id:t,relationship_type_id:x})));if(p)throw p}return a},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),$i({title:"Contact updated successfully"})},onError:t=>{$i({title:"Error updating contact",description:t.message,variant:"destructive"})}})},mOe=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("innercircle_contacts").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),$i({title:"Contact deleted successfully"})},onError:t=>{$i({title:"Error deleting contact",description:t.message,variant:"destructive"})}})},bxe=()=>Jt({queryKey:["action-types"],queryFn:async()=>{const{data:e,error:t}=await ee.from("action_types").select("*").order("sort_order");if(t)throw t;return e}}),Oft=e=>Jt({queryKey:["action-scripts",e],queryFn:async()=>{let t=ee.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await t;if(s)throw s;return n}}),Dft=()=>Jt({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:e,error:t}=await ee.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(t)throw t;return e}}),Rft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({name:n,description:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:t.id,active:!0,is_template:!1}).select().single();if(o)throw o;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan created successfully"})},onError:n=>{$i({title:"Error creating plan",description:n.message,variant:"destructive"})}})},Fft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!i)throw new Error("Source plan not found");const{data:l,error:a}=await ee.from("touchpoint_plans").insert({name:s,description:i.description,owner_user_id:t.id,active:!0,is_template:!1}).select().single();if(a)throw a;if(i.items&&i.items.length>0){const h=i.items.map(x=>({plan_id:l.id,month_number:x.month_number,action_type_id:x.action_type_id,default_script_id:x.default_script_id,notes:x.notes})),{error:p}=await ee.from("touchpoint_plan_items").insert(h);if(p)throw p}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{$i({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},zft=()=>{const e=Wr();return cr({mutationFn:async({id:t,name:n,description:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").update({name:n,description:s}).eq("id",t).select().single();if(o)throw o;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan updated successfully"})}})},Bft=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("touchpoint_plans").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan deleted successfully"})}})},$ft=()=>{const e=Wr();return cr({mutationFn:async({planId:t,items:n})=>{if(await ee.from("touchpoint_plan_items").delete().eq("plan_id",t),n.length>0){const{error:s}=await ee.from("touchpoint_plan_items").insert(n.map(i=>({plan_id:t,month_number:i.month_number,action_type_id:i.action_type_id,default_script_id:i.default_script_id||null,notes:i.notes})));if(s)throw s}},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan schedule updated"})}})},Uft=()=>{const e=Wr();return cr({mutationFn:async({actionTypeId:t,title:n,scriptBody:s,emailSubject:i,tone:o})=>{const{data:l,error:a}=await ee.from("action_scripts").insert({action_type_id:t,title:n,script_body:s,email_subject:i||null,tone:o||null,active:!0}).select().single();if(a)throw a;return l},onSuccess:()=>{e.invalidateQueries({queryKey:["action-scripts"]}),$i({title:"Script created successfully"})},onError:t=>{$i({title:"Error creating script",description:t.message,variant:"destructive"})}})},qft=()=>{const{user:e}=zr();return Jt({queryKey:["user-plan-enrollments",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return t},enabled:!!e})},Vft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({planId:n,relationshipTypeId:s,active:i})=>{const{data:o}=await ee.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:l}=await ee.from("user_plan_enrollments").update({active:i}).eq("id",o.id);if(l)throw l}else if(i){const{error:l}=await ee.from("user_plan_enrollments").insert({owner_user_id:t.id,plan_id:n,relationship_type_id:s,active:!0,start_date:new Date().toISOString().split("T")[0]});if(l)throw l}},onSuccess:()=>{e.invalidateQueries({queryKey:["user-plan-enrollments"]}),$i({title:"Plan enrollment updated"})}})},bse=(e=7)=>{const{user:t}=zr();return Jt({queryKey:["contact-touch-logs",t==null?void 0:t.id,e],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-e);const{data:s,error:i}=await ee.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(i)throw i;return s},enabled:!!t})},gOe=()=>{const{user:e}=zr();return Jt({queryKey:["contacts-last-touch",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(n)throw n;const s={};return t==null||t.forEach(i=>{s[i.contact_id]||(s[i.contact_id]=i.completed_at)}),s},enabled:!!e})},Hft=(e=90)=>{const{data:t}=op(),{data:n}=gOe();if(!t||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-e);const i=t.filter(o=>{const l=n[o.id];return l?new Date(l){const e=Wr(),{user:t}=zr();return cr({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:i,notes:o})=>{const{data:l,error:a}=await ee.from("contact_touch_logs").insert({owner_user_id:t.id,contact_id:n,action_type_id:s,script_used_id:i,notes:o,completed_at:new Date().toISOString()}).select().single();if(a)throw a;return l},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts-last-touch"]}),e.invalidateQueries({queryKey:["today-actions"]}),$i({title:"Action completed!"})}})},yOe="agentos_weekly_touch_goal",_ke=20,vte=()=>{if(typeof window>"u")return _ke;const e=localStorage.getItem(yOe);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return _ke},vOe=e=>{localStorage.setItem(yOe,e.toString())},_Oe=()=>{const{data:e}=bse(7),t=new Date;t.setHours(0,0,0,0);const n=new Date(t);n.setDate(t.getDate()-t.getDay());const s=(e==null?void 0:e.filter(l=>new Date(l.completed_at)>=n).length)||0;let i=0;if(e&&e.length>0){const l=new Set(e.map(h=>new Date(h.completed_at).toDateString()));let a=new Date(t);for(;l.has(a.toDateString());)i++,a.setDate(a.getDate()-1)}const o=vte();return{actionsThisWeek:s,weeklyGoal:o,streak:i,progress:Math.min(s/o*100,100)}},Wft=()=>{const{user:e}=zr();return Jt({queryKey:["contact-plan-cycles",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("contact_plan_cycles").select(` *, contact:innercircle_contacts(*), plan:touchpoint_plans( *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) ) `);if(n)throw n;return t},enabled:!!e})},Gft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async()=>{const{data:n}=await ee.from("user_plan_enrollments").select("*").eq("active",!0);if(!n||n.length===0)return;const{data:s}=await ee.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!s)return;const{data:i}=await ee.from("contact_plan_cycles").select("contact_id, plan_id"),o=new Set((i==null?void 0:i.map(a=>`${a.contact_id}-${a.plan_id}`))||[]),l=[];for(const a of s)for(const h of a.tags||[]){const p=n.find(x=>x.relationship_type_id===h.relationship_type_id);p&&!o.has(`${a.id}-${p.plan_id}`)&&l.push({contact_id:a.id,plan_id:p.plan_id,relationship_type_id:h.relationship_type_id})}if(l.length>0){const{error:a}=await ee.from("contact_plan_cycles").insert(l);if(a)throw a}return l.length},onSuccess:n=>{e.invalidateQueries({queryKey:["contact-plan-cycles"]}),n&&n>0&&$i({title:`${n} contact(s) enrolled in plans`})}})},bOe=()=>{const{user:e}=zr(),{data:t}=Wft(),{data:n}=bse(30);return Jt({queryKey:["today-actions",e==null?void 0:e.id,t==null?void 0:t.length,n==null?void 0:n.length],queryFn:async()=>{var w;if(!t||t.length===0)return[];const s=new Date,i=[],o=new Date(s.getFullYear(),s.getMonth(),1),l=new Set((n==null?void 0:n.filter(j=>new Date(j.completed_at)>=o).map(j=>`${j.contact_id}-${j.action_type_id}`))||[]);for(const j of t){if(!((w=j.plan)!=null&&w.items)||j.plan.items.length===0||!j.contact)continue;const S=new Date(j.cycle_start_date),A=Math.floor((s.getTime()-S.getTime())/(30.44*24*60*60*1e3))%12+1,E=j.plan.items.find(T=>T.month_number===A);if(E&&E.action_type){const T=`${j.contact_id}-${E.action_type_id}`;if(!l.has(T)){const{data:O}=await ee.from("relationship_types").select("name").eq("id",j.relationship_type_id).single();i.push({contact:j.contact,actionType:E.action_type,script:E.default_script||void 0,planName:j.plan.name,relationshipTypeName:(O==null?void 0:O.name)||"",monthNumber:A})}}}const a=5,h=s.getDate(),p=i.sort((j,S)=>j.contact.first_name.localeCompare(S.contact.first_name)),x=(h-1)%Math.max(1,p.length);return[...p.slice(x),...p.slice(0,x)].slice(0,a)},enabled:!!e&&!!t})};function Kft(){const e=ns(),{data:t,isLoading:n}=bOe(),{data:s}=op(),i=_Oe(),[o,l]=P.useState(vte()),[a,h]=P.useState(""),[p,x]=P.useState(!1);P.useEffect(()=>{l(vte())},[]);const y=()=>{const q=parseInt(a,10);if(isNaN(q)||q<1){$i({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(q),vOe(q),x(!1),$i({title:"Goal updated",description:`Weekly touch goal set to ${q}`})},w=()=>{h(o.toString()),x(!0)},j=af(new Date),S=Vl(j,7),C=q=>{if(!q)return null;const H=new Date(q);return new Date(j.getFullYear(),H.getMonth(),H.getDate())},A=(s==null?void 0:s.map(q=>{const H=C(q.birthday),K=C(q.home_anniversary),Z=[];return H&&H>=j&&H<=S&&Z.push({contact:q,type:"birthday",date:H,isToday:Kl(H,j)}),K&&K>=j&&K<=S&&Z.push({contact:q,type:"anniversary",date:K,isToday:Kl(K,j)}),Z}).flat().sort((q,H)=>q.date.getTime()-H.date.getTime()).slice(0,3))||[],E=(s==null?void 0:s.filter(q=>{const H=C(q.birthday),K=C(q.home_anniversary);return H&&Kl(H,j)||K&&Kl(K,j)}).length)||0,T=(t==null?void 0:t.length)||0,O=E+T,z=(i==null?void 0:i.actionsThisWeek)||0,F=(i==null?void 0:i.streak)||0;return n?r.jsx(We,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):r.jsxs(We,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:F>0&&r.jsxs(Ft,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(Kh,{className:"h-3 w-3"}),F," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[O>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[O," tasks"]})," for today"]}):"No tasks for today",z>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:z})," touches this week"]})]})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(J,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),e("/mission-control/contacts?new=true")},children:[r.jsx(Qh,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(J,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),e("/mission-control")},children:[r.jsx(ca,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(J,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:q=>{q.stopPropagation(),e("/mission-control/video/record")},children:[r.jsx(Fi,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(J,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),e("/mission-control/popbys")},children:[r.jsx(pl,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(J,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:q=>{q.stopPropagation(),e("/mission-control/pipeline")},children:[r.jsx(f1,{className:"h-3.5 w-3.5"}),"Pipeline"]})]}),r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wx,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Br,{open:p,onOpenChange:x,children:[r.jsx(Fo,{asChild:!0,children:r.jsx("button",{onClick:w,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(hd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Fr,{className:"sm:max-w-[360px]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Set Weekly Goal"}),r.jsx(es,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(ct,{id:"weekly-goal",type:"number",min:"1",value:a,onChange:q=>h(q.target.value),placeholder:"20",onKeyDown:q=>{q.key==="Enter"&&y()}})]}),r.jsx(J,{onClick:y,className:"w-full",children:"Save Goal"})]})]})]})]}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-primary",children:z}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(Hc,{value:Math.min(z/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),z>=o&&r.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5 flex items-center gap-1",children:[r.jsx("span",{children:"🎉"})," Goal achieved! Keep the momentum going."]}),z0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-z," more to hit your weekly goal"]})]}),A.length>0&&r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Gh,{className:"h-4 w-4 text-pink-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Upcoming Milestones"})]}),r.jsx("div",{className:"space-y-2",children:A.map((q,H)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${q.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:K=>{K.stopPropagation(),e(`/mission-control/contacts/${q.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[q.type==="birthday"?r.jsx(Gh,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(fi,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[q.contact.first_name," ",q.contact.last_name]}),q.isToday&&r.jsx(Ft,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-pink-500/20 text-pink-600",children:"Today!"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.isToday?q.type==="birthday"?"🎂":"🏠":fn(q.date,"EEE, MMM d")}),r.jsx(Ga,{className:"h-3 w-3"})]})]},`${q.contact.id}-${q.type}-${H}`))})]}),r.jsxs(J,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>e("/mission-control"),children:["Open Agent OS",r.jsx(Ko,{className:"h-4 w-4"})]})]})]})}const wOe=()=>Jt({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:e,error:t}=await ee.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(t)throw t;return(e==null?void 0:e.enabled)??!1}}),jOe=e=>{const{user:t,brokerageId:n}=zr();return Jt({queryKey:["listings",e,n],queryFn:async()=>{let s=ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0);e!=null&&e.status&&(s=s.eq("status",e.status)),e!=null&&e.propertyType&&(s=s.eq("property_type",e.propertyType)),e!=null&&e.city&&(s=s.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(s=s.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(s=s.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(s=s.eq("open_to_referrals",!0));const{data:i,error:o}=await s;if(o)throw o;let l=i||[];if(n){const{data:a}=await ee.from("profiles").select("id").eq("brokerage_id",n);if(a&&a.length>0){const h=a.map(y=>y.id);let p=ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("share_with_brokerage",!0).eq("is_public",!1).in("agent_id",h);e!=null&&e.status&&(p=p.eq("status",e.status)),e!=null&&e.propertyType&&(p=p.eq("property_type",e.propertyType)),e!=null&&e.city&&(p=p.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(p=p.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(p=p.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(p=p.eq("open_to_referrals",!0));const{data:x}=await p;if(x){const y=new Set(l.map(j=>j.id)),w=x.filter(j=>!y.has(j.id));l=[...l,...w]}}}switch(e==null?void 0:e.sortBy){case"updated":l.sort((a,h)=>new Date(h.updated_at).getTime()-new Date(a.updated_at).getTime());break;case"price_asc":l.sort((a,h)=>a.price-h.price);break;case"price_desc":l.sort((a,h)=>h.price-a.price);break;default:l.sort((a,h)=>new Date(h.created_at).getTime()-new Date(a.created_at).getTime())}return l}})},wxe=()=>{const{user:e}=zr();return Jt({queryKey:["my-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await ee.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})},kOe=e=>{const{user:t}=zr();return Jt({queryKey:["listing",e],queryFn:async()=>{const{data:n,error:s}=await ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds) `).eq("id",e).single();if(s)throw s;return t&&await ee.from("listing_views").insert({listing_id:e,viewer_id:t.id}),n},enabled:!!e})},Zft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("listings").insert({...n,agent_id:t.id}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Yft=()=>{const e=Wr();return cr({mutationFn:async({agentId:t,...n})=>{const{data:s,error:i}=await ee.from("listings").insert({...n,agent_id:t}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["brokerage-listings"]})}})},Xft=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("listings").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["listing",t.id]})}})},NOe=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("listings").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Qft=()=>{const e=Wr();return cr({mutationFn:async({listingId:t,photoUrl:n,isPrimary:s=!1})=>{const{data:i,error:o}=await ee.from("listing_photos").insert({listing_id:t,photo_url:n,is_primary:s}).select().single();if(o)throw o;return i},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t.listing_id]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Jft=()=>{const e=Wr();return cr({mutationFn:async({photoId:t,listingId:n})=>{const{error:s}=await ee.from("listing_photos").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t]}),e.invalidateQueries({queryKey:["my-listings"]})}})},ept=()=>{const{user:e}=zr();return Jt({queryKey:["saved-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await ee.from("listing_saves").select(` *, listing:listings( *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id) ) `).eq("agent_id",e.id);if(n)throw n;return t},enabled:!!e})},SOe=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await ee.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await ee.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await ee.from("listing_saves").insert({listing_id:n,agent_id:t.id}),{saved:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["saved-listings"]}),e.invalidateQueries({queryKey:["listings"]})}})},COe=e=>{const{user:t}=zr();return Jt({queryKey:["listing-saved",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await ee.from("listing_saves").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},tpt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await ee.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await ee.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await ee.from("listing_follows").insert({listing_id:n,agent_id:t.id}),{following:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["listing-following"]})}})},rpt=e=>{const{user:t}=zr();return Jt({queryKey:["listing-following",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await ee.from("listing_follows").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},npt=()=>{const{user:e}=zr();return cr({mutationFn:async({listingId:t,shareType:n})=>{if(!e)throw new Error("Not authenticated");const{error:s}=await ee.from("listing_shares").insert({listing_id:t,sharing_agent_id:e.id,share_type:n});if(s)throw s}})},spt=()=>{const{user:e}=zr();return Jt({queryKey:["my-referrals",e==null?void 0:e.id],queryFn:async()=>{if(!e)return{sent:[],received:[]};const[t,n]=await Promise.all([ee.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",e.id).order("created_at",{ascending:!1}),ee.from("listing_referrals").select(` *, sender:profiles!listing_referrals_sender_agent_id_fkey(id, name, email), listing:listings(*,photos:listing_photos(*)) `).eq("listing_agent_id",e.id).order("created_at",{ascending:!1})]);return{sent:t.data||[],received:n.data||[]}},enabled:!!e})},ipt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({listingId:n,listingAgentId:s,buyerName:i,buyerType:o,notes:l})=>{if(!t)throw new Error("Not authenticated");const{data:a,error:h}=await ee.from("listing_referrals").insert({listing_id:n,sender_agent_id:t.id,listing_agent_id:s,buyer_name:i,buyer_type:o,notes:l}).select().single();if(h)throw h;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["my-referrals"]})}})},apt=()=>Jt({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:e}=await ee.from("listing_shares").select("sharing_agent_id, profiles!listing_shares_agent_id_fkey(name)").order("created_at",{ascending:!1}),t=new Map;e==null||e.forEach(l=>{var p;const a=l.sharing_agent_id;if(!a)return;const h=t.get(a);h?h.count++:t.set(a,{name:((p=l.profiles)==null?void 0:p.name)||"Unknown",count:1})});const n=Array.from(t.entries()).map(([l,a])=>({agentId:l,...a})).sort((l,a)=>a.count-l.count).slice(0,10),{data:s}=await ee.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),i=new Map;s==null||s.forEach(l=>{var h;const a=i.get(l.agent_id);a?a.count++:i.set(l.agent_id,{name:((h=l.agent)==null?void 0:h.name)||"Unknown",count:1})});const o=Array.from(i.entries()).map(([l,a])=>({agentId:l,...a})).sort((l,a)=>a.count-l.count).slice(0,10);return{topSharers:n,topListers:o}}}),opt=()=>{const{user:e,brokerageId:t}=zr();return Jt({queryKey:["brokerage-listings",t],queryFn:async()=>{if(!e||!t)return[];const{data:n}=await ee.from("profiles").select("id").eq("brokerage_id",t);if(!n||n.length===0)return[];const s=n.map(l=>l.id),{data:i,error:o}=await ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).in("agent_id",s).eq("is_approved",!0).order("created_at",{ascending:!1});if(o)throw o;return i},enabled:!!e&&!!t})},lpt=({className:e,variant:t="default"})=>r.jsx(Ft,{variant:"outline",className:$t("text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0 h-4",t==="default"?"border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10":"border-muted-foreground/30 text-muted-foreground",e),children:"Beta"}),cpt={coming_soon:"bg-amber-500/10 text-amber-600 border-amber-200",active:"bg-emerald-500/10 text-emerald-600 border-emerald-200",under_contract:"bg-blue-500/10 text-blue-600 border-blue-200",sold:"bg-purple-500/10 text-purple-600 border-purple-200",withdrawn:"bg-muted text-muted-foreground border-border"},dpt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function upt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function hpt(){const e=ns(),{data:t,isLoading:n}=wOe(),{data:s,isLoading:i}=jOe({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(s==null?void 0:s.filter(x=>x.is_approved&&x.is_public))||[],l=o.filter(x=>x.is_featured),a=o.filter(x=>!x.is_featured),h=[...l,...a].slice(0,6),p=n||i;return!p&&!t?null:p?r.jsx(We,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),r.jsx(lpt,{})]}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ko,{className:"h-4 w-4"})]})]}),h.length===0?r.jsx(We,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(fi,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No listings available yet"}),r.jsx(J,{variant:"link",size:"sm",onClick:()=>e("/mission-control/listings/new"),className:"mt-2",children:"Add the first listing"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:h.map(x=>{var w,j;const y=((w=x.photos)==null?void 0:w.find(S=>S.is_primary))||((j=x.photos)==null?void 0:j[0]);return r.jsxs("div",{onClick:()=>e(`/mission-control/listings/${x.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden relative",children:[y!=null&&y.photo_url?r.jsx("img",{src:y.photo_url,alt:`${x.city}, ${x.state}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(fi,{className:"h-8 w-8 text-muted-foreground/50"})}),x.is_featured&&r.jsx("div",{className:"absolute top-1.5 left-1.5",children:r.jsxs(Ft,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(vs,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Ft,{className:`text-[10px] px-1.5 py-0.5 ${cpt[x.status]}`,children:dpt[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:upt(x.price)}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[x.city,", ",x.state]}),(x.bedrooms||x.bathrooms)&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[x.bedrooms&&`${x.bedrooms} bed`,x.bedrooms&&x.bathrooms&&" · ",x.bathrooms&&`${x.bathrooms} bath`]})]})]},x.id)})})]})}function MOe(e=10,t){return Jt({queryKey:["event-leaderboard",e,t],queryFn:async()=>{const{data:n}=await ee.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(w=>w.user_id))||[]);let i=null;if(t){const{data:w}=await ee.from("profiles").select("id").eq("brokerage_id",t);i=new Set((w==null?void 0:w.map(j=>j.id))||[])}const{data:o,error:l}=await ee.from("agent_attendance_stats").select("user_id, total_points, total_events_attended, current_streak").order("total_points",{ascending:!1}).limit(e+s.size+50);if(l)throw l;if(!o||o.length===0)return[];let a=o.filter(w=>!s.has(w.user_id));i&&(a=a.filter(w=>i.has(w.user_id)));const h=a.slice(0,e),p=h.map(w=>w.user_id),{data:x}=await ee.from("profiles").select("id, name").in("id",p),y=new Map((x==null?void 0:x.map(w=>[w.id,{name:w.name}]))||[]);return h.map(w=>({user_id:w.user_id,total_points:w.total_points,total_events_attended:w.total_events_attended,current_streak:w.current_streak,profile:y.get(w.user_id)||null}))}})}function TOe(e){return Jt({queryKey:["user-attendance-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await ee.from("agent_attendance_stats").select("*").eq("user_id",e).single();if(n&&n.code!=="PGRST116")throw n;return t},enabled:!!e})}function AOe(e){return Jt({queryKey:["user-badges",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await ee.from("agent_badges").select("*").eq("user_id",e).order("earned_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function EOe(e,t){return Jt({queryKey:["user-rank",e,t],queryFn:async()=>{if(!e)return null;const{data:n}=await ee.from("agent_attendance_stats").select("total_points").eq("user_id",e).single();if(!n)return null;const{data:s}=await ee.from("user_roles").select("user_id").eq("role","admin"),i=new Set((s==null?void 0:s.map(h=>h.user_id))||[]),{data:o,error:l}=await ee.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(l)throw l;let a=(o==null?void 0:o.filter(h=>!i.has(h.user_id)))||[];if(t){const{data:h}=await ee.from("profiles").select("id").eq("brokerage_id",t),p=new Set((h==null?void 0:h.map(x=>x.id))||[]);a=a.filter(x=>p.has(x.user_id))}return a.length+1},enabled:!!e})}function fpt(){const{user:e,brokerageId:t,isAdmin:n}=zr();ns();const s=!!t,[i,o]=P.useState("brokerage"),l=()=>{if(n)return null;if(s)return i==="global"?null:t},{data:a,isLoading:h}=MOe(5,l()),{data:p}=TOe(e==null?void 0:e.id),{data:x}=EOe(e==null?void 0:e.id,l()),{data:y}=AOe(e==null?void 0:e.id),w=n||s,j=()=>n?"Agent Leaderboard":s?i==="global"?"All LevelUp":"My Brokerage":"My Points";if(h)return r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(Ha,{className:"h-4 w-4 text-yellow-500"}),j()]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-2",children:[...Array(w?5:3)].map((C,A)=>r.jsx(Pr,{className:"h-10 w-full"},A))})})]});const S=C=>C===0?r.jsx(Ha,{className:"h-4 w-4 text-yellow-500 mx-auto"}):C===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):C===2?r.jsx("span",{className:"text-sm font-medium text-amber-600",children:"3"}):r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:C+1});if(w){const C=(a==null?void 0:a.slice(0,5))||[];return r.jsxs(We,{children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(Ha,{className:"h-4 w-4 text-yellow-500"}),j()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(J,{variant:i==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(J,{variant:i==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(Xe,{children:[!n&&p&&r.jsx("div",{className:"mb-3 p-2 rounded-lg bg-primary/5 border border-primary/10",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Your Rank:"}),r.jsxs("span",{className:"font-bold text-primary",children:["#",x||"-"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsxs("span",{children:[r.jsx("strong",{className:"text-primary",children:p.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:p.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[C.map((A,E)=>{var T,O,z;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${A.user_id===(e==null?void 0:e.id)?"bg-primary/10 border border-primary/20":E===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:S(E)}),r.jsx(ci,{className:"h-6 w-6",children:r.jsx(di,{className:"text-xs",children:((O=(T=A.profile)==null?void 0:T.name)==null?void 0:O.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((z=A.profile)==null?void 0:z.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:A.total_points})]},A.user_id)}),C.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(co,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Va,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ga,{className:"h-4 w-4"})]})]})]})}return r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(Ha,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(Xe,{children:p?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:p.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Total Points"})]}),r.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:p.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events Attended"})]})]}),r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Current Streak"})]}),r.jsxs("span",{className:"font-bold text-orange-500",children:[p.current_streak," 🔥"]})]}),y&&y.length>0&&r.jsxs("div",{className:"pt-2 border-t",children:[r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx(Pl,{className:"h-3 w-3 text-muted-foreground"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Badges"})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.slice(0,4).map(C=>r.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-yellow-500/10 text-yellow-600 border border-yellow-500/20",children:C.badge_name},C.id)),y.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",y.length-4," more"]})]})]}),r.jsxs(co,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Va,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ga,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(vs,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(co,{to:"/reward-store",className:"mt-3 inline-flex items-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Va,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Ga,{className:"h-4 w-4"})]})]})})]})}const wse=()=>Jt({queryKey:["lead-sources"],queryFn:async()=>{const{data:e,error:t}=await ee.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}}),ppt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("lead_sources").insert({name:n,owner_user_id:t==null?void 0:t.id,sort_order:100}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["lead-sources"]}),ze.success("Lead source added")},onError:n=>{ze.error("Failed to add lead source"),console.error(n)}})},jxe=(e,t)=>{const{user:n,isAdmin:s}=zr(),i=s&&t?t:n==null?void 0:n.id;return Jt({queryKey:["scorecard-transactions",e,i],queryFn:async()=>{let o=ee.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",i).order("close_date",{ascending:!1});e&&(o=o.gte("close_date",`${e}-01-01`).lte("close_date",`${e}-12-31`));const{data:l,error:a}=await o;if(a)throw a;return l},enabled:!!i})},IOe=e=>{const{user:t,isAdmin:n}=zr(),s=n&&e?e:t==null?void 0:t.id;return Jt({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:i,error:o}=await ee.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",s).order("close_date",{ascending:!1});if(o)throw o;return i},enabled:!!s})},jse=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_transactions").insert({...n,owner_user_id:t.id}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction added")},onError:n=>{ze.error("Failed to add transaction"),console.error(n)}})},mpt=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("scorecard_transactions").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction updated")},onError:t=>{ze.error("Failed to update transaction"),console.error(t)}})},gpt=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("scorecard_transactions").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction deleted")},onError:t=>{ze.error("Failed to delete transaction"),console.error(t)}})},POe=(e,t)=>{const{user:n,isAdmin:s}=zr(),i=s&&t?t:n==null?void 0:n.id;return Jt({queryKey:["scorecard-goals",e,i],queryFn:async()=>{const{data:o,error:l}=await ee.from("scorecard_goals").select("*").eq("owner_user_id",i).eq("year",e).maybeSingle();if(l)throw l;return o},enabled:!!i})},xpt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_goals").upsert({...n,owner_user_id:t.id},{onConflict:"owner_user_id,year"}).select().single();if(i)throw i;return s},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["scorecard-goals",s.year]}),ze.success("Goals saved")},onError:n=>{ze.error("Failed to save goals"),console.error(n)}})},kse=()=>{const{user:e}=zr();return Jt({queryKey:["scorecard-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("scorecard_settings").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t},enabled:!!(e!=null&&e.id)})},ypt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_settings").upsert({...n,user_id:t.id},{onConflict:"user_id"}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-settings"]}),ze.success("Settings saved")},onError:n=>{ze.error("Failed to save settings"),console.error(n)}})},LOe=(e,t)=>{const{data:n,isLoading:s}=jxe(e,t),{data:i,isLoading:o}=IOe(t),{data:l}=kse(),a=(l==null?void 0:l.show_commission)??!0,h=p=>{if(!p||p.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const x=p.filter(z=>z.transaction_type==="buyer").length,y=p.filter(z=>z.transaction_type==="seller").length,w=p.reduce((z,F)=>z+Number(F.sale_price),0),j=p.reduce((z,F)=>z+(Number(F.commission_amount)||0),0),S={};p.forEach(z=>{var q;const F=((q=z.lead_source)==null?void 0:q.name)||"Unknown";S[F]=(S[F]||0)+1});const C=Object.entries(S).map(([z,F])=>({name:z,count:F})).sort((z,F)=>F.count-z.count),A=C[0]||null,E={};p.forEach(z=>{const F=new Date(z.close_date).toLocaleString("default",{month:"short"});E[F]=(E[F]||0)+1});const O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(z=>({month:z,count:E[z]||0}));return{totalTransactions:p.length,buyerCount:x,sellerCount:y,totalVolume:w,averagePrice:p.length>0?w/p.length:0,totalCommission:a?j:0,topLeadSource:A,transactionsByMonth:O,leadSourceBreakdown:C}};return{yearStats:h(n),lifetimeStats:h(i),isLoading:s||o,showCommission:a}},vpt=()=>{const{isAdmin:e}=zr();return Jt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:t,error:n}=await ee.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(n)throw n;const s=[...new Set(t.map(l=>l.owner_user_id))],{data:i,error:o}=await ee.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return i},enabled:e})},g0={recency:40,touchpoints:30,transactions:20},bke={warm:70,cooling:40};function _pt(e){return e===null?0:e<=14?g0.recency:e<=30?g0.recency*.85:e<=60?g0.recency*.65:e<=90?g0.recency*.4:e<=180?g0.recency*.2:g0.recency*.05}function bpt(e){const t=Math.min(e/12,1);return Math.round(g0.touchpoints*t)}function wpt(e){return e?g0.transactions:0}function jpt(){return 0}function kpt(e){return e>=bke.warm?"warm":e>=bke.cooling?"cooling":"at-risk"}function kxe(){const{data:e,isLoading:t}=op(),{data:n}=gOe(),{data:s}=bse(365),{data:i}=IOe(),o=P.useMemo(()=>{if(!e)return[];const a=new Date,h=yut(a),p={};s==null||s.forEach(y=>{new Date(y.completed_at)>=h&&(p[y.contact_id]=(p[y.contact_id]||0)+1)});const x=new Set((i==null?void 0:i.filter(y=>y.contact_id).map(y=>y.contact_id))||[]);return e.map(y=>{const w=(n==null?void 0:n[y.id])||null,j=w?mC(a,new Date(w)):null,S=p[y.id]||0,C=x.has(y.id),A=_pt(j),E=bpt(S),T=wpt(C),O=jpt(),z=Math.round(A+E+T+O),F={score:z,status:kpt(z),breakdown:{recency:Math.round(A),touchpoints:Math.round(E),transactions:Math.round(T),referrals:Math.round(O)},lastTouchDate:w,daysSinceTouch:j,touchCountLast12Months:S,hasTransaction:C};return{...y,relationshipScore:F}})},[e,n,s,i]),l=P.useMemo(()=>{const a=o.filter(w=>w.relationshipScore.status==="warm").length,h=o.filter(w=>w.relationshipScore.status==="cooling").length,p=o.filter(w=>w.relationshipScore.status==="at-risk").length,x=o.length,y=x>0?Math.round(o.reduce((w,j)=>w+j.relationshipScore.score,0)/x):0;return{warm:a,cooling:h,atRisk:p,total:x,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:t}}function OOe(){const e=ns(),{stats:t,contactsWithScores:n,isLoading:s}=kxe();if(s)return r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Pr,{className:"h-5 w-40"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(Pr,{className:"h-20 w-full"}),r.jsx(Pr,{className:"h-16 w-full"})]})]});if(t.total===0)return r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(J,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>e("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const i=Math.round(t.warm/t.total*100),o=Math.round(t.cooling/t.total*100),l=Math.round(t.atRisk/t.total*100),a=n.filter(h=>h.relationshipScore.status==="at-risk").sort((h,p)=>h.relationshipScore.score-p.relationshipScore.score).slice(0,3);return r.jsxs(We,{children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Kf,{className:"h-5 w-5 text-emerald-500"}),"Relationship Health"]}),r.jsx("span",{className:"text-2xl font-bold",children:t.averageScore})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Average score across ",t.total," contacts"]})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsx("span",{children:"Warm"})]}),r.jsxs("span",{className:"font-medium",children:[t.warm," (",i,"%)"]})]}),r.jsx(Hc,{value:i,className:"h-2 bg-muted [&>div]:bg-emerald-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-amber-500"}),r.jsx("span",{children:"Cooling Off"})]}),r.jsxs("span",{className:"font-medium",children:[t.cooling," (",o,"%)"]})]}),r.jsx(Hc,{value:o,className:"h-2 bg-muted [&>div]:bg-amber-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-red-500"}),r.jsx("span",{children:"At Risk"})]}),r.jsxs("span",{className:"font-medium",children:[t.atRisk," (",l,"%)"]})]}),r.jsx(Hc,{value:l,className:"h-2 bg-muted [&>div]:bg-red-500"})]})]}),a.length>0&&r.jsxs("div",{className:"pt-3 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(_1,{className:"h-4 w-4 text-red-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}),r.jsx("div",{className:"space-y-2",children:a.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-red-500/5 hover:bg-red-500/10 cursor-pointer transition-colors",onClick:()=>e(`/mission-control/contacts/${h.id}`),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),r.jsxs("span",{className:"text-sm",children:[h.first_name," ",h.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:h.relationshipScore.daysSinceTouch===null?"Never":`${h.relationshipScore.daysSinceTouch}d`}),r.jsx(Ga,{className:"h-3 w-3"})]})]},h.id))})]}),r.jsxs(J,{variant:"outline",size:"sm",className:"w-full",onClick:()=>e("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Ga,{className:"h-4 w-4 ml-1"})]})]})]})}const Npt=()=>{var ne,ye;const{user:e,isAdmin:t}=zr(),n=ns(),[s,i]=P.useState([]),[o,l]=P.useState([]),[a,h]=P.useState([]),[p,x]=P.useState([]),[y,w]=P.useState([]),[j,S]=P.useState([]),[C,A]=P.useState(new Set),[E,T]=P.useState([]),[O,z]=P.useState([]),[F,q]=P.useState([]),[H,K]=P.useState(!0);P.useEffect(()=>{Z()},[e]);const Z=async()=>{var ie,fe,de,_e;try{const[Ee,ke,pe,ae,ge,Me,Ue,Ie,Ke,Re]=await Promise.all([ee.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),ee.from("app_tiles").select("*").order("name"),ee.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),ee.from("events").select("*").order("event_date",{ascending:!0}),ee.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e==null?void 0:e.id),ee.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),ee.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.from("additional_services").select("id, name, description, preview_image_url, signup_link_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),Ce=((ie=Ee.data)==null?void 0:ie.map(et=>et.tag))||[],Je=new Set(((fe=pe.data)==null?void 0:fe.map(et=>et.app_id))||[]);A(Je);const Ye=(((de=ke.data)==null?void 0:de.filter(et=>!et.required_tags||et.required_tags.length===0?!0:et.required_tags.some(nt=>Ce.includes(nt))))||[]).sort((et,nt)=>et.name==="LevelUp Members Portal"?-1:nt.name==="LevelUp Members Portal"?1:0);i(Ye.slice(0,6));const xe=((_e=ae.data)==null?void 0:_e.filter(et=>MS(et.event_date)!=="ended"))||[];l(xe.slice(0,4)),T(ge.data||[]),h(Me.data||[]),x(Ue.data||[]),w(Ie.data||[]),S(Ke.data||[]);const mt=Re.data||[];z(mt.filter(et=>et.placement==="top")),q(mt.filter(et=>et.placement==="between"))}catch(Ee){console.error("Error loading dashboard:",Ee),ze.error("Failed to load dashboard data")}finally{K(!1)}},re=async ie=>{var de;const fe=window.open("about:blank","_blank");try{await ee.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:ie.app_id,app_name:ie.name,user_agent:navigator.userAgent});const{data:_e,error:Ee}=await ee.functions.invoke("sso-launch",{body:{app_id:ie.app_id}});if(Ee)throw Ee;_e!=null&&_e.redirect_url?fe&&!fe.closed?(fe.location.href=_e.redirect_url,(de=fe.focus)==null||de.call(fe)):window.location.assign(_e.redirect_url):(fe==null||fe.close(),ze.error("Launch link unavailable"))}catch(_e){fe==null||fe.close(),console.error("Error launching app:",_e),ze.error("Failed to launch app")}},ue=ie=>E==null?void 0:E.some(fe=>fe.event_id===ie),he=ie=>{const fe=E==null?void 0:E.find(de=>de.event_id===ie);return fe==null?void 0:fe.zoom_join_url};if(H)return r.jsx(Or,{title:"Dashboard",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading your dashboard..."})]})})});const be=ie=>F.filter(fe=>fe.section_after===ie);return r.jsxs(Or,{title:"Dashboard",children:[r.jsx(jft,{events:o,registrations:E,onNavigateToEvents:()=>n("/events")}),O.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(BM,{banners:O})}),r.jsx(Pft,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((ye=(ne=e==null?void 0:e.user_metadata)==null?void 0:ne.name)==null?void 0:ye.split(" ")[0])||"there","!"]}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Are you ready to LevelUp today?"})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-8",children:[r.jsx(Kft,{}),r.jsx(OOe,{}),r.jsx(fpt,{})]}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Upcoming Events"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ko,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(We,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ys,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"})]})})}):r.jsx("div",{className:"bg-card rounded-xl border border-border overflow-hidden divide-y divide-border max-w-full",children:o.map(ie=>{const fe=ue(ie.id),de=he(ie.id)||ie.zoom_link;return r.jsxs("div",{className:`flex items-start gap-3 sm:gap-4 p-3 sm:p-4 hover:bg-muted/50 transition-colors cursor-pointer group ${xke(ie.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[xke(ie.event_date)?r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-red-500/10 flex flex-col items-center justify-center relative",children:[r.jsx("span",{className:"absolute inline-flex h-3 w-3 top-1 right-1 animate-ping rounded-full bg-red-500 opacity-75"}),r.jsx(yj,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"text-[10px] font-bold text-red-500 uppercase mt-0.5",children:"Live"})]}):r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-primary/10 flex flex-col items-center justify-center",children:[r.jsx("span",{className:"text-[10px] sm:text-xs font-medium text-primary uppercase",children:fn(new Date(ie.event_date),"MMM")}),r.jsx("span",{className:"text-lg sm:text-xl font-bold text-primary",children:fn(new Date(ie.event_date),"d")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"font-medium text-sm sm:text-base text-foreground group-hover:text-primary transition-colors line-clamp-2 sm:truncate",children:ie.title}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground mt-0.5",children:[fn(new Date(ie.event_date),"EEEE")," at ",fn(new Date(ie.event_date),"h:mm a")," EST"]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:fe?r.jsxs(J,{size:"sm",variant:"default",className:"gap-1",onClick:_e=>{_e.stopPropagation(),window.open(de,"_blank")},children:[r.jsx(Ls,{className:"h-3.5 w-3.5"}),"Join"]}):r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground group-hover:text-primary transition-colors",children:[r.jsx("span",{className:"text-sm",children:"Register"}),r.jsx(Ga,{className:"h-4 w-4"})]})})]},ie.id)})})]}),be("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:be("events")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Academy Videos"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ko,{className:"h-4 w-4"})]})]}),y.length===0?r.jsx(We,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Of,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No academy videos available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:y.map(ie=>r.jsxs("div",{onClick:()=>n(`/academy/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden relative",children:[ie.thumbnail_url?r.jsx("img",{src:ie.thumbnail_url,alt:ie.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Of,{className:"h-8 w-8 text-muted-foreground/50"})}),ie.duration&&r.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:ie.duration})]}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:ie.title})})]},ie.id))})]}),be("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:be("academy")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Resource Kits"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ko,{className:"h-4 w-4"})]})]}),p.length===0?r.jsx(We,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx($x,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No resource kits available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:p.map(ie=>r.jsxs("div",{onClick:()=>n(`/toolbox/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.featured_image_url?r.jsx("img",{src:ie.featured_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx($x,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),be("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:be("toolbox")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"New Templates"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ko,{className:"h-4 w-4"})]})]}),a.length===0?r.jsx(We,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(d1,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No templates available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map(ie=>r.jsxs("div",{onClick:()=>n("/templates"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(d1,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),be("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(BM,{banners:be("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(hpt,{})}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Your Apps"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ko,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(We,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(dm,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No apps available"})]})})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(ie=>{const fe=C.has(ie.id);return r.jsxs("div",{onClick:()=>re(ie),className:"group flex items-start gap-4 p-5 bg-card rounded-xl border border-border cursor-pointer transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:ie.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:ie.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ie.description})]}),fe&&r.jsx(dm,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},ie.id)})})]}),r.jsxs("section",{className:"mt-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Additional Services"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ko,{className:"h-4 w-4"})]})]}),j.length===0?r.jsx(We,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ss,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional services available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:j.map(ie=>r.jsxs("div",{onClick:()=>window.open(ie.signup_link_url,"_blank"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Ss,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsxs("div",{className:"p-3",children:[r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name}),ie.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:ie.description})]})]},ie.id))})]})]})};var Nse="Switch",[Spt]=Ql(Nse),[Cpt,Mpt]=Spt(Nse),DOe=P.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:i,defaultChecked:o,required:l,disabled:a,value:h="on",onCheckedChange:p,form:x,...y}=e,[w,j]=P.useState(null),S=ei(t,O=>j(O)),C=P.useRef(!1),A=w?x||!!w.closest("form"):!0,[E,T]=Lu({prop:i,defaultProp:o??!1,onChange:p,caller:Nse});return r.jsxs(Cpt,{scope:n,checked:E,disabled:a,children:[r.jsx(Rn.button,{type:"button",role:"switch","aria-checked":E,"aria-required":l,"data-state":BOe(E),"data-disabled":a?"":void 0,disabled:a,value:h,...y,ref:S,onClick:cn(e.onClick,O=>{T(z=>!z),A&&(C.current=O.isPropagationStopped(),C.current||O.stopPropagation())})}),A&&r.jsx(zOe,{control:w,bubbles:!C.current,name:s,value:h,checked:E,required:l,disabled:a,form:x,style:{transform:"translateX(-100%)"}})]})});DOe.displayName=Nse;var ROe="SwitchThumb",FOe=P.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,i=Mpt(ROe,n);return r.jsx(Rn.span,{"data-state":BOe(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})});FOe.displayName=ROe;var Tpt="SwitchBubbleInput",zOe=P.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...i},o)=>{const l=P.useRef(null),a=ei(l,o),h=vI(n),p=cI(t);return P.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const S=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(S)}},[h,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});zOe.displayName=Tpt;function BOe(e){return e?"checked":"unchecked"}var $Oe=DOe,Apt=FOe;const $s=P.forwardRef(({className:e,...t},n)=>r.jsx($Oe,{className:$t("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",e),...t,ref:n,children:r.jsx(Apt,{className:$t("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")})}));$s.displayName=$Oe.displayName;var Ept=Object.defineProperty,Ipt=(e,t,n)=>t in e?Ept(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yl=(e,t,n)=>Ipt(e,typeof t!="symbol"?t+"":t,n);const _te={x:0,y:0,width:0,height:0,unit:"px"},s4=(e,t,n)=>Math.min(Math.max(e,t),n),Ppt=(...e)=>e.filter(t=>t&&typeof t=="string").join(" "),wke=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function Lpt(e,t,n,s){const i=eg(e,n,s);return e.width&&(i.height=i.width/t),e.height&&(i.width=i.height*t),i.y+i.height>s&&(i.height=s-i.y,i.width=i.height*t),i.x+i.width>n&&(i.width=n-i.x,i.height=i.width/t),e.unit==="%"?x0(i,n,s):i}function Opt(e,t,n){const s=eg(e,t,n);return s.x=(t-s.width)/2,s.y=(n-s.height)/2,e.unit==="%"?x0(s,t,n):s}function x0(e,t,n){return e.unit==="%"?{..._te,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function eg(e,t,n){return e.unit?e.unit==="px"?{..._te,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{..._te,...e,unit:"px"}}function jke(e,t,n,s,i,o=0,l=0,a=s,h=i){const p={...e};let x=Math.min(o,s),y=Math.min(l,i),w=Math.min(a,s),j=Math.min(h,i);t&&(t>1?(x=l?l*t:x,y=x/t,w=a*t):(y=o?o/t:y,x=y*t,j=h/t)),p.y<0&&(p.height=Math.max(p.height+p.y,y),p.y=0),p.x<0&&(p.width=Math.max(p.width+p.x,x),p.x=0);const S=s-(p.x+p.width);S<0&&(p.x=Math.min(p.x,s-x),p.width+=S);const C=i-(p.y+p.height);if(C<0&&(p.y=Math.min(p.y,i-y),p.height+=C),p.widthw&&((n==="sw"||n=="nw")&&(p.x-=w-p.width),p.width=w),p.height>j&&((n==="nw"||n=="ne")&&(p.y-=j-p.height),p.height=j),t){const A=p.width/p.height;if(At){const E=Math.max(p.height*t,x);(n==="sw"||n=="nw")&&(p.x-=E-p.width),p.width=E}}return p}function Dpt(e,t,n,s){const i={...e};return t==="ArrowLeft"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="w"?(i.x-=n,i.width+=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="e"?i.width-=n:s==="se"&&(i.width-=n,i.height-=n):t==="ArrowRight"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="w"?(i.x+=n,i.width-=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="e"?i.width+=n:s==="se"&&(i.width+=n,i.height+=n)),t==="ArrowUp"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="n"?(i.y-=n,i.height+=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="s"?i.height-=n:s==="se"&&(i.width-=n,i.height-=n):t==="ArrowDown"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="n"?(i.y+=n,i.height-=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="s"?i.height+=n:s==="se"&&(i.width+=n,i.height+=n)),i}const i4={capture:!0,passive:!1};let Rpt=0;const l0=class Vp extends P.PureComponent{constructor(){super(...arguments),yl(this,"docMoveBound",!1),yl(this,"mouseDownOnCrop",!1),yl(this,"dragStarted",!1),yl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),yl(this,"componentRef",P.createRef()),yl(this,"mediaRef",P.createRef()),yl(this,"resizeObserver"),yl(this,"initChangeCalled",!1),yl(this,"instanceId",`rc-${Rpt++}`),yl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),yl(this,"onCropPointerDown",t=>{const{crop:n,disabled:s}=this.props,i=this.getBox();if(!n)return;const o=eg(n,i.width,i.height);if(s)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=t.target.dataset.ord,a=!!l;let h=t.clientX,p=t.clientY,x=o.x,y=o.y;if(l){const w=t.clientX-i.x,j=t.clientY-i.y;let S=0,C=0;l==="ne"||l=="e"?(S=w-(o.x+o.width),C=j-o.y,x=o.x,y=o.y+o.height):l==="se"||l==="s"?(S=w-(o.x+o.width),C=j-(o.y+o.height),x=o.x,y=o.y):l==="sw"||l=="w"?(S=w-o.x,C=j-(o.y+o.height),x=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(S=w-o.x,C=j-o.y,x=o.x+o.width,y=o.y+o.height),h=x+i.x+S,p=y+i.y+C}this.evData={startClientX:h,startClientY:p,startCropX:x,startCropY:y,clientX:t.clientX,clientY:t.clientY,isResize:a,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),yl(this,"onComponentPointerDown",t=>{const{crop:n,disabled:s,locked:i,keepSelection:o,onChange:l}=this.props,a=this.getBox();if(s||i||o&&n)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=t.clientX-a.x,p=t.clientY-a.y,x={unit:"px",x:h,y:p,width:0,height:0};this.evData={startClientX:t.clientX,startClientY:t.clientY,startCropX:h,startCropY:p,clientX:t.clientX,clientY:t.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(eg(x,a.width,a.height),x0(x,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),yl(this,"onDocPointerMove",t=>{const{crop:n,disabled:s,onChange:i,onDragStart:o}=this.props,l=this.getBox();if(s||!n||!this.mouseDownOnCrop)return;t.cancelable&&t.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(t));const{evData:a}=this;a.clientX=t.clientX,a.clientY=t.clientY;let h;a.isResize?h=this.resizeCrop():h=this.dragCrop(),wke(n,h)||i(eg(h,l.width,l.height),x0(h,l.width,l.height))}),yl(this,"onComponentKeyDown",t=>{const{crop:n,disabled:s,onChange:i,onComplete:o}=this.props;if(s)return;const l=t.key;let a=!1;if(!n)return;const h=this.getBox(),p=this.makePixelCrop(h),x=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?Vp.nudgeStepLarge:t.shiftKey?Vp.nudgeStepMedium:Vp.nudgeStep;if(l==="ArrowLeft"?(p.x-=x,a=!0):l==="ArrowRight"?(p.x+=x,a=!0):l==="ArrowUp"?(p.y-=x,a=!0):l==="ArrowDown"&&(p.y+=x,a=!0),a){t.cancelable&&t.preventDefault(),p.x=s4(p.x,0,h.width-p.width),p.y=s4(p.y,0,h.height-p.height);const y=eg(p,h.width,h.height),w=x0(p,h.width,h.height);i(y,w),o&&o(y,w)}}),yl(this,"onHandlerKeyDown",(t,n)=>{const{aspect:s=0,crop:i,disabled:o,minWidth:l=0,minHeight:a=0,maxWidth:h,maxHeight:p,onChange:x,onComplete:y}=this.props,w=this.getBox();if(o||!i)return;if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")t.stopPropagation(),t.preventDefault();else return;const j=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?Vp.nudgeStepLarge:t.shiftKey?Vp.nudgeStepMedium:Vp.nudgeStep,S=eg(i,w.width,w.height),C=Dpt(S,t.key,j,n),A=jke(C,s,n,w.width,w.height,l,a,h,p);if(!wke(i,A)){const E=x0(A,w.width,w.height);x(A,E),y&&y(A,E)}}),yl(this,"onDocPointerDone",t=>{const{crop:n,disabled:s,onComplete:i,onDragEnd:o}=this.props,l=this.getBox();this.unbindDocMove(),!(s||!n)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(t),i&&i(eg(n,l.width,l.height),x0(n,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),yl(this,"onDragFocus",()=>{var t;(t=this.componentRef.current)==null||t.scrollTo(0,0)})}get document(){return document}getBox(){const t=this.mediaRef.current;if(!t)return{x:0,y:0,width:0,height:0};const{x:n,y:s,width:i,height:o}=t.getBoundingClientRect();return{x:n,y:s,width:i,height:o}}componentDidUpdate(t){const{crop:n,onComplete:s}=this.props;if(s&&!t.crop&&n){const{width:i,height:o}=this.getBox();i&&o&&s(eg(n,i,o),x0(n,i,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,i4),this.document.addEventListener("pointerup",this.onDocPointerDone,i4),this.document.addEventListener("pointercancel",this.onDocPointerDone,i4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,i4),this.document.removeEventListener("pointerup",this.onDocPointerDone,i4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,i4),this.docMoveBound=!1)}getCropStyle(){const{crop:t}=this.props;if(t)return{top:`${t.y}${t.unit}`,left:`${t.x}${t.unit}`,width:`${t.width}${t.unit}`,height:`${t.height}${t.unit}`}}dragCrop(){const{evData:t}=this,n=this.getBox(),s=this.makePixelCrop(n),i=t.clientX-t.startClientX,o=t.clientY-t.startClientY;return s.x=s4(t.startCropX+i,0,n.width-s.width),s.y=s4(t.startCropY+o,0,n.height-s.height),s}getPointRegion(t,n,s,i){const{evData:o}=this,l=o.clientX-t.x,a=o.clientY-t.y;let h;i&&n?h=n==="nw"||n==="n"||n==="ne":h=a1?o?[o,o/n]:[l*n,l]:l?[l*n,l]:[o,o/n]}resizeCrop(){const{evData:t}=this,{aspect:n=0,maxWidth:s,maxHeight:i}=this.props,o=this.getBox(),[l,a]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let h=this.makePixelCrop(o);const p=this.getPointRegion(o,t.ord,l,a),x=t.ord||p;let y=t.clientX-t.startClientX,w=t.clientY-t.startClientY;(l&&x==="nw"||x==="w"||x==="sw")&&(y=Math.min(y,-l)),(a&&x==="nw"||x==="n"||x==="ne")&&(w=Math.min(w,-a));const j={unit:"px",x:0,y:0,width:0,height:0};p==="ne"?(j.x=t.startCropX,j.width=y,n?(j.height=j.width/n,j.y=t.startCropY-j.height):(j.height=Math.abs(w),j.y=t.startCropY-j.height)):p==="se"?(j.x=t.startCropX,j.y=t.startCropY,j.width=y,n?j.height=j.width/n:j.height=w):p==="sw"?(j.x=t.startCropX+y,j.y=t.startCropY,j.width=Math.abs(y),n?j.height=j.width/n:j.height=w):p==="nw"&&(j.x=t.startCropX+y,j.width=Math.abs(y),n?(j.height=j.width/n,j.y=t.startCropY-j.height):(j.height=Math.abs(w),j.y=t.startCropY+w));const S=jke(j,n,p,o.width,o.height,l,a,s,i);return n||Vp.xyOrds.indexOf(x)>-1?h=S:Vp.xOrds.indexOf(x)>-1?(h.x=S.x,h.width=S.width):Vp.yOrds.indexOf(x)>-1&&(h.y=S.y,h.height=S.height),h.x=s4(h.x,0,o.width-h.width),h.y=s4(h.y,0,o.height-h.height),h}renderCropSelection(){const{ariaLabels:t=Vp.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:i,ruleOfThirds:o,crop:l}=this.props,a=this.getCropStyle();if(l)return rt.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&&rt.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},rt.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),rt.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),rt.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),rt.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"nw"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"n"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"ne"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"e"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"se"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"s"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"sw"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"w"),role:"button"})),i&&rt.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:h=>h.stopPropagation()},i(this.state)),o&&rt.createElement(rt.Fragment,null,rt.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),rt.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(t){const n={..._te,...this.props.crop||{}};return eg(n,t.width,t.height)}render(){const{aspect:t,children:n,circularCrop:s,className:i,crop:o,disabled:l,locked:a,style:h,ruleOfThirds:p}=this.props,{cropIsActive:x,newCropIsBeingDrawn:y}=this.state,w=o?this.renderCropSelection():null,j=Ppt("ReactCrop",i,x&&"ReactCrop--active",l&&"ReactCrop--disabled",a&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&t&&"ReactCrop--fixed-aspect",o&&s&&"ReactCrop--circular-crop",o&&p&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",s&&"ReactCrop--no-animate");return rt.createElement("div",{ref:this.componentRef,className:j,style:h},rt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?rt.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},rt.createElement("defs",null,rt.createElement("mask",{id:`hole-${this.instanceId}`},rt.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?rt.createElement("ellipse",{cx:`${o.x+o.width/2}${o.unit}`,cy:`${o.y+o.height/2}${o.unit}`,rx:`${o.width/2}${o.unit}`,ry:`${o.height/2}${o.unit}`,fill:"black"}):rt.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),rt.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,w)}};yl(l0,"xOrds",["e","w"]),yl(l0,"yOrds",["n","s"]),yl(l0,"xyOrds",["nw","ne","se","sw"]),yl(l0,"nudgeStep",1),yl(l0,"nudgeStepMedium",10),yl(l0,"nudgeStepLarge",100),yl(l0,"defaultProps",{ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}});let Fpt=l0;var UOe=["PageUp","PageDown"],qOe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VOe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},h3="Slider",[Mhe,zpt,Bpt]=aI(h3),[HOe]=Ql(h3,[Bpt]),[$pt,Sse]=HOe(h3),WOe=P.forwardRef((e,t)=>{const{name:n,min:s=0,max:i=100,step:o=1,orientation:l="horizontal",disabled:a=!1,minStepsBetweenThumbs:h=0,defaultValue:p=[s],value:x,onValueChange:y=()=>{},onValueCommit:w=()=>{},inverted:j=!1,form:S,...C}=e,A=P.useRef(new Set),E=P.useRef(0),O=l==="horizontal"?Upt:qpt,[z=[],F]=Lu({prop:x,defaultProp:p,onChange:ue=>{var be;(be=[...A.current][E.current])==null||be.focus(),y(ue)}}),q=P.useRef(z);function H(ue){const he=Kpt(z,ue);re(ue,he)}function K(ue){re(ue,E.current)}function Z(){const ue=q.current[E.current];z[E.current]!==ue&&w(z)}function re(ue,he,{commit:be}={commit:!1}){const ne=Qpt(o),ye=Jpt(Math.round((ue-s)/o)*o+s,ne),ie=JA(ye,[s,i]);F((fe=[])=>{const de=Wpt(fe,ie,he);if(Xpt(de,h*o)){E.current=de.indexOf(ie);const _e=String(de)!==String(fe);return _e&&be&&w(de),_e?de:fe}else return fe})}return r.jsx($pt,{scope:e.__scopeSlider,name:n,disabled:a,min:s,max:i,valueIndexToChangeRef:E,thumbs:A.current,values:z,orientation:l,form:S,children:r.jsx(Mhe.Provider,{scope:e.__scopeSlider,children:r.jsx(Mhe.Slot,{scope:e.__scopeSlider,children:r.jsx(O,{"aria-disabled":a,"data-disabled":a?"":void 0,...C,ref:t,onPointerDown:cn(C.onPointerDown,()=>{a||(q.current=z)}),min:s,max:i,inverted:j,onSlideStart:a?void 0:H,onSlideMove:a?void 0:K,onSlideEnd:a?void 0:Z,onHomeKeyDown:()=>!a&&re(s,0,{commit:!0}),onEndKeyDown:()=>!a&&re(i,z.length-1,{commit:!0}),onStepKeyDown:({event:ue,direction:he})=>{if(!a){const ye=UOe.includes(ue.key)||ue.shiftKey&&qOe.includes(ue.key)?10:1,ie=E.current,fe=z[ie],de=o*ye*he;re(fe+de,ie,{commit:!0})}}})})})})});WOe.displayName=h3;var[GOe,KOe]=HOe(h3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Upt=P.forwardRef((e,t)=>{const{min:n,max:s,dir:i,inverted:o,onSlideStart:l,onSlideMove:a,onSlideEnd:h,onStepKeyDown:p,...x}=e,[y,w]=P.useState(null),j=ei(t,O=>w(O)),S=P.useRef(void 0),C=rk(i),A=C==="ltr",E=A&&!o||!A&&o;function T(O){const z=S.current||y.getBoundingClientRect(),F=[0,z.width],H=Nxe(F,E?[n,s]:[s,n]);return S.current=z,H(O-z.left)}return r.jsx(GOe,{scope:e.__scopeSlider,startEdge:E?"left":"right",endEdge:E?"right":"left",direction:E?1:-1,size:"width",children:r.jsx(ZOe,{dir:C,"data-orientation":"horizontal",...x,ref:j,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:O=>{const z=T(O.clientX);l==null||l(z)},onSlideMove:O=>{const z=T(O.clientX);a==null||a(z)},onSlideEnd:()=>{S.current=void 0,h==null||h()},onStepKeyDown:O=>{const F=VOe[E?"from-left":"from-right"].includes(O.key);p==null||p({event:O,direction:F?-1:1})}})})}),qpt=P.forwardRef((e,t)=>{const{min:n,max:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:a,onStepKeyDown:h,...p}=e,x=P.useRef(null),y=ei(t,x),w=P.useRef(void 0),j=!i;function S(C){const A=w.current||x.current.getBoundingClientRect(),E=[0,A.height],O=Nxe(E,j?[s,n]:[n,s]);return w.current=A,O(C-A.top)}return r.jsx(GOe,{scope:e.__scopeSlider,startEdge:j?"bottom":"top",endEdge:j?"top":"bottom",size:"height",direction:j?1:-1,children:r.jsx(ZOe,{"data-orientation":"vertical",...p,ref:y,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:C=>{const A=S(C.clientY);o==null||o(A)},onSlideMove:C=>{const A=S(C.clientY);l==null||l(A)},onSlideEnd:()=>{w.current=void 0,a==null||a()},onStepKeyDown:C=>{const E=VOe[j?"from-bottom":"from-top"].includes(C.key);h==null||h({event:C,direction:E?-1:1})}})})}),ZOe=P.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:a,onStepKeyDown:h,...p}=e,x=Sse(h3,n);return r.jsx(Rn.span,{...p,ref:t,onKeyDown:cn(e.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(a(y),y.preventDefault()):UOe.concat(qOe).includes(y.key)&&(h(y),y.preventDefault())}),onPointerDown:cn(e.onPointerDown,y=>{const w=y.target;w.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(w)?w.focus():s(y)}),onPointerMove:cn(e.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&i(y)}),onPointerUp:cn(e.onPointerUp,y=>{const w=y.target;w.hasPointerCapture(y.pointerId)&&(w.releasePointerCapture(y.pointerId),o(y))})})}),YOe="SliderTrack",XOe=P.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,i=Sse(YOe,n);return r.jsx(Rn.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...s,ref:t})});XOe.displayName=YOe;var The="SliderRange",QOe=P.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,i=Sse(The,n),o=KOe(The,n),l=P.useRef(null),a=ei(t,l),h=i.values.length,p=i.values.map(w=>tDe(w,i.min,i.max)),x=h>1?Math.min(...p):0,y=100-Math.max(...p);return r.jsx(Rn.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...s,ref:a,style:{...e.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});QOe.displayName=The;var Ahe="SliderThumb",JOe=P.forwardRef((e,t)=>{const n=zpt(e.__scopeSlider),[s,i]=P.useState(null),o=ei(t,a=>i(a)),l=P.useMemo(()=>s?n().findIndex(a=>a.ref.current===s):-1,[n,s]);return r.jsx(Vpt,{...e,ref:o,index:l})}),Vpt=P.forwardRef((e,t)=>{const{__scopeSlider:n,index:s,name:i,...o}=e,l=Sse(Ahe,n),a=KOe(Ahe,n),[h,p]=P.useState(null),x=ei(t,T=>p(T)),y=h?l.form||!!h.closest("form"):!0,w=cI(h),j=l.values[s],S=j===void 0?0:tDe(j,l.min,l.max),C=Gpt(s,l.values.length),A=w==null?void 0:w[a.size],E=A?Zpt(A,S,a.direction):0;return P.useEffect(()=>{if(h)return l.thumbs.add(h),()=>{l.thumbs.delete(h)}},[h,l.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${S}% + ${E}px)`},children:[r.jsx(Mhe.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Rn.span,{role:"slider","aria-label":e["aria-label"]||C,"aria-valuemin":l.min,"aria-valuenow":j,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:x,style:j===void 0?{display:"none"}:e.style,onFocus:cn(e.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(eDe,{name:i??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:j},s)]})});JOe.displayName=Ahe;var Hpt="RadioBubbleInput",eDe=P.forwardRef(({__scopeSlider:e,value:t,...n},s)=>{const i=P.useRef(null),o=ei(i,s),l=vI(t);return P.useEffect(()=>{const a=i.current;if(!a)return;const h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&x){const y=new Event("input",{bubbles:!0});x.call(a,t),a.dispatchEvent(y)}},[l,t]),r.jsx(Rn.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});eDe.displayName=Hpt;function Wpt(e=[],t,n){const s=[...e];return s[n]=t,s.sort((i,o)=>i-o)}function tDe(e,t,n){const o=100/(n-t)*(e-t);return JA(o,[0,100])}function Gpt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Kpt(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),s=Math.min(...n);return n.indexOf(s)}function Zpt(e,t,n){const s=e/2,o=Nxe([0,50],[0,s]);return(s-o(t)*n)*n}function Ypt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Xpt(e,t){if(t>0){const n=Ypt(e);return Math.min(...n)>=t}return!0}function Nxe(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function Qpt(e){return(String(e).split(".")[1]||"").length}function Jpt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var rDe=WOe,emt=XOe,tmt=QOe,rmt=JOe;const zw=P.forwardRef(({className:e,...t},n)=>r.jsxs(rDe,{ref:n,className:$t("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(emt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(tmt,{className:"absolute h-full bg-primary"})}),r.jsx(rmt,{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"})]}));zw.displayName=rDe.displayName;function nmt(e,t,n){return Opt(Lpt({unit:"%",width:90},n,e,t),e,t)}const smt=({open:e,onClose:t,imageSrc:n,onCropComplete:s,aspectRatio:i=1})=>{const o=P.useRef(null),[l,a]=P.useState(),[h,p]=P.useState(),[x,y]=P.useState(1),[w,j]=P.useState(0),S=P.useCallback(E=>{const{width:T,height:O}=E.currentTarget;a(nmt(T,O,i))},[i]),C=P.useCallback(async()=>{const E=o.current;if(!E||!h)return;const T=document.createElement("canvas"),O=T.getContext("2d");if(!O)return;const z=E.naturalWidth/E.width,F=E.naturalHeight/E.height,q=400;T.width=q,T.height=q,O.imageSmoothingQuality="high";const H=h.x*z,K=h.y*F,Z=h.width*z,re=h.height*F,ue=w*Math.PI/180,he=T.width/2,be=T.height/2;return O.save(),O.translate(he,be),O.rotate(ue),O.scale(x,x),O.translate(-he,-be),O.drawImage(E,H,K,Z,re,0,0,q,q),O.restore(),new Promise((ne,ye)=>{T.toBlob(ie=>{ie?ne(ie):ye(new Error("Canvas is empty"))},"image/jpeg",.95)})},[h,x,w]),A=async()=>{try{const E=await C();E&&(s(E),t())}catch(E){console.error("Error cropping image:",E)}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Crop Your Photo"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative max-h-[400px] overflow-hidden rounded-lg bg-muted flex items-center justify-center",children:r.jsx(Fpt,{crop:l,onChange:(E,T)=>a(T),onComplete:E=>p(E),aspect:i,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${x}) rotate(${w}deg)`,maxHeight:"400px",width:"auto"},onLoad:S})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(xS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(zw,{value:[x],min:.5,max:3,step:.1,onValueChange:([E])=>y(E),className:"flex-1"}),r.jsx(gS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(VT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(zw,{value:[w],min:-180,max:180,step:1,onValueChange:([E])=>j(E),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[w,"°"]})]})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(J,{onClick:A,children:"Save Photo"})]})]})})},imt=()=>{const{user:e}=zr(),{toast:t}=pa(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[l,a]=P.useState(null);P.useEffect(()=>{e&&h()},[e]);const h=async()=>{s(!0);try{const{data:y}=await ee.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",e==null?void 0:e.id).single();y&&a({status:y.subscription_status||"none",productId:y.subscription_product_id,endDate:y.subscription_end_date,isGrandfathered:y.is_grandfathered||!1})}catch(y){console.error("Error loading subscription:",y)}finally{s(!1)}},p=async()=>{o(!0);try{const{data:{session:y}}=await ee.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:w,error:j}=await ee.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(j)throw j;w!=null&&w.url&&window.open(w.url,"_blank")}catch(y){console.error("Error opening customer portal:",y),t({title:"Error",description:y.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},x=()=>{if(l!=null&&l.isGrandfathered)return r.jsx(Ft,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(Ft,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Ft,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Ft,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Ft,{variant:"secondary",children:"Canceled"});default:return r.jsx(Ft,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(hm,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(hm,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(En,{children:"Manage your subscription and billing"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Status"}),r.jsx("div",{className:"mt-1",children:x()})]}),(l==null?void 0:l.endDate)&&l.status==="active"&&r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),r.jsx("p",{className:"font-medium",children:new Date(l.endDate).toLocaleDateString()})]})]}),l!=null&&l.isGrandfathered?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your account was upgraded from LevelUp 1.0. To update/manage your subscription please reach out to support."}):(l==null?void 0:l.status)==="active"||(l==null?void 0:l.status)==="trialing"?r.jsxs(r.Fragment,{children:[(l==null?void 0:l.status)==="trialing"&&(l==null?void 0:l.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(l.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(J,{onClick:p,variant:"outline",disabled:i,children:[i?r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ls,{className:"mr-2 h-4 w-4"}),"Manage Billing"]})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have an active subscription."})]})]})},amt=()=>{const{user:e}=zr(),t=ns(),{toast:n}=pa(),[s]=Fd(),i=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:a,isLoading:h,subscribe:p,unsubscribe:x}=iOe(),[y,w]=P.useState(!1),[j,S]=P.useState(""),[C,A]=P.useState(!1),[E,T]=P.useState(!1),[O,z]=P.useState(""),[F,q]=P.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}),[H,K]=P.useState(!1),[Z,re]=P.useState(!1),[ue,he]=P.useState({newPassword:"",confirmPassword:""});P.useEffect(()=>{e&&be()},[e]),P.useEffect(()=>{o&&e&&setTimeout(()=>{var de;(de=document.getElementById("change-password-section"))==null||de.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,e]);const be=async()=>{var de,_e,Ee;if(!(e!=null&&e.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",e.id);const{data:ke,error:pe}=await ee.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("id",e.id).maybeSingle();if(pe)throw console.error("Profile query error:",pe),pe;ke?(console.log("Profile loaded successfully:",ke),q({name:ke.name||"",email:ke.email||"",title:ke.title||"",bio:ke.bio||"",areas_served:ke.areas_served||"",years_experience:((de=ke.years_experience)==null?void 0:de.toString())||"",instagram_url:ke.instagram_url||"",facebook_url:ke.facebook_url||"",linkedin_url:ke.linkedin_url||""}),K(ke.digest_opt_out||!1)):(console.warn("No profile found for user"),q({name:((_e=e.user_metadata)==null?void 0:_e.name)||((Ee=e.email)==null?void 0:Ee.split("@")[0])||"",email:e.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}));const{data:ae}=await ee.storage.from("avatars").list(`${e.id}`);if(ae&&ae.length>0){const{data:ge}=ee.storage.from("avatars").getPublicUrl(`${e.id}/${ae[0].name}`);S(ge.publicUrl)}}catch(ke){console.error("Error loading profile:",ke),n({title:"Error",description:ke.message||"Failed to load profile",variant:"destructive"})}},ne=de=>{var ke;const _e=(ke=de.target.files)==null?void 0:ke[0];if(!_e)return;const Ee=new FileReader;Ee.onloadend=()=>{z(Ee.result),T(!0)},Ee.readAsDataURL(_e),de.target.value=""},ye=async de=>{if(e){A(!0);try{const{data:_e}=await ee.storage.from("avatars").list(`${e.id}`);_e&&_e.length>0&&await ee.storage.from("avatars").remove(_e.map(ge=>`${e.id}/${ge.name}`));const ke=`${e.id}/avatar.jpg`,{error:pe}=await ee.storage.from("avatars").upload(ke,de,{upsert:!0,contentType:"image/jpeg"});if(pe)throw pe;const{data:ae}=ee.storage.from("avatars").getPublicUrl(ke);S(`${ae.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(_e){console.error("Error uploading avatar:",_e),n({title:"Error",description:_e.message||"Failed to upload photo",variant:"destructive"})}finally{A(!1)}}},ie=async()=>{if(!F.name.trim()||!F.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}w(!0);try{const{error:de}=await ee.from("profiles").update({name:F.name.trim(),email:F.email.trim(),title:F.title.trim()||null,bio:F.bio.trim()||null,areas_served:F.areas_served.trim()||null,years_experience:F.years_experience?parseInt(F.years_experience):null,instagram_url:F.instagram_url.trim()||null,facebook_url:F.facebook_url.trim()||null,linkedin_url:F.linkedin_url.trim()||null}).eq("id",e==null?void 0:e.id);if(de)throw de;n({title:"Success",description:"Profile updated successfully"})}catch(de){console.error("Error updating profile:",de),n({title:"Error",description:de.message||"Failed to update profile",variant:"destructive"})}finally{w(!1)}},fe=async()=>{if(!ue.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(ue.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(ue.newPassword!==ue.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}w(!0);try{const{error:de}=await ee.auth.updateUser({password:ue.newPassword});if(de)throw de;n({title:"Success",description:"Password updated successfully"}),he({newPassword:"",confirmPassword:""}),i&&setTimeout(()=>t("/dashboard"),1e3)}catch(de){console.error("Error updating password:",de),n({title:"Error",description:de.message||"Failed to update password",variant:"destructive"})}finally{w(!1)}};return r.jsx(Or,{title:i?"Complete Your Profile":o?"Reset Your Password":"Profile Settings",description:i?"Welcome! Please complete your profile setup":o?"Please set a new password for your account":"Manage your account information and password",children:r.jsxs("div",{className:"mx-auto max-w-4xl",children:[!i&&!o&&r.jsx("div",{className:"mb-6",children:r.jsxs(J,{variant:"outline",onClick:()=>{var de;(de=document.getElementById("change-password-section"))==null||de.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(mj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Profile Photo"}),r.jsx(En,{children:"Upload a professional photo for your profile"})]}),r.jsxs(Xe,{className:"flex items-center gap-6",children:[r.jsxs(ci,{className:"h-24 w-24",children:[r.jsx(Wa,{src:j}),r.jsx(di,{className:"text-2xl",children:F.name.split(" ").map(de=>de[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ne,disabled:C}),r.jsxs(J,{variant:"outline",onClick:()=>{var de;return(de=document.getElementById("avatar-upload"))==null?void 0:de.click()},disabled:C,children:[r.jsx(go,{className:"mr-2 h-4 w-4"}),C?"Uploading...":"Upload Photo"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload an image and crop it to your liking."})]})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Personal Information"}),r.jsx(En,{children:"Update your profile details"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",value:F.name,onChange:de=>q({...F,name:de.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"email",children:"Email"}),r.jsx(ct,{id:"email",type:"email",value:F.email,onChange:de=>q({...F,email:de.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Job Title"}),r.jsx(ct,{id:"title",value:F.title,onChange:de=>q({...F,title:de.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"bio",children:"Bio"}),r.jsx(ct,{id:"bio",value:F.bio,onChange:de=>q({...F,bio:de.target.value}),placeholder:"A short description about yourself",maxLength:500})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(ct,{id:"areas_served",value:F.areas_served,onChange:de=>q({...F,areas_served:de.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(ct,{id:"years_experience",type:"number",min:"0",value:F.years_experience,onChange:de=>q({...F,years_experience:de.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(ct,{value:F.linkedin_url,onChange:de=>q({...F,linkedin_url:de.target.value}),placeholder:"LinkedIn URL"}),r.jsx(ct,{value:F.instagram_url,onChange:de=>q({...F,instagram_url:de.target.value}),placeholder:"Instagram URL"}),r.jsx(ct,{value:F.facebook_url,onChange:de=>q({...F,facebook_url:de.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(J,{onClick:ie,disabled:y,children:[r.jsx(bg,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(We,{id:"change-password-section",children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:i?"Set Your Password":"Change Password"}),r.jsx(En,{children:i?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"newPassword",children:"New Password"}),r.jsx(ct,{id:"newPassword",type:"password",value:ue.newPassword,onChange:de=>he({...ue,newPassword:de.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(ct,{id:"confirmPassword",type:"password",value:ue.confirmPassword,onChange:de=>he({...ue,confirmPassword:de.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(J,{onClick:fe,disabled:y,children:[r.jsx(bg,{className:"mr-2 h-4 w-4"}),i?"Complete Setup":"Update Password"]}),i&&r.jsx(J,{variant:"outline",onClick:()=>t("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[a?r.jsx(vg,{className:"h-5 w-5"}):r.jsx(aj,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(En,{children:"Receive browser notifications when new content is added"})]}),r.jsx(Xe,{children:l?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:a?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:a?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx($s,{checked:a,onCheckedChange:de=>{de?p():x()},disabled:h})]}):r.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"Push notifications are not supported in this browser."}),r.jsxs("p",{className:"text-xs",children:[r.jsx("strong",{children:"Desktop:"})," Use Chrome, Firefox, or Edge.",r.jsx("br",{}),r.jsx("strong",{children:"iPhone/iPad:"}),' Open this site in Safari, tap the Share button, then "Add to Home Screen". Push notifications will work from the installed app.']})]})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[H?r.jsx(LT,{className:"h-5 w-5"}):r.jsx(Zs,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(En,{children:"Manage your email subscription settings"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:H?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx($s,{checked:!H,onCheckedChange:async de=>{re(!0);try{const{error:_e}=await ee.from("profiles").update({digest_opt_out:!de}).eq("id",e==null?void 0:e.id);if(_e)throw _e;K(!de),n({title:de?"Subscribed":"Unsubscribed",description:de?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(_e){n({title:"Error",description:_e.message||"Failed to update preference",variant:"destructive"})}finally{re(!1)}},disabled:Z})]})})]}),r.jsx(imt,{})]}),r.jsx(smt,{open:E,onClose:()=>T(!1),imageSrc:O,onCropComplete:ye,aspectRatio:1})]})})};var omt="AspectRatio",nDe=P.forwardRef((e,t)=>{const{ratio:n=1/1,style:s,...i}=e;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx(Rn.div,{...i,ref:t,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});nDe.displayName=omt;var lmt=nDe;const cmt=lmt;function dmt(){const{user:e}=zr(),t=Wr(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),{data:l,isLoading:a}=Jt({queryKey:["calendar-token",e==null?void 0:e.id],queryFn:async()=>{const{data:S,error:C}=await ee.from("profiles").select("calendar_token").eq("id",e==null?void 0:e.id).single();if(C)throw C;return S},enabled:!!e&&i}),h=cr({mutationFn:async()=>{const S=new Uint8Array(12);crypto.getRandomValues(S);const C=btoa(String.fromCharCode(...S)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:A}=await ee.from("profiles").update({calendar_token:C}).eq("id",e==null?void 0:e.id);if(A)throw A;return C},onSuccess:()=>{t.invalidateQueries({queryKey:["calendar-token",e==null?void 0:e.id]}),ze.success("Calendar subscription URL generated!")},onError:S=>{ze.error("Failed to generate calendar URL: "+S.message)}}),p=l!=null&&l.calendar_token?`https://dashboard.relevelup.com/api/calendar/${l.calendar_token}.ics`:null,x=async()=>{p&&(await navigator.clipboard.writeText(p),s(!0),ze.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},y=()=>{p&&(window.location.href=p.replace("https://","webcal://"))},w=()=>{if(p){const S=p.replace("https://","webcal://"),C=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(S)}`;window.open(C,"_blank")}},j=()=>{if(p){const S=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(p)}&name=Level%20Up%20Events`;window.open(S,"_blank")}};return r.jsxs(Br,{open:i,onOpenChange:o,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:"gap-2",children:[r.jsx(Ys,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(es,{children:"Add all Level Up events to your personal calendar. Events will sync automatically and update when we add or change events."})]}),r.jsx("div",{className:"space-y-4 py-4",children:a?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):p?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Your Calendar URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:p,readOnly:!0,className:"text-xs font-mono"}),r.jsx(J,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx(Ca,{className:"h-4 w-4 text-green-500"}):r.jsx(jl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Quick Add"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs(J,{variant:"outline",className:"w-full justify-start gap-2",onClick:y,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"})}),"Add to Apple Calendar",r.jsx(Ls,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(J,{variant:"outline",className:"w-full justify-start gap-2",onClick:w,children:[r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("path",{d:"M19.5 22h-15A2.5 2.5 0 0 1 2 19.5v-15A2.5 2.5 0 0 1 4.5 2H9v2H4.5a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V15h2v4.5a2.5 2.5 0 0 1-2.5 2.5z"}),r.jsx("path",{d:"M12 2v8.5a1.5 1.5 0 0 0 1.5 1.5H22V2h-10z",fill:"#4285F4"}),r.jsx("path",{d:"M12 12V2H4.5A2.5 2.5 0 0 0 2 4.5V12h10z",fill:"#34A853"}),r.jsx("path",{d:"M2 12v7.5A2.5 2.5 0 0 0 4.5 22H12v-10H2z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 22h7.5a2.5 2.5 0 0 0 2.5-2.5V12h-10v10z",fill:"#EA4335"})]}),"Add to Google Calendar",r.jsx(Ls,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(J,{variant:"outline",className:"w-full justify-start gap-2",onClick:j,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V12zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.81v-2.72zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z"})}),"Add to Outlook",r.jsx(Ls,{className:"h-3 w-3 ml-auto opacity-50"})]})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Events sync automatically. If your membership expires, the calendar will show as empty."})]}):r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate your personal calendar subscription URL to get started."}),r.jsx(J,{onClick:()=>h.mutate(),disabled:h.isPending,className:"w-full",children:h.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var Cse="Tabs",[umt]=Ql(Cse,[u3]),sDe=u3(),[hmt,Sxe]=umt(Cse),iDe=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:i,defaultValue:o,orientation:l="horizontal",dir:a,activationMode:h="automatic",...p}=e,x=rk(a),[y,w]=Lu({prop:s,onChange:i,defaultProp:o??"",caller:Cse});return r.jsx(hmt,{scope:n,baseId:Vc(),value:y,onValueChange:w,orientation:l,dir:x,activationMode:h,children:r.jsx(Rn.div,{dir:x,"data-orientation":l,...p,ref:t})})});iDe.displayName=Cse;var aDe="TabsList",oDe=P.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...i}=e,o=Sxe(aDe,n),l=sDe(n);return r.jsx(Fge,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Rn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});oDe.displayName=aDe;var lDe="TabsTrigger",cDe=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:i=!1,...o}=e,l=Sxe(lDe,n),a=sDe(n),h=hDe(l.baseId,s),p=fDe(l.baseId,s),x=s===l.value;return r.jsx(zge,{asChild:!0,...a,focusable:!i,active:x,children:r.jsx(Rn.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:h,...o,ref:t,onMouseDown:cn(e.onMouseDown,y=>{!i&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:cn(e.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:cn(e.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!i&&y&&l.onValueChange(s)})})})});cDe.displayName=lDe;var dDe="TabsContent",uDe=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:i,children:o,...l}=e,a=Sxe(dDe,n),h=hDe(a.baseId,s),p=fDe(a.baseId,s),x=s===a.value,y=P.useRef(x);return P.useEffect(()=>{const w=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(w)},[]),r.jsx(fc,{present:i||x,children:({present:w})=>r.jsx(Rn.div,{"data-state":x?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":h,hidden:!w,id:p,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:y.current?"0s":void 0},children:w&&o})})});uDe.displayName=dDe;function hDe(e,t){return`${e}-trigger-${t}`}function fDe(e,t){return`${e}-content-${t}`}var fmt=iDe,pDe=oDe,mDe=cDe,gDe=uDe;const ba=fmt,fa=P.forwardRef(({className:e,...t},n)=>r.jsx(pDe,{ref:n,className:$t("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));fa.displayName=pDe.displayName;const ln=P.forwardRef(({className:e,...t},n)=>r.jsx(mDe,{ref:n,className:$t("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",e),...t}));ln.displayName=mDe.displayName;const An=P.forwardRef(({className:e,...t},n)=>r.jsx(gDe,{ref:n,className:$t("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));An.displayName=gDe.displayName;const pmt={first_timer:vs,regular:qx,dedicated:Pl,veteran:Ha,streak_master:Kh,century:Ha},mmt={first_timer:"bg-green-500/10 text-green-500 border-green-500/20",regular:"bg-blue-500/10 text-blue-500 border-blue-500/20",dedicated:"bg-purple-500/10 text-purple-500 border-purple-500/20",veteran:"bg-amber-500/10 text-amber-500 border-amber-500/20",streak_master:"bg-orange-500/10 text-orange-500 border-orange-500/20",century:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20"};function kke(e){return e===1?r.jsx(Ha,{className:"h-5 w-5 text-yellow-500"}):e===2?r.jsx(qx,{className:"h-5 w-5 text-gray-400"}):e===3?r.jsx(Pl,{className:"h-5 w-5 text-amber-600"}):r.jsx("span",{className:"w-5 text-center text-sm font-medium text-muted-foreground",children:e})}function xDe({showUserStats:e=!0,compact:t=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:i}=zr(),{data:o,isLoading:l}=MOe(t?5:10,n),{data:a}=TOe(i==null?void 0:i.id),{data:h}=EOe(i==null?void 0:i.id),{data:p}=AOe(i==null?void 0:i.id);return l?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Pr,{className:"h-12 w-full"},y))})})]}):r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(Xe,{children:[e&&a&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Your Stats"}),h&&r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:["Rank #",h]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-primary",children:a.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Points"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold",children:a.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Kh,{className:"h-4 w-4 text-orange-500"}),r.jsx("div",{className:"text-lg font-bold",children:a.current_streak}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),p&&p.length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[p.slice(0,4).map(x=>{const y=pmt[x.badge_type]||vs;return r.jsxs(Ft,{variant:"outline",className:`text-xs ${mmt[x.badge_type]||""}`,title:x.badge_description||"",children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),x.badge_name]},x.id)}),p.length>4&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:["+",p.length-4," more"]})]})]}),r.jsxs(ba,{defaultValue:"points",className:"w-full",children:[r.jsxs(fa,{className:"w-full mb-3",children:[r.jsx(ln,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(ln,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(An,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((x,y)=>{var w,j,S;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:kke(y+1)}),r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"text-xs",children:((j=(w=x.profile)==null?void 0:w.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((S=x.profile)==null?void 0:S.name)||"Unknown",x.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_events_attended," events"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold text-primary",children:x.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},x.user_id)}),(!o||o.length===0)&&r.jsx("div",{className:"text-center text-muted-foreground py-4 text-sm",children:"No attendance data yet. Attend an event to get on the leaderboard!"})]})}),r.jsx(An,{value:"events",className:"mt-0",children:r.jsx("div",{className:"space-y-2",children:[...o||[]].sort((x,y)=>y.total_events_attended-x.total_events_attended).map((x,y)=>{var w,j,S;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:kke(y+1)}),r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"text-xs",children:((j=(w=x.profile)==null?void 0:w.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((S=x.profile)==null?void 0:S.name)||"Unknown",x.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_points," points"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold",children:x.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},x.user_id)})})})]})]})]})}function gmt(){const e=ns(),{user:t,isAdmin:n}=zr(),s=Wr(),{data:i,isLoading:o}=Jt({queryKey:["public-events"],queryFn:async()=>{const{data:C,error:A}=await ee.from("events").select("*").order("event_date",{ascending:!0});if(A)throw A;return C}}),{data:l}=Jt({queryKey:["my-registrations"],queryFn:async()=>{if(!t)return[];const{data:C,error:A}=await ee.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t.id);if(A)throw A;return C},enabled:!!t}),{data:a}=Jt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:C,error:A}=await ee.from("event_registrations").select("event_id");if(A)throw A;const E={};return C.forEach(T=>{E[T.event_id]=(E[T.event_id]||0)+1}),E}}),h=cr({mutationFn:async C=>{const{data:A,error:E}=await ee.functions.invoke("zoom-register",{body:{event_id:C}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:C=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),C!=null&&C.join_url?ze.success("Successfully registered! You'll receive a Zoom confirmation email."):ze.success("Successfully registered for the event!")},onError:C=>{ze.error("Failed to register: "+C.message)}}),p=cr({mutationFn:async C=>{const{data:A,error:E}=await ee.functions.invoke("zoom-unregister",{body:{event_id:C}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),ze.success("Registration cancelled and removed from Zoom")},onError:C=>{ze.error("Failed to cancel: "+C.message)}}),x=C=>l==null?void 0:l.some(A=>A.event_id===C),y=C=>{const A=l==null?void 0:l.find(E=>E.event_id===C);return A==null?void 0:A.zoom_join_url},w=C=>C.capacity?((a==null?void 0:a[C.id])||0)>=C.capacity:!1,j=(i==null?void 0:i.filter(C=>MS(C.event_date)!=="ended"))||[],S=(i==null?void 0:i.filter(C=>MS(C.event_date)==="ended"))||[];return r.jsx(Or,{title:"Events",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Events"}),r.jsx("p",{className:"text-muted-foreground",children:"Browse and register for upcoming events"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dmt,{}),n&&r.jsx(J,{variant:"outline",onClick:()=>e("/admin/events"),children:"Manage Events"})]})]}),r.jsxs("div",{className:`grid grid-cols-1 ${n?"lg:grid-cols-3":""} gap-6`,children:[r.jsxs("div",{className:n?"lg:col-span-2":"",children:[o?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading events..."}):j.length===0?r.jsx(We,{className:"text-center py-12",children:r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:j.map(C=>{const A=MS(C.event_date),E=xxe(C.event_date),T=A==="live",O=A==="starting_soon";return r.jsxs(We,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${T?"border-red-500 ring-2 ring-red-500/20":O?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>e(`/events/${C.id}`),children:[E&&r.jsxs("div",{className:`${T?"bg-red-500":"bg-amber-500"} text-white px-3 py-1.5 flex items-center gap-2 text-sm font-medium`,children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),T?r.jsxs(r.Fragment,{children:[r.jsx(yj,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ki,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),C.image_url&&r.jsx(cmt,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:C.image_url,alt:C.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Wt,{children:[r.jsx(Xt,{className:"line-clamp-2",children:C.title}),C.description&&r.jsx(En,{className:"line-clamp-2",children:C.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(Xe,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ys,{className:"h-4 w-4"}),fn(new Date(C.event_date),"EEEE, MMMM d, yyyy")]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ki,{className:"h-4 w-4"}),xte(new Date(C.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Kn,{className:"h-4 w-4"}),(a==null?void 0:a[C.id])||0," registered",C.capacity&&` / ${C.capacity} spots`]})]}),r.jsx(sA,{className:"flex gap-2",onClick:z=>z.stopPropagation(),children:x(C.id)?r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"outline",className:"flex-1",onClick:()=>p.mutate(C.id),disabled:p.isPending,children:[r.jsx(Ts,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(J,{className:"flex-1",onClick:()=>window.open(y(C.id)||C.zoom_link,"_blank"),children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(J,{className:"w-full",onClick:()=>h.mutate(C.id),disabled:h.isPending||w(C),children:w(C)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},C.id)})}),S.length>0&&r.jsxs("div",{className:"mt-12",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4 text-muted-foreground",children:"Past Events"}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:S.map(C=>r.jsx(We,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>e(`/events/${C.id}`),children:r.jsxs(Wt,{children:[r.jsx(Xt,{className:"text-base line-clamp-1",children:C.title}),r.jsx(En,{children:fn(new Date(C.event_date),"MMMM d, yyyy")})]})},C.id))})]})]}),n&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(xDe,{showUserStats:!0})})]})]})})}const Jle=[{value:"all",label:"All Roles",icon:Kn},{value:"brokerage_manager",label:"Brokerage Managers",icon:JT},{value:"admin",label:"Admins",icon:Gf}];function xmt({open:e,onOpenChange:t,resourceType:n,resourceId:s,resourceTitle:i}){var Ce,Je;const{user:o,isAdmin:l,isBrokerageManager:a}=zr(),[h,p]=P.useState([]),[x,y]=P.useState([]),[w,j]=P.useState([]),[S,C]=P.useState([]),[A,E]=P.useState(""),[T,O]=P.useState(""),[z,F]=P.useState(""),[q,H]=P.useState(!1),[K,Z]=P.useState(!1),[re,ue]=P.useState("agents"),[he,be]=P.useState("all"),[ne,ye]=P.useState({}),ie=l||a;P.useEffect(()=>{e&&o&&(l?fe():de())},[e,o,l]),P.useEffect(()=>{e||(j([]),C([]),E(""),O(""),F(""),ue("agents"),be("all"))},[e]);const fe=async()=>{if(o){H(!0);try{const{data:Te,error:Ye}=await ee.from("brokerages").select("id, name").order("name");if(Ye)throw Ye;const xe=1e3,mt={};let et=0,nt=!0;for(;nt;){const{data:Be,error:Qe}=await ee.from("profiles").select("brokerage_id").range(et*xe,(et+1)*xe-1);if(Qe)throw Qe;Be==null||Be.forEach(tt=>{tt.brokerage_id&&(mt[tt.brokerage_id]=(mt[tt.brokerage_id]||0)+1)}),nt=(Be==null?void 0:Be.length)===xe,et++}y((Te==null?void 0:Te.map(Be=>({...Be,agent_count:mt[Be.id]||0})))||[]);const Ae=[];for(et=0,nt=!0;nt;){const{data:Be,error:Qe}=await ee.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(et*xe,(et+1)*xe-1);if(Qe)throw Qe;Be&&Ae.push(...Be),nt=(Be==null?void 0:Be.length)===xe,et++}const pt={};for(et=0,nt=!0;nt;){const{data:Be,error:Qe}=await ee.from("user_roles").select("user_id, role").range(et*xe,(et+1)*xe-1);if(Qe)throw Qe;Be==null||Be.forEach(tt=>{pt[tt.user_id]||(pt[tt.user_id]=[]),pt[tt.user_id].push(tt.role)}),nt=(Be==null?void 0:Be.length)===xe,et++}ye(pt),p(Ae.map(Be=>{var Qe;return{id:Be.id,name:Be.name,email:Be.email,brokerage_name:((Qe=Be.brokerages)==null?void 0:Qe.name)||"No Brokerage",roles:pt[Be.id]||[]}}))}catch(Te){console.error("Error loading data:",Te),ze.error("Failed to load agents and brokerages")}finally{H(!1)}}},de=async()=>{if(o){H(!0);try{const{data:Te}=await ee.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Te!=null&&Te.brokerage_id)){ze.error("You must be part of a brokerage to share resources"),t(!1);return}const{data:Ye,error:xe}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",Te.brokerage_id).neq("id",o.id).order("name");if(xe)throw xe;p(Ye||[])}catch(Te){console.error("Error loading agents:",Te),ze.error("Failed to load agents")}finally{H(!1)}}},_e=h.filter(Te=>{var xe;const Ye=Te.name.toLowerCase().includes(A.toLowerCase())||Te.email.toLowerCase().includes(A.toLowerCase())||((xe=Te.brokerage_name)==null?void 0:xe.toLowerCase().includes(A.toLowerCase()));if(l&&he!=="all"){const mt=ne[Te.id]||[];return Ye&&mt.includes(he)}return Ye}),Ee=x.filter(Te=>Te.name.toLowerCase().includes(T.toLowerCase())),ke=()=>{w.length===_e.length?j([]):j(_e.map(Te=>Te.id))},pe=()=>{S.length===Ee.length?C([]):C(Ee.map(Te=>Te.id))},ae=Te=>{if(!ie){j([Te]);return}j(Ye=>Ye.includes(Te)?Ye.filter(xe=>xe!==Te):[...Ye,Te])},ge=Te=>{C(Ye=>Ye.includes(Te)?Ye.filter(xe=>xe!==Te):[...Ye,Te])},Me=async()=>{if(!(w.length>0||S.length>0)){ze.error("Please select at least one agent or brokerage to share with");return}Z(!0);try{const{data:Ye,error:xe}=await ee.functions.invoke("send-share-notification",{body:{recipientIds:w,brokerageIds:S,resourceType:n,resourceId:s,resourceTitle:i,message:z.trim()||void 0}});if(xe)throw xe;const mt=(Ye==null?void 0:Ye.sharesCreated)||w.length;ze.success(`Shared with ${mt} agent${mt!==1?"s":""}`),t(!1)}catch(Ye){console.error("Error sharing resource:",Ye),ze.error("Failed to share resource")}finally{Z(!1)}},Ue=Te=>Te.split(" ").map(Ye=>Ye[0]).join("").toUpperCase().slice(0,2),Ie=Te=>{const Ye=ne[Te]||[];return Ye.includes("admin")?r.jsx(Ft,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):Ye.includes("brokerage_manager")?r.jsx(Ft,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Ke=w.length+S.length,Re=he!=="all"?_e.length:null;return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{className:"flex-shrink-0",children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Lo,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(es,{className:"line-clamp-2",children:['Share "',i,'" with ',l?"agents or brokerages":"agents in your brokerage"]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[l?r.jsxs(ba,{value:re,onValueChange:ue,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(ln,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),w.length>0&&r.jsx(Ft,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:w.length})]}),r.jsxs(ln,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),S.length>0&&r.jsx(Ft,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:S.length})]})]}),r.jsxs(An,{value:"agents",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name, email, or brokerage...",value:A,onChange:Te=>E(Te.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:he,onValueChange:be,children:[r.jsxs(vn,{className:"w-[180px]",children:[r.jsx(uj,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(wn,{placeholder:"Filter by role"})]}),r.jsx(_n,{children:Jle.map(Te=>r.jsx(Kt,{value:Te.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Te.label})]})},Te.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:ke,className:"text-xs h-8",disabled:_e.length===0,children:[r.jsx(Kn,{className:"h-3.5 w-3.5 mr-1.5"}),w.length===_e.length&&_e.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Re!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Re," ",(Ce=Jle.find(Te=>Te.value===he))==null?void 0:Ce.label]}),r.jsxs("span",{className:"font-medium",children:[w.length," selected"]})]})]}),r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):_e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Kn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:he!=="all"?`No ${(Je=Jle.find(Te=>Te.value===he))==null?void 0:Je.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:_e.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${w.includes(Te.id)?"bg-accent":""}`,onClick:()=>ae(Te.id),children:[r.jsx(cc,{checked:w.includes(Te.id),onCheckedChange:()=>ae(Te.id),className:"flex-shrink-0"}),r.jsx(ci,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(di,{className:"text-xs bg-primary/10 text-primary",children:Ue(Te.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),Ie(Te.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Te.email,Te.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Te.brokerage_name]})]})]})]},Te.id))})})]}),r.jsxs(An,{value:"brokerages",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search brokerages...",value:T,onChange:Te=>O(Te.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:pe,className:"text-xs h-8",disabled:Ee.length===0,children:[r.jsx(na,{className:"h-3.5 w-3.5 mr-1.5"}),S.length===Ee.length&&Ee.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[S.length," selected"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground px-1 flex-shrink-0",children:"Selecting a brokerage will send to all agents in that brokerage."}),r.jsx(Jo,{className:"h-[250px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ee.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(na,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No brokerages found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:Ee.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${S.includes(Te.id)?"bg-accent":""}`,onClick:()=>ge(Te.id),children:[r.jsx(cc,{checked:S.includes(Te.id),onCheckedChange:()=>ge(Te.id),className:"flex-shrink-0"}),r.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(na,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Te.agent_count," agent",Te.agent_count!==1?"s":""]})]})]},Te.id))})})]})]}):r.jsxs("div",{className:"flex-1 flex flex-col space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search agents...",value:A,onChange:Te=>E(Te.target.value),className:"pl-9"})]}),ie&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:ke,className:"text-xs h-8",disabled:_e.length===0,children:[r.jsx(Kn,{className:"h-3.5 w-3.5 mr-1.5"}),w.length===_e.length&&_e.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[w.length," selected"]})]}),r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):_e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Kn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:_e.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${w.includes(Te.id)?"bg-accent":""}`,onClick:()=>ae(Te.id),children:[r.jsx(cc,{checked:w.includes(Te.id),onCheckedChange:()=>ae(Te.id),className:"flex-shrink-0"}),r.jsx(ci,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(di,{className:"text-xs bg-primary/10 text-primary",children:Ue(Te.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Te.email})]})]},Te.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(Ve,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(ms,{id:"message",placeholder:"I thought you might find this useful...",value:z,onChange:Te=>F(Te.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(J,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(J,{onClick:Me,disabled:Ke===0||K,children:K?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function f3({resourceType:e,resourceId:t,resourceTitle:n,variant:s="outline",size:i="sm",className:o=""}){const[l,a]=P.useState(!1),{user:h}=zr();return h?r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:s,size:i,onClick:()=>a(!0),className:o,children:[r.jsx(dc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(xmt,{open:l,onOpenChange:a,resourceType:e,resourceId:t,resourceTitle:n})]}):null}function ymt(){const{eventId:e}=Wc(),t=ns(),{user:n}=zr(),[s,i]=P.useState(null),[o,l]=P.useState(null),[a,h]=P.useState(0),[p,x]=P.useState(!0),[y,w]=P.useState(!1);P.useEffect(()=>{e&&j()},[e,n]);const j=async()=>{try{const{data:O,error:z}=await ee.from("events").select("*").eq("id",e).single();if(z)throw z;i(O);const{count:F}=await ee.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",e);if(h(F||0),n){const{data:q}=await ee.from("event_registrations").select("id, zoom_join_url").eq("event_id",e).eq("user_id",n.id).maybeSingle();l(q)}}catch(O){console.error("Error loading event:",O),ze.error("Failed to load event"),t("/events")}finally{x(!1)}},S=async()=>{if(!(!n||!s)){w(!0);try{if(o){const{error:O}=await ee.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(O)throw O;ze.success("Successfully cancelled registration"),l(null),h(z=>z-1)}else{const{data:O,error:z}=await ee.functions.invoke("zoom-register",{body:{event_id:s.id}});if(z)throw z;ze.success("Successfully registered for event!"),l({id:O.registration_id,zoom_join_url:O.zoom_join_url}),h(F=>F+1)}}catch(O){console.error("Registration error:",O),ze.error(o?"Failed to cancel registration":"Failed to register for event")}finally{w(!1)}}},C=O=>{var z,F,q;if(O.includes("iframe.mediadelivery.net")||O.includes("video.bunnycdn.com")){const H=O.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(H)return`https://iframe.mediadelivery.net/embed/${H[1]}/${H[2]}?autoplay=false&preload=true`}if(O.includes("youtube.com")||O.includes("youtu.be")){const H=O.includes("youtu.be")?(z=O.split("youtu.be/")[1])==null?void 0:z.split("?")[0]:(F=O.split("v=")[1])==null?void 0:F.split("&")[0];if(H)return`https://www.youtube.com/embed/${H}`}if(O.includes("vimeo.com")){const H=(q=O.split("vimeo.com/")[1])==null?void 0:q.split("?")[0];if(H)return`https://player.vimeo.com/video/${H}`}return O};if(p)return r.jsx(Or,{title:"Event",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading event..."})]})})});if(!s)return r.jsx(Or,{title:"Event Not Found",children:r.jsxs("div",{className:"text-center py-16",children:[r.jsx("p",{className:"text-muted-foreground",children:"Event not found"}),r.jsx(J,{onClick:()=>t("/events"),className:"mt-4",children:"Back to Events"})]})});const A=gut(new Date(s.event_date)),E=s.capacity&&a>=s.capacity,T=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Or,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(J,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>t("/events"),children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Events"]}),s.image_url&&r.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[r.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"}),A&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ft,{variant:"secondary",className:"text-lg px-4 py-2",children:"Event Ended"})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground",children:s.title}),r.jsx(f3,{resourceType:"event",resourceId:s.id,resourceTitle:s.title})]}),s.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground dark:prose-invert",dangerouslySetInnerHTML:{__html:s.description}})]}),s.video_url&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(Of,{className:"h-5 w-5"}),"Event Preview"]}),r.jsx("div",{className:"relative w-full aspect-video rounded-xl overflow-hidden border bg-muted",children:r.jsx("iframe",{src:C(s.video_url),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Event Preview Video"})})]})]}),r.jsx("div",{className:"space-y-4",children:r.jsx(We,{children:r.jsxs(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Ys,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fn(new Date(s.event_date),"EEEE, MMMM d, yyyy")}),r.jsx("p",{className:"text-sm text-muted-foreground",children:xte(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Kn,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[a," / ",s.capacity]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Registered"})]})]}),o&&r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 rounded-lg",children:[r.jsx(qa,{className:"h-5 w-5 text-green-600"}),r.jsx("span",{className:"text-sm font-medium text-green-700",children:"You're registered!"})]}),r.jsxs("div",{className:"space-y-2 pt-2",children:[!A&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(J,{className:"w-full gap-2",onClick:()=>window.open(T,"_blank"),children:[r.jsx(Ls,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(J,{variant:"outline",className:"w-full",onClick:S,disabled:y,children:[y?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(J,{className:"w-full gap-2",onClick:S,disabled:y||(E??!1),children:y?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):E?"Event Full":"Register Now"})}),A&&o&&r.jsxs(J,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const vmt=()=>{const{user:e,isAdmin:t}=zr(),n=ns(),[s,i]=P.useState([]),[o,l]=P.useState(!0),[a,h]=P.useState(""),[p,x]=P.useState("all"),[y,w]=P.useState(new Set);P.useEffect(()=>{j()},[e]);const j=async()=>{try{const{data:T}=await ee.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),O=(T==null?void 0:T.map(re=>re.tag))||[],{data:z,error:F}=await ee.from("app_tiles").select("*").order("name");if(F)throw F;const{data:q}=await ee.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),H=new Set((q==null?void 0:q.map(re=>re.app_id))||[]);w(H);const Z=((z==null?void 0:z.filter(re=>!re.required_tags||re.required_tags.length===0?!0:re.required_tags.some(ue=>O.includes(ue))))||[]).sort((re,ue)=>re.name==="LevelUp Members Portal"?-1:ue.name==="LevelUp Members Portal"?1:0);i(Z)}catch(T){console.error("Error loading apps:",T),ze.error("Failed to load apps")}finally{l(!1)}},S=async T=>{var z;const O=window.open("about:blank","_blank");try{const{data:F,error:q}=await ee.auth.getSession();if(q||!F.session){O==null||O.close(),ze.error("Session expired. Please refresh the page and try again.");return}const H=F.session.access_token;await ee.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:T.app_id,app_name:T.name,user_agent:navigator.userAgent});const{data:K,error:Z}=await ee.functions.invoke("sso-launch",{body:{app_id:T.app_id},headers:{Authorization:`Bearer ${H}`}});if(Z)throw Z;K!=null&&K.redirect_url?O&&!O.closed?(O.location.href=K.redirect_url,(z=O.focus)==null||z.call(O)):window.location.assign(K.redirect_url):(O==null||O.close(),ze.error("Launch link unavailable"))}catch(F){O==null||O.close(),console.error("Error launching app:",F),ze.error("Failed to launch app. Please try again.")}},C=async(T,O)=>{T.stopPropagation();const z=y.has(O);try{if(z){const{error:F}=await ee.from("user_favorites").delete().eq("user_id",e==null?void 0:e.id).eq("app_id",O);if(F)throw F;w(q=>{const H=new Set(q);return H.delete(O),H}),ze.success("Removed from favorites")}else{const{error:F}=await ee.from("user_favorites").insert({user_id:e==null?void 0:e.id,app_id:O});if(F)throw F;w(q=>new Set(q).add(O)),ze.success("Added to favorites")}}catch(F){console.error("Error toggling favorite:",F),ze.error("Failed to update favorites")}},A=s.filter(T=>{var z;const O=T.name.toLowerCase().includes(a.toLowerCase())||((z=T.description)==null?void 0:z.toLowerCase().includes(a.toLowerCase()));return p==="favorites"?O&&y.has(T.id):O}),E=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Or,{title:"Apps",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading apps..."})]})})}):r.jsxs(Or,{title:"Apps",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Apps"}),r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:a,onChange:T=>h(T.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:E.map(T=>r.jsxs("button",{onClick:()=>x(T.id),className:$t("pb-3 text-sm font-medium transition-colors relative",p===T.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[T.label,p===T.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},T.id))}),A.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:p==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(dm,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No favorites yet"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:"Click the bookmark icon on any app to add it to your favorites"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Wf,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No apps available"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:t?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),t&&r.jsx(J,{className:"mt-4",onClick:()=>n("/admin/apps"),children:"Add Apps"})]})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:A.map(T=>{const O=y.has(T.id),z=T.name.toLowerCase().includes("agent review")||T.app_id==="agent_review";return r.jsxs("div",{className:"group flex flex-col p-5 bg-card rounded-xl border border-border transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"flex items-start gap-4 cursor-pointer",onClick:()=>S(T),children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:T.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:T.description})]}),r.jsx("button",{className:$t("flex-shrink-0 p-1 transition-colors",O?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:F=>C(F,T.id),children:r.jsx(dm,{className:$t("h-5 w-5",O&&"fill-current")})})]}),z&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:F=>F.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},T.id)})})]})},_mt=()=>{const e=ns(),[t,n]=P.useState(""),[s,i]=P.useState("all"),[o,l]=P.useState("all"),[a,h]=P.useState("grid"),{data:p=[]}=Jt({queryKey:["template-categories"],queryFn:async()=>{const{data:E,error:T}=await ee.from("template_categories").select("*").order("name");if(T)throw T;return E}}),{data:x=[]}=Jt({queryKey:["template-types"],queryFn:async()=>{const{data:E,error:T}=await ee.from("template_types").select("*").order("name");if(T)throw T;return E}}),{data:y=[],isLoading:w}=Jt({queryKey:["canva-templates"],queryFn:async()=>{const{data:E,error:T}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(T)throw T;const{data:O,error:z}=await ee.from("template_links").select("*").order("sort_order");if(z)throw z;const{data:F}=await ee.from("template_likes").select("template_id"),{data:q}=await ee.from("template_comments").select("template_id"),H=new Map;F==null||F.forEach(re=>{H.set(re.template_id,(H.get(re.template_id)||0)+1)});const K=new Map;return q==null||q.forEach(re=>{K.set(re.template_id,(K.get(re.template_id)||0)+1)}),(E||[]).map(re=>({...re,links:(O||[]).filter(ue=>ue.template_id===re.id)||[],likesCount:H.get(re.id)||0,commentsCount:K.get(re.id)||0}))}}),j=y.filter(E=>{var F;const T=E.name.toLowerCase().includes(t.toLowerCase())||((F=E.description)==null?void 0:F.toLowerCase().includes(t.toLowerCase())),O=s==="all"||E.category_id===s,z=o==="all"||E.type_id===o;return T&&O&&z}),S=()=>{n(""),i("all"),l("all")},C=t||s!=="all"||o!=="all",A=E=>{e(`/templates/${E}`)};return r.jsx(Or,{title:"Canva Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Canva Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse and use our collection of professionally designed templates"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search templates...",value:t,onChange:E=>n(E.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:s,onValueChange:i,children:[r.jsx(vn,{className:"w-full sm:w-48",children:r.jsx(wn,{placeholder:"All Categories"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Categories"}),p.map(E=>r.jsx(Kt,{value:E.id,children:E.name},E.id))]})]}),r.jsxs(bn,{value:o,onValueChange:l,children:[r.jsx(vn,{className:"w-full sm:w-48",children:r.jsx(wn,{placeholder:"All Types"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Types"}),x.map(E=>r.jsx(Kt,{value:E.id,children:E.name},E.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[C&&r.jsx(J,{variant:"outline",size:"sm",onClick:S,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:a==="grid"?"secondary":"outline",size:"icon",onClick:()=>h("grid"),className:"rounded-full",children:r.jsx(fm,{className:"h-4 w-4"})}),r.jsx(J,{variant:a==="list"?"secondary":"outline",size:"icon",onClick:()=>h("list"),className:"rounded-full",children:r.jsx(Hf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[j.length," template",j.length!==1?"s":""," found"]}),w&&r.jsx("div",{className:a==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((E,T)=>r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Pr,{className:"h-5 w-16"}),r.jsx(Pr,{className:"h-5 w-20"})]})]})},T))}),!w&&j.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:C?"No templates match your filters":"No templates available yet"}),C&&r.jsx(J,{variant:"outline",onClick:S,children:"Clear Filters"})]}),!w&&j.length>0&&r.jsx("div",{className:a==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:j.map(E=>r.jsxs(We,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${a==="list"?"flex flex-row":""}`,onClick:()=>A(E.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${a==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[E.preview_image_url?r.jsx("img",{src:E.preview_image_url,alt:E.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),E.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(So,{className:"h-3 w-3"}),E.links.length]})})]}),r.jsxs(Xe,{className:`p-4 flex flex-col ${a==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:E.name}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Ane(E.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[E.category&&r.jsx(Ft,{variant:"secondary",className:"text-xs",children:E.category.name}),E.type&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:E.type.name})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Od,{className:"h-3.5 w-3.5"}),E.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zl,{className:"h-3.5 w-3.5"}),E.commentsCount]})]}),r.jsxs(J,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),A(E.id)},children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Template"]})]})]},E.id))})]})})};var bmt="Separator",Nke="horizontal",wmt=["horizontal","vertical"],yDe=P.forwardRef((e,t)=>{const{decorative:n,orientation:s=Nke,...i}=e,o=jmt(s)?s:Nke,a=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(Rn.div,{"data-orientation":o,...a,...i,ref:t})});yDe.displayName=bmt;function jmt(e){return wmt.includes(e)}var vDe=yDe;const Qd=P.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...s},i)=>r.jsx(vDe,{ref:i,decorative:n,orientation:t,className:$t("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Qd.displayName=vDe.displayName;const SI=()=>({trackEngagement:P.useCallback(async(t,n,s,i="view")=>{try{const{data:{user:o}}=await ee.auth.getUser();if(!o)return;await ee.from("content_engagement_logs").insert({user_id:o.id,resource_type:t,resource_id:n,resource_title:s,action_type:i})}catch(o){console.error("Error tracking engagement:",o)}},[])}),kmt=()=>{const{templateId:e}=Wc(),{user:t,isAdmin:n}=zr(),{toast:s}=pa(),i=Wr(),{trackEngagement:o}=SI(),[l,a]=P.useState(""),{data:h,isLoading:p}=Jt({queryKey:["template-detail",e],queryFn:async()=>{const{data:T,error:O}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",e).single();if(O)throw O;const{data:z}=await ee.from("template_links").select("*").eq("template_id",e).order("sort_order"),{data:F}=await ee.from("template_guides").select("*").eq("template_id",e).order("sort_order");return{...T,links:z||[],guides:F||[]}},enabled:!!e});P.useEffect(()=>{h&&o("template",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Jt({queryKey:["template-likes",e],queryFn:async()=>{const{data:T,error:O}=await ee.from("template_likes").select("*").eq("template_id",e);if(O)throw O;return T},enabled:!!e}),{data:y=[]}=Jt({queryKey:["template-comments",e],queryFn:async()=>{const{data:T,error:O}=await ee.from("template_comments").select("*").eq("template_id",e).order("created_at",{ascending:!1});if(O)throw O;const z=[...new Set(T.map(H=>H.user_id))],{data:F}=await ee.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(H=>[H.id,H.name]))||[]);return T.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!e}),w=cr({mutationFn:async T=>{const{error:O}=await ee.from("template_comments").insert({template_id:e,user_id:t.id,content:T});if(O)throw O},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",e]}),a(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error adding comment",description:T.message,variant:"destructive"})}}),j=cr({mutationFn:async T=>{const{error:O}=await ee.from("template_comments").delete().eq("id",T);if(O)throw O},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",e]}),s({title:"Comment deleted"})}}),S=cr({mutationFn:async()=>{const T=x.find(O=>O.user_id===(t==null?void 0:t.id));if(T){const{error:O}=await ee.from("template_likes").delete().eq("id",T.id);if(O)throw O}else{const{error:O}=await ee.from("template_likes").insert({template_id:e,user_id:t.id});if(O)throw O}},onSuccess:()=>{i.invalidateQueries({queryKey:["template-likes",e]})}}),C=x.some(T=>T.user_id===(t==null?void 0:t.id)),A=T=>T.split(" ").map(O=>O[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!l.trim()||!t)&&w.mutate(l.trim())};return p?r.jsx(Or,{title:"Templates",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Or,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/templates",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Templates"]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.category&&r.jsx(Ft,{variant:"secondary",children:h.category.name}),h.type&&r.jsx(Ft,{variant:"outline",children:h.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(J,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/templates?edit=${h.id}`,children:[r.jsx(ha,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(f3,{resourceType:"template",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(J,{variant:C?"default":"outline",className:"gap-2 rounded-full",onClick:()=>S.mutate(),disabled:!t||S.isPending,children:[r.jsx(Od,{className:`h-4 w-4 ${C?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&>p]:mb-4 [&>p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:h.description}})]}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(So,{className:"h-4 w-4"}),h.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(T=>r.jsxs(J,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_canva"),window.open(T.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:T.title}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),h.video_url&&r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:h.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),h.guides&&h.guides.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:h.guides.map(T=>r.jsxs(J,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_pdf"),window.open(T.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:T.name}),T.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(T.file_size/1024).toFixed(0)," KB)"]})]}),r.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Zl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ms,{placeholder:"Add a comment...",value:l,onChange:T=>a(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(J,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||w.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(T=>r.jsx(We,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:A(T.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(t==null?void 0:t.id)&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(T.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Or,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(So,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Template not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This template may have been removed or is not available."}),r.jsx(J,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/templates",children:"Back to Templates"})})]})})},Nmt=()=>{const{user:e}=zr(),[t,n]=P.useState(""),[s,i]=P.useState("all"),{data:o=[]}=Jt({queryKey:["academy-categories"],queryFn:async()=>{const{data:w,error:j}=await ee.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(j)throw j;return w}}),{data:l=[],isLoading:a}=Jt({queryKey:["academy-videos"],queryFn:async()=>{const{data:w,error:j}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(j)throw j;const{data:S,error:C}=await ee.from("academy_resources").select("*").order("sort_order");if(C)throw C;return w.map(E=>({...E,resources:(S==null?void 0:S.filter(T=>T.video_id===E.id))||[]}))}}),{data:h=[]}=Jt({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:w,error:j}=await ee.from("academy_video_likes").select("video_id, user_id");if(j)throw j;return w}}),p=l.filter(w=>{var C;const j=t===""||w.title.toLowerCase().includes(t.toLowerCase())||((C=w.description)==null?void 0:C.toLowerCase().includes(t.toLowerCase())),S=s==="all"||w.category_id===s;return j&&S}),x=w=>h.filter(j=>j.video_id===w).length,y=w=>h.some(j=>j.video_id===w&&j.user_id===(e==null?void 0:e.id));return r.jsx(Or,{title:"Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Academy"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"On-demand training videos and resources"})]}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-4",children:r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search videos...",value:t,onChange:w=>n(w.target.value),className:"pl-10"})]})}),r.jsx(ba,{value:s,onValueChange:i,children:r.jsxs(fa,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(ln,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(w=>r.jsx(ln,{value:w.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:w.name},w.id))]})}),a?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p.length===0?r.jsx(We,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"No videos found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:t?"Try adjusting your search terms":"Check back soon for new content"})]})}):r.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:p.map(w=>r.jsx(co,{to:`/academy/${w.id}`,children:r.jsxs(We,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[r.jsxs("div",{className:"relative aspect-video bg-muted",children:[w.thumbnail_url?r.jsx("img",{src:w.thumbnail_url,alt:w.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:r.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/90 flex items-center justify-center",children:r.jsx(Sc,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),w.duration&&r.jsxs("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-2 py-1 rounded flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),w.duration]})]}),r.jsxs(Wt,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Xt,{className:"text-lg line-clamp-2",children:w.title})}),w.category&&r.jsx(Ft,{variant:"secondary",className:"w-fit",children:w.category.name})]}),r.jsxs(Xe,{className:"pt-0",children:[w.description&&r.jsx(En,{className:"line-clamp-2",children:w.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Od,{className:`h-4 w-4 ${y(w.id)?"fill-primary text-primary":""}`}),x(w.id)]}),w.resources&&w.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4"}),w.resources.length]})]})]})]})},w.id))})]})})},Smt=(e,t)=>{if(t==="bunny_stream"){let n=e.replace("iframe.mediadelivery.net","player.mediadelivery.net");return n.includes("?")||(n+="?autoplay=false&loop=false&muted=false&preload=true&responsive=true"),n}if(t==="youtube"){const n=/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=e.match(n);if(s)return`https://www.youtube.com/embed/${s[1]}`}if(t==="vimeo"){const n=/vimeo\.com\/(?:video\/)?(\d+)/,s=e.match(n);if(s)return`https://player.vimeo.com/video/${s[1]}`}if(t==="loom"){const n=/loom\.com\/share\/([a-zA-Z0-9]+)/,s=e.match(n);if(s)return`https://www.loom.com/embed/${s[1]}`}return e},Cmt=()=>{const{videoId:e}=Wc();ns();const{user:t}=zr(),{toast:n}=pa(),s=Wr(),{trackEngagement:i}=SI(),[o,l]=P.useState(""),{data:a,isLoading:h}=Jt({queryKey:["academy-video",e],queryFn:async()=>{const{data:T,error:O}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",e).eq("is_published",!0).single();if(O)throw O;const{data:z}=await ee.from("academy_resources").select("*").eq("video_id",e).order("sort_order");return{...T,resources:z||[]}},enabled:!!e});P.useEffect(()=>{a&&i("academy_video",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:p=[]}=Jt({queryKey:["academy-video-likes",e],queryFn:async()=>{const{data:T,error:O}=await ee.from("academy_video_likes").select("*").eq("video_id",e);if(O)throw O;return T},enabled:!!e}),{data:x=[]}=Jt({queryKey:["academy-video-comments",e],queryFn:async()=>{const{data:T,error:O}=await ee.from("academy_video_comments").select("*").eq("video_id",e).order("created_at",{ascending:!1});if(O)throw O;const z=[...new Set(T.map(H=>H.user_id))],{data:F}=await ee.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(H=>[H.id,H.name]))||[]);return T.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!e}),y=cr({mutationFn:async T=>{const{error:O}=await ee.from("academy_video_comments").insert({video_id:e,user_id:t.id,content:T});if(O)throw O},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",e]}),l(""),n({title:"Comment added!"})},onError:T=>{n({title:"Error adding comment",description:T.message,variant:"destructive"})}}),w=cr({mutationFn:async T=>{const{error:O}=await ee.from("academy_video_comments").delete().eq("id",T);if(O)throw O},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",e]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const T=p.find(O=>O.user_id===(t==null?void 0:t.id));if(T){const{error:O}=await ee.from("academy_video_likes").delete().eq("id",T.id);if(O)throw O}else{const{error:O}=await ee.from("academy_video_likes").insert({video_id:e,user_id:t.id});if(O)throw O}},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-likes",e]})}}),S=p.some(T=>T.user_id===(t==null?void 0:t.id)),C=T=>{switch(T==null?void 0:T.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},A=T=>T.split(" ").map(O=>O[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!o.trim()||!t)&&y.mutate(o.trim())};return h?r.jsx(Or,{title:"Academy",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Or,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/academy",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Academy"]})}),r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",style:{paddingTop:"56.25%"},children:["youtube","vimeo","loom","bunny_stream"].includes(a.video_type)?r.jsx("iframe",{src:Smt(a.video_url,a.video_type),loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,height:"100%",width:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white gap-4",children:[r.jsx(Fi,{className:"h-16 w-16 opacity-50"}),r.jsx(J,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Open Video"]})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title}),a.category&&r.jsx(Ft,{variant:"secondary",children:a.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(f3,{resourceType:"academy_video",resourceId:a.id,resourceTitle:a.title}),r.jsxs(J,{variant:S?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!t||j.isPending,children:[r.jsx(Od,{className:`h-4 w-4 ${S?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.resources&&a.resources.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:a.resources.map(T=>r.jsxs("a",{href:T.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted transition-colors",children:[r.jsx("span",{className:"text-2xl",children:C(T.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:T.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:T.file_type})]}),r.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Zl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),t?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ms,{placeholder:"Add a comment...",value:o,onChange:T=>l(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(J,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(T=>r.jsx(We,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:A(T.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(t==null?void 0:t.id)&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(T.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Or,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Video not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This video may have been removed or is not available."}),r.jsx(J,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/academy",children:"Back to Academy"})})]})})};function Mmt(){const e=ns(),[t,n]=P.useState(""),{data:s,isLoading:i}=Jt({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:j,error:S}=await ee.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(S)throw S;return j}}),{data:o}=Jt({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:j,error:S}=await ee.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(S)throw S;return j}}),{data:l}=Jt({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:j,error:S}=await ee.from("resource_kit_likes").select("kit_id");if(S)throw S;return j}}),{data:a}=Jt({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:j,error:S}=await ee.from("resource_kit_comments").select("kit_id");if(S)throw S;return j}}),h=s==null?void 0:s.filter(j=>{var S;return j.name.toLowerCase().includes(t.toLowerCase())||((S=j.description)==null?void 0:S.toLowerCase().includes(t.toLowerCase()))}),p=j=>(o==null?void 0:o.filter(S=>S.kit_id===j))||[],x=j=>(l==null?void 0:l.filter(S=>S.kit_id===j).length)||0,y=j=>(a==null?void 0:a.filter(S=>S.kit_id===j).length)||0,w=j=>{e(`/toolbox/${j}`)};return r.jsx(Or,{title:"Toolbox",description:"Download resource kits and tools to help grow your business",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Toolbox"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Download resource kits and tools to help grow your business"})]}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search resource kits...",value:t,onChange:j=>n(j.target.value),className:"pl-10"})]}),!i&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(h==null?void 0:h.length)||0," resource kit",(h==null?void 0:h.length)!==1?"s":""," available"]}),i?r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((j,S)=>r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"}),r.jsx(Pr,{className:"h-4 w-2/3"})]})},S))}):(h==null?void 0:h.length)===0?r.jsxs(We,{className:"p-12 text-center",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resource kits found"}),r.jsx("p",{className:"text-muted-foreground",children:t?"Try adjusting your search terms":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:h==null?void 0:h.map(j=>{const S=p(j.id).length,C=x(j.id),A=y(j.id);return r.jsxs(We,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>w(j.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:j.featured_image_url?r.jsx("img",{src:j.featured_image_url,alt:j.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Ol,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:j.name}),j.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:Ane(j.description)}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4"}),S," file",S!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Od,{className:"h-3.5 w-3.5"}),C]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zl,{className:"h-3.5 w-3.5"}),A]})]})]})]})]},j.id)})})]})})}const Tmt=()=>{const{kitId:e}=Wc(),{user:t,isAdmin:n}=zr(),{toast:s}=pa(),i=Wr(),{trackEngagement:o}=SI(),[l,a]=P.useState(""),{data:h,isLoading:p}=Jt({queryKey:["resource-kit-detail",e],queryFn:async()=>{const{data:O,error:z}=await ee.from("resource_kits").select("*").eq("id",e).eq("is_published",!0).single();if(z)throw z;const{data:F}=await ee.from("resource_kit_files").select("*").eq("kit_id",e).order("sort_order"),{data:q}=await ee.from("resource_kit_links").select("*").eq("kit_id",e).order("sort_order");return{...O,files:F||[],links:q||[]}},enabled:!!e});P.useEffect(()=>{h&&o("toolbox",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Jt({queryKey:["resource-kit-likes",e],queryFn:async()=>{const{data:O,error:z}=await ee.from("resource_kit_likes").select("*").eq("kit_id",e);if(z)throw z;return O},enabled:!!e}),{data:y=[]}=Jt({queryKey:["resource-kit-comments",e],queryFn:async()=>{const{data:O,error:z}=await ee.from("resource_kit_comments").select("*").eq("kit_id",e).order("created_at",{ascending:!1});if(z)throw z;const F=[...new Set(O.map(K=>K.user_id))],{data:q}=await ee.from("profiles").select("id, name").in("id",F),H=new Map((q==null?void 0:q.map(K=>[K.id,K.name]))||[]);return O.map(K=>({...K,user_name:H.get(K.user_id)||"Unknown User"}))},enabled:!!e}),w=cr({mutationFn:async O=>{const{error:z}=await ee.from("resource_kit_comments").insert({kit_id:e,user_id:t.id,content:O});if(z)throw z},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",e]}),a(""),s({title:"Comment added!"})},onError:O=>{s({title:"Error adding comment",description:O.message,variant:"destructive"})}}),j=cr({mutationFn:async O=>{const{error:z}=await ee.from("resource_kit_comments").delete().eq("id",O);if(z)throw z},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",e]}),s({title:"Comment deleted"})}}),S=cr({mutationFn:async()=>{const O=x.find(z=>z.user_id===(t==null?void 0:t.id));if(O){const{error:z}=await ee.from("resource_kit_likes").delete().eq("id",O.id);if(z)throw z}else{const{error:z}=await ee.from("resource_kit_likes").insert({kit_id:e,user_id:t.id});if(z)throw z}},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-likes",e]})}}),C=x.some(O=>O.user_id===(t==null?void 0:t.id)),A=O=>O.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),E=O=>O?O<1024?O+" B":O<1024*1024?(O/1024).toFixed(1)+" KB":(O/(1024*1024)).toFixed(1)+" MB":"",T=O=>{O.preventDefault(),!(!l.trim()||!t)&&w.mutate(l.trim())};return p?r.jsx(Or,{title:"Toolbox",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Or,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/toolbox",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Toolbox"]})}),h.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:h.featured_image_url,alt:h.name,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(J,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/toolbox?edit=${h.id}`,children:[r.jsx(ha,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(f3,{resourceType:"resource_kit",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(J,{variant:C?"default":"outline",className:"gap-2 rounded-full",onClick:()=>S.mutate(),disabled:!t||S.isPending,children:[r.jsx(Od,{className:`h-4 w-4 ${C?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:h.description}})]}),h.files&&h.files.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Included Resources (",h.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.files.map(O=>r.jsxs("a",{href:O.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_pdf"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Ai,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:O.name}),O.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:E(O.file_size)})]})]}),r.jsx(Xa,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},O.id))})]})}),h.links&&h.links.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Canva Templates (",h.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(O=>r.jsxs("a",{href:O.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_canva"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-purple-500/10",children:r.jsx(Ls,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:O.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},O.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Zl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(ms,{placeholder:"Add a comment...",value:l,onChange:O=>a(O.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(J,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||w.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(O=>r.jsx(We,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:A(O.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:O.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(O.created_at),{addSuffix:!0})}),O.user_id===(t==null?void 0:t.id)&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(O.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content})]})]})})},O.id))})]})]})}):r.jsx(Or,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Ol,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource kit not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource kit may have been removed or is not available."}),r.jsx(J,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Amt=()=>{const e=ns(),[t,n]=P.useState(""),[s,i]=P.useState("grid"),{data:o=[],isLoading:l}=Jt({queryKey:["social-swag"],queryFn:async()=>{const{data:p,error:x}=await ee.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:y,error:w}=await ee.from("social_swag_links").select("*").order("sort_order");if(w)throw w;const{data:j}=await ee.from("social_swag_likes").select("swag_id"),{data:S}=await ee.from("social_swag_comments").select("swag_id"),C=new Map;j==null||j.forEach(T=>{C.set(T.swag_id,(C.get(T.swag_id)||0)+1)});const A=new Map;return S==null||S.forEach(T=>{A.set(T.swag_id,(A.get(T.swag_id)||0)+1)}),(p||[]).map(T=>({...T,links:(y||[]).filter(O=>O.swag_id===T.id)||[],likesCount:C.get(T.id)||0,commentsCount:A.get(T.id)||0}))}}),a=o.filter(p=>{var y;return p.title.toLowerCase().includes(t.toLowerCase())||((y=p.description)==null?void 0:y.toLowerCase().includes(t.toLowerCase()))}),h=p=>{e(`/social-swag/${p}`)};return r.jsx(Or,{title:"Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Social Swag"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse our collection of social media content and graphics"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search social swag...",value:t,onChange:p=>n(p.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(J,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(fm,{className:"h-4 w-4"})}),r.jsx(J,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx(Hf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," item",a.length!==1?"s":""," found"]}),l&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((p,x)=>r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"})]})},x))}),!l&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No items match your search":"No social swag available yet"}),t&&r.jsx(J,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&a.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(p=>r.jsxs(We,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>h(p.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[p.preview_image_url?r.jsx("img",{src:p.preview_image_url,alt:p.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),p.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(So,{className:"h-3 w-3"}),p.links.length]})})]}),r.jsxs(Xe,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:p.title}),p.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:p.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Od,{className:"h-3.5 w-3.5"}),p.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zl,{className:"h-3.5 w-3.5"}),p.commentsCount]})]}),r.jsxs(J,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),h(p.id)},children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Details"]})]})]},p.id))})]})})};var Ci=function(){return Ci=Object.assign||function(t){for(var n,s=1,i=arguments.length;s1&&(h||!p),y=t>1&&(p||!h),w=function(){s&&o(s)},j=function(){i&&o(i)};return r.jsx(cgt,{displayMonth:e.displayMonth,hideNext:x,hidePrevious:y,nextMonth:i,previousMonth:s,onPreviousClick:w,onNextClick:j})}function dgt(e){var t,n=el(),s=n.classNames,i=n.disableNavigation,o=n.styles,l=n.captionLayout,a=n.components,h=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:wDe,p;return i?p=r.jsx(h,{id:e.id,displayMonth:e.displayMonth}):l==="dropdown"?p=r.jsx(Ske,{displayMonth:e.displayMonth,id:e.id}):l==="dropdown-buttons"?p=r.jsxs(r.Fragment,{children:[r.jsx(Ske,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),r.jsx(Cke,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):p=r.jsxs(r.Fragment,{children:[r.jsx(h,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(Cke,{displayMonth:e.displayMonth,id:e.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:p})}function ugt(e){var t=el(),n=t.footer,s=t.styles,i=t.classNames.tfoot;return n?r.jsx("tfoot",{className:i,style:s.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:n})})}):r.jsx(r.Fragment,{})}function hgt(e,t,n){for(var s=n?ay(new Date):sf(new Date,{locale:e,weekStartsOn:t}),i=[],o=0;o<7;o++){var l=Vl(s,o);i.push(l)}return i}function fgt(){var e=el(),t=e.classNames,n=e.styles,s=e.showWeekNumber,i=e.locale,o=e.weekStartsOn,l=e.ISOWeek,a=e.formatters.formatWeekdayName,h=e.labels.labelWeekday,p=hgt(i,o,l);return r.jsxs("tr",{style:n.head_row,className:t.head_row,children:[s&&r.jsx("td",{style:n.head_cell,className:t.head_cell}),p.map(function(x,y){return r.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":h(x,{locale:i}),children:a(x,{locale:i})},y)})]})}function pgt(){var e,t=el(),n=t.classNames,s=t.styles,i=t.components,o=(e=i==null?void 0:i.HeadRow)!==null&&e!==void 0?e:fgt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function mgt(e){var t=el(),n=t.locale,s=t.formatters.formatDay;return r.jsx(r.Fragment,{children:s(e.date,{locale:n})})}var Cxe=P.createContext(void 0);function ggt(e){if(!CI(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return r.jsx(Cxe.Provider,{value:t,children:e.children})}return r.jsx(xgt,{initialProps:e.initialProps,children:e.children})}function xgt(e){var t=e.initialProps,n=e.children,s=t.selected,i=t.min,o=t.max,l=function(p,x,y){var w,j;(w=t.onDayClick)===null||w===void 0||w.call(t,p,x,y);var S=!!(x.selected&&i&&(s==null?void 0:s.length)===i);if(!S){var C=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!C){var A=s?_De([],s):[];if(x.selected){var E=A.findIndex(function(T){return Kl(p,T)});A.splice(E,1)}else A.push(p);(j=t.onSelect)===null||j===void 0||j.call(t,A,p,x,y)}}},a={disabled:[]};s&&a.disabled.push(function(p){var x=o&&s.length>o-1,y=s.some(function(w){return Kl(w,p)});return!!(x&&!y)});var h={selected:s,onDayClick:l,modifiers:a};return r.jsx(Cxe.Provider,{value:h,children:n})}function Mxe(){var e=P.useContext(Cxe);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function ygt(e,t){var n=t||{},s=n.from,i=n.to;return s&&i?Kl(i,e)&&Kl(s,e)?void 0:Kl(i,e)?{from:i,to:void 0}:Kl(s,e)?void 0:mte(s,e)?{from:e,to:i}:{from:s,to:e}:i?mte(e,i)?{from:i,to:e}:{from:e,to:i}:s?gse(e,s)?{from:e,to:s}:{from:s,to:e}:{from:e,to:void 0}}var Txe=P.createContext(void 0);function vgt(e){if(!MI(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(Txe.Provider,{value:t,children:e.children})}return r.jsx(_gt,{initialProps:e.initialProps,children:e.children})}function _gt(e){var t=e.initialProps,n=e.children,s=t.selected,i=s||{},o=i.from,l=i.to,a=t.min,h=t.max,p=function(j,S,C){var A,E;(A=t.onDayClick)===null||A===void 0||A.call(t,j,S,C);var T=ygt(j,s);(E=t.onSelect)===null||E===void 0||E.call(t,T,j,S,C)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],l?(x.range_end=[l],Kl(o,l)||(x.range_middle=[{after:o,before:l}])):x.range_end=[o]):l&&(x.range_start=[l],x.range_end=[l]),a&&(o&&!l&&x.disabled.push({after:Kle(o,a-1),before:Vl(o,a-1)}),o&&l&&x.disabled.push({after:o,before:Vl(o,a-1)}),!o&&l&&x.disabled.push({after:Kle(l,a-1),before:Vl(l,a-1)})),h){if(o&&!l&&(x.disabled.push({before:Vl(o,-h+1)}),x.disabled.push({after:Vl(o,h-1)})),o&&l){var y=om(l,o)+1,w=h-y;x.disabled.push({before:Kle(o,w)}),x.disabled.push({after:Vl(l,w)})}!o&&l&&(x.disabled.push({before:Vl(l,-h+1)}),x.disabled.push({after:Vl(l,h-1)}))}return r.jsx(Txe.Provider,{value:{selected:s,onDayClick:p,modifiers:x},children:n})}function Axe(){var e=P.useContext(Txe);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function cee(e){return Array.isArray(e)?_De([],e):e!==void 0?[e]:[]}function bgt(e){var t={};return Object.entries(e).forEach(function(n){var s=n[0],i=n[1];t[s]=cee(i)}),t}var jm;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(jm||(jm={}));var wgt=jm.Selected,fx=jm.Disabled,jgt=jm.Hidden,kgt=jm.Today,ece=jm.RangeEnd,tce=jm.RangeMiddle,rce=jm.RangeStart,Ngt=jm.Outside;function Sgt(e,t,n){var s,i=(s={},s[wgt]=cee(e.selected),s[fx]=cee(e.disabled),s[jgt]=cee(e.hidden),s[kgt]=[e.today],s[ece]=[],s[tce]=[],s[rce]=[],s[Ngt]=[],s);return e.fromDate&&i[fx].push({before:e.fromDate}),e.toDate&&i[fx].push({after:e.toDate}),CI(e)?i[fx]=i[fx].concat(t.modifiers[fx]):MI(e)&&(i[fx]=i[fx].concat(n.modifiers[fx]),i[rce]=n.modifiers[rce],i[tce]=n.modifiers[tce],i[ece]=n.modifiers[ece]),i}var NDe=P.createContext(void 0);function Cgt(e){var t=el(),n=Mxe(),s=Axe(),i=Sgt(t,n,s),o=bgt(t.modifiers),l=Ci(Ci({},i),o);return r.jsx(NDe.Provider,{value:l,children:e.children})}function SDe(){var e=P.useContext(NDe);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Mgt(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Tgt(e){return!!(e&&typeof e=="object"&&"from"in e)}function Agt(e){return!!(e&&typeof e=="object"&&"after"in e)}function Egt(e){return!!(e&&typeof e=="object"&&"before"in e)}function Igt(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Pgt(e,t){var n,s=t.from,i=t.to;if(s&&i){var o=om(i,s)<0;o&&(n=[i,s],s=n[0],i=n[1]);var l=om(e,s)>=0&&om(i,e)>=0;return l}return i?Kl(i,e):s?Kl(s,e):!1}function Lgt(e){return sxe(e)}function Ogt(e){return Array.isArray(e)&&e.every(sxe)}function Dgt(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(Lgt(n))return Kl(e,n);if(Ogt(n))return n.includes(e);if(Tgt(n))return Pgt(e,n);if(Igt(n))return n.dayOfWeek.includes(e.getDay());if(Mgt(n)){var s=om(n.before,e),i=om(n.after,e),o=s>0,l=i<0,a=mte(n.before,n.after);return a?l&&o:o||l}return Agt(n)?om(e,n.after)>0:Egt(n)?om(n.before,e)>0:typeof n=="function"?n(e):!1})}function Exe(e,t,n){var s=Object.keys(t).reduce(function(o,l){var a=t[l];return Dgt(e,a)&&o.push(l),o},[]),i={};return s.forEach(function(o){return i[o]=!0}),n&&!hxe(e,n)&&(i.outside=!0),i}function Rgt(e,t){for(var n=xh(e[0]),s=pse(e[e.length-1]),i,o,l=n;l<=s;){var a=Exe(l,t),h=!a.disabled&&!a.hidden;if(!h){l=Vl(l,1);continue}if(a.selected)return l;a.today&&!o&&(o=l),i||(i=l),l=Vl(l,1)}return o||i}var Fgt=365;function CDe(e,t){var n=t.moveBy,s=t.direction,i=t.context,o=t.modifiers,l=t.retry,a=l===void 0?{count:0,lastFocused:e}:l,h=i.weekStartsOn,p=i.fromDate,x=i.toDate,y=i.locale,w={day:Vl,week:_he,month:tp,year:hct,startOfWeek:function(A){return i.ISOWeek?ay(A):sf(A,{locale:y,weekStartsOn:h})},endOfWeek:function(A){return i.ISOWeek?x8e(A):ixe(A,{locale:y,weekStartsOn:h})}},j=w[n](e,s==="after"?1:-1);s==="before"&&p?j=fct([p,j]):s==="after"&&x&&(j=pct([x,j]));var S=!0;if(o){var C=Exe(j,o);S=!C.disabled&&!C.hidden}return S?j:a.count>Fgt?a.lastFocused:CDe(j,{moveBy:n,direction:s,context:i,modifiers:o,retry:Ci(Ci({},a),{count:a.count+1})})}var MDe=P.createContext(void 0);function zgt(e){var t=TI(),n=SDe(),s=P.useState(),i=s[0],o=s[1],l=P.useState(),a=l[0],h=l[1],p=Rgt(t.displayMonths,n),x=i??(a&&t.isDateDisplayed(a))?a:p,y=function(){h(i),o(void 0)},w=function(A){o(A)},j=el(),S=function(A,E){if(i){var T=CDe(i,{moveBy:A,direction:E,context:j,modifiers:n});Kl(i,T)||(t.goToDate(T,i),w(T))}},C={focusedDay:i,focusTarget:x,blur:y,focus:w,focusDayAfter:function(){return S("day","after")},focusDayBefore:function(){return S("day","before")},focusWeekAfter:function(){return S("week","after")},focusWeekBefore:function(){return S("week","before")},focusMonthBefore:function(){return S("month","before")},focusMonthAfter:function(){return S("month","after")},focusYearBefore:function(){return S("year","before")},focusYearAfter:function(){return S("year","after")},focusStartOfWeek:function(){return S("startOfWeek","before")},focusEndOfWeek:function(){return S("endOfWeek","after")}};return r.jsx(MDe.Provider,{value:C,children:e.children})}function Ixe(){var e=P.useContext(MDe);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Bgt(e,t){var n=SDe(),s=Exe(e,n,t);return s}var Pxe=P.createContext(void 0);function $gt(e){if(!Mse(e.initialProps)){var t={selected:void 0};return r.jsx(Pxe.Provider,{value:t,children:e.children})}return r.jsx(Ugt,{initialProps:e.initialProps,children:e.children})}function Ugt(e){var t=e.initialProps,n=e.children,s=function(o,l,a){var h,p,x;if((h=t.onDayClick)===null||h===void 0||h.call(t,o,l,a),l.selected&&!t.required){(p=t.onSelect)===null||p===void 0||p.call(t,void 0,o,l,a);return}(x=t.onSelect)===null||x===void 0||x.call(t,o,o,l,a)},i={selected:t.selected,onDayClick:s};return r.jsx(Pxe.Provider,{value:i,children:n})}function TDe(){var e=P.useContext(Pxe);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function qgt(e,t){var n=el(),s=TDe(),i=Mxe(),o=Axe(),l=Ixe(),a=l.focusDayAfter,h=l.focusDayBefore,p=l.focusWeekAfter,x=l.focusWeekBefore,y=l.blur,w=l.focus,j=l.focusMonthBefore,S=l.focusMonthAfter,C=l.focusYearBefore,A=l.focusYearAfter,E=l.focusStartOfWeek,T=l.focusEndOfWeek,O=function(fe){var de,_e,Ee,ke;Mse(n)?(de=s.onDayClick)===null||de===void 0||de.call(s,e,t,fe):CI(n)?(_e=i.onDayClick)===null||_e===void 0||_e.call(i,e,t,fe):MI(n)?(Ee=o.onDayClick)===null||Ee===void 0||Ee.call(o,e,t,fe):(ke=n.onDayClick)===null||ke===void 0||ke.call(n,e,t,fe)},z=function(fe){var de;w(e),(de=n.onDayFocus)===null||de===void 0||de.call(n,e,t,fe)},F=function(fe){var de;y(),(de=n.onDayBlur)===null||de===void 0||de.call(n,e,t,fe)},q=function(fe){var de;(de=n.onDayMouseEnter)===null||de===void 0||de.call(n,e,t,fe)},H=function(fe){var de;(de=n.onDayMouseLeave)===null||de===void 0||de.call(n,e,t,fe)},K=function(fe){var de;(de=n.onDayPointerEnter)===null||de===void 0||de.call(n,e,t,fe)},Z=function(fe){var de;(de=n.onDayPointerLeave)===null||de===void 0||de.call(n,e,t,fe)},re=function(fe){var de;(de=n.onDayTouchCancel)===null||de===void 0||de.call(n,e,t,fe)},ue=function(fe){var de;(de=n.onDayTouchEnd)===null||de===void 0||de.call(n,e,t,fe)},he=function(fe){var de;(de=n.onDayTouchMove)===null||de===void 0||de.call(n,e,t,fe)},be=function(fe){var de;(de=n.onDayTouchStart)===null||de===void 0||de.call(n,e,t,fe)},ne=function(fe){var de;(de=n.onDayKeyUp)===null||de===void 0||de.call(n,e,t,fe)},ye=function(fe){var de;switch(fe.key){case"ArrowLeft":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?a():h();break;case"ArrowRight":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?h():a();break;case"ArrowDown":fe.preventDefault(),fe.stopPropagation(),p();break;case"ArrowUp":fe.preventDefault(),fe.stopPropagation(),x();break;case"PageUp":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?C():j();break;case"PageDown":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?A():S();break;case"Home":fe.preventDefault(),fe.stopPropagation(),E();break;case"End":fe.preventDefault(),fe.stopPropagation(),T();break}(de=n.onDayKeyDown)===null||de===void 0||de.call(n,e,t,fe)},ie={onClick:O,onFocus:z,onBlur:F,onKeyDown:ye,onKeyUp:ne,onMouseEnter:q,onMouseLeave:H,onPointerEnter:K,onPointerLeave:Z,onTouchCancel:re,onTouchEnd:ue,onTouchMove:he,onTouchStart:be};return ie}function Vgt(){var e=el(),t=TDe(),n=Mxe(),s=Axe(),i=Mse(e)?t.selected:CI(e)?n.selected:MI(e)?s.selected:void 0;return i}function Hgt(e){return Object.values(jm).includes(e)}function Wgt(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(s){var i=e.modifiersClassNames[s];if(i)n.push(i);else if(Hgt(s)){var o=e.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Ggt(e,t){var n=Ci({},e.styles.day);return Object.keys(t).forEach(function(s){var i;n=Ci(Ci({},n),(i=e.modifiersStyles)===null||i===void 0?void 0:i[s])}),n}function Kgt(e,t,n){var s,i,o,l=el(),a=Ixe(),h=Bgt(e,t),p=qgt(e,h),x=Vgt(),y=!!(l.onDayClick||l.mode!=="default");P.useEffect(function(){var q;h.outside||a.focusedDay&&y&&Kl(a.focusedDay,e)&&((q=n.current)===null||q===void 0||q.focus())},[a.focusedDay,e,n,y,h.outside]);var w=Wgt(l,h).join(" "),j=Ggt(l,h),S=!!(h.outside&&!l.showOutsideDays||h.hidden),C=(o=(i=l.components)===null||i===void 0?void 0:i.DayContent)!==null&&o!==void 0?o:mgt,A=r.jsx(C,{date:e,displayMonth:t,activeModifiers:h}),E={style:j,className:w,children:A,role:"gridcell"},T=a.focusTarget&&Kl(a.focusTarget,e)&&!h.outside,O=a.focusedDay&&Kl(a.focusedDay,e),z=Ci(Ci(Ci({},E),(s={disabled:h.disabled,role:"gridcell"},s["aria-selected"]=h.selected,s.tabIndex=O||T?0:-1,s)),p),F={isButton:y,isHidden:S,activeModifiers:h,selectedDays:x,buttonProps:z,divProps:E};return F}function Zgt(e){var t=P.useRef(null),n=Kgt(e.date,e.displayMonth,t);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(bte,Ci({name:"day",ref:t},n.buttonProps)):r.jsx("div",Ci({},n.divProps))}function Ygt(e){var t=e.number,n=e.dates,s=el(),i=s.onWeekNumberClick,o=s.styles,l=s.classNames,a=s.locale,h=s.labels.labelWeekNumber,p=s.formatters.formatWeekNumber,x=p(Number(t),{locale:a});if(!i)return r.jsx("span",{className:l.weeknumber,style:o.weeknumber,children:x});var y=h(Number(t),{locale:a}),w=function(j){i(t,n,j)};return r.jsx(bte,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:w,children:x})}function Xgt(e){var t,n,s=el(),i=s.styles,o=s.classNames,l=s.showWeekNumber,a=s.components,h=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:Zgt,p=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:Ygt,x;return l&&(x=r.jsx("td",{className:o.cell,style:i.cell,children:r.jsx(p,{number:e.weekNumber,dates:e.dates})})),r.jsxs("tr",{className:o.row,style:i.row,children:[x,e.dates.map(function(y){return r.jsx("td",{className:o.cell,style:i.cell,role:"presentation",children:r.jsx(h,{displayMonth:e.displayMonth,date:y})},ydt(y))})]})}function Mke(e,t,n){for(var s=n!=null&&n.ISOWeek?x8e(t):ixe(t,n),i=n!=null&&n.ISOWeek?ay(e):sf(e,n),o=om(s,i),l=[],a=0;a<=o;a++)l.push(Vl(i,a));var h=l.reduce(function(p,x){var y=n!=null&&n.ISOWeek?axe(x):lxe(x,n),w=p.find(function(j){return j.weekNumber===y});return w?(w.dates.push(x),p):(p.push({weekNumber:y,dates:[x]}),p)},[]);return h}function Qgt(e,t){var n=Mke(xh(e),pse(e),t);if(t!=null&&t.useFixedWeeks){var s=_dt(e,t);if(s<6){var i=n[n.length-1],o=i.dates[i.dates.length-1],l=_he(o,6-s),a=Mke(_he(o,1),l,t);n.push.apply(n,a)}}return n}function Jgt(e){var t,n,s,i=el(),o=i.locale,l=i.classNames,a=i.styles,h=i.hideHead,p=i.fixedWeeks,x=i.components,y=i.weekStartsOn,w=i.firstWeekContainsDate,j=i.ISOWeek,S=Qgt(e.displayMonth,{useFixedWeeks:!!p,ISOWeek:j,locale:o,weekStartsOn:y,firstWeekContainsDate:w}),C=(t=x==null?void 0:x.Head)!==null&&t!==void 0?t:pgt,A=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Xgt,E=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:ugt;return r.jsxs("table",{id:e.id,className:l.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!h&&r.jsx(C,{}),r.jsx("tbody",{className:l.tbody,style:a.tbody,children:S.map(function(T){return r.jsx(A,{displayMonth:e.displayMonth,dates:T.dates,weekNumber:T.weekNumber},T.weekNumber)})}),r.jsx(E,{displayMonth:e.displayMonth})]})}function ext(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var txt=ext()?P.useLayoutEffect:P.useEffect,nce=!1,rxt=0;function Tke(){return"react-day-picker-".concat(++rxt)}function nxt(e){var t,n=e??(nce?Tke():null),s=P.useState(n),i=s[0],o=s[1];return txt(function(){i===null&&o(Tke())},[]),P.useEffect(function(){nce===!1&&(nce=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function sxt(e){var t,n,s=el(),i=s.dir,o=s.classNames,l=s.styles,a=s.components,h=TI().displayMonths,p=nxt(s.id?"".concat(s.id,"-").concat(e.displayIndex):void 0),x=s.id?"".concat(s.id,"-grid-").concat(e.displayIndex):void 0,y=[o.month],w=l.month,j=e.displayIndex===0,S=e.displayIndex===h.length-1,C=!j&&!S;i==="rtl"&&(t=[j,S],S=t[0],j=t[1]),j&&(y.push(o.caption_start),w=Ci(Ci({},w),l.caption_start)),S&&(y.push(o.caption_end),w=Ci(Ci({},w),l.caption_end)),C&&(y.push(o.caption_between),w=Ci(Ci({},w),l.caption_between));var A=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:dgt;return r.jsxs("div",{className:y.join(" "),style:w,children:[r.jsx(A,{id:p,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(Jgt,{id:x,"aria-labelledby":p,displayMonth:e.displayMonth})]},e.displayIndex)}function ixt(e){var t=el(),n=t.classNames,s=t.styles;return r.jsx("div",{className:n.months,style:s.months,children:e.children})}function axt(e){var t,n,s=e.initialProps,i=el(),o=Ixe(),l=TI(),a=P.useState(!1),h=a[0],p=a[1];P.useEffect(function(){i.initialFocus&&o.focusTarget&&(h||(o.focus(o.focusTarget),p(!0)))},[i.initialFocus,h,o.focus,o.focusTarget,o]);var x=[i.classNames.root,i.className];i.numberOfMonths>1&&x.push(i.classNames.multiple_months),i.showWeekNumber&&x.push(i.classNames.with_weeknumber);var y=Ci(Ci({},i.styles.root),i.style),w=Object.keys(s).filter(function(S){return S.startsWith("data-")}).reduce(function(S,C){var A;return Ci(Ci({},S),(A={},A[C]=s[C],A))},{}),j=(n=(t=s.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:ixt;return r.jsx("div",Ci({className:x.join(" "),style:y,dir:i.dir,id:i.id,nonce:s.nonce,title:s.title,lang:s.lang},w,{children:r.jsx(j,{children:l.displayMonths.map(function(S,C){return r.jsx(sxt,{displayIndex:C,displayMonth:S},C)})})}))}function oxt(e){var t=e.children,n=Emt(e,["children"]);return r.jsx(Ymt,{initialProps:n,children:r.jsx(agt,{children:r.jsx($gt,{initialProps:n,children:r.jsx(ggt,{initialProps:n,children:r.jsx(vgt,{initialProps:n,children:r.jsx(Cgt,{children:r.jsx(zgt,{children:t})})})})})})})}function lxt(e){return r.jsx(oxt,Ci({},e,{children:r.jsx(axt,{initialProps:e})}))}function Bj({className:e,classNames:t,showOutsideDays:n=!0,...s}){return r.jsx(lxt,{showOutsideDays:n,className:$t("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:$t(XA({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:$t(XA({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...i})=>r.jsx(qc,{className:"h-4 w-4"}),IconRight:({...i})=>r.jsx(Ga,{className:"h-4 w-4"})},...s})}Bj.displayName="Calendar";var Tse="Popover",[ADe]=Ql(Tse,[Rg]),AI=Rg(),[cxt,sv]=ADe(Tse),EDe=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:l=!1}=e,a=AI(t),h=P.useRef(null),[p,x]=P.useState(!1),[y,w]=Lu({prop:s,defaultProp:i??!1,onChange:o,caller:Tse});return r.jsx(dI,{...a,children:r.jsx(cxt,{scope:t,contentId:Vc(),triggerRef:h,open:y,onOpenChange:w,onOpenToggle:P.useCallback(()=>w(j=>!j),[w]),hasCustomAnchor:p,onCustomAnchorAdd:P.useCallback(()=>x(!0),[]),onCustomAnchorRemove:P.useCallback(()=>x(!1),[]),modal:l,children:n})})};EDe.displayName=Tse;var IDe="PopoverAnchor",dxt=P.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=sv(IDe,n),o=AI(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:a}=i;return P.useEffect(()=>(l(),()=>a()),[l,a]),r.jsx(e3,{...o,...s,ref:t})});dxt.displayName=IDe;var PDe="PopoverTrigger",LDe=P.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=sv(PDe,n),o=AI(n),l=ei(t,i.triggerRef),a=r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":zDe(i.open),...s,ref:l,onClick:cn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:r.jsx(e3,{asChild:!0,...o,children:a})});LDe.displayName=PDe;var Lxe="PopoverPortal",[uxt,hxt]=ADe(Lxe,{forceMount:void 0}),ODe=e=>{const{__scopePopover:t,forceMount:n,children:s,container:i}=e,o=sv(Lxe,t);return r.jsx(uxt,{scope:t,forceMount:n,children:r.jsx(fc,{present:n||o.open,children:r.jsx(ZC,{asChild:!0,container:i,children:s})})})};ODe.displayName=Lxe;var gC="PopoverContent",DDe=P.forwardRef((e,t)=>{const n=hxt(gC,e.__scopePopover),{forceMount:s=n.forceMount,...i}=e,o=sv(gC,e.__scopePopover);return r.jsx(fc,{present:s||o.open,children:o.modal?r.jsx(pxt,{...i,ref:t}):r.jsx(mxt,{...i,ref:t})})});DDe.displayName=gC;var fxt=L1("PopoverContent.RemoveScroll"),pxt=P.forwardRef((e,t)=>{const n=sv(gC,e.__scopePopover),s=P.useRef(null),i=ei(t,s),o=P.useRef(!1);return P.useEffect(()=>{const l=s.current;if(l)return Une(l)},[]),r.jsx(gI,{as:fxt,allowPinchZoom:!0,children:r.jsx(RDe,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cn(e.onCloseAutoFocus,l=>{var a;l.preventDefault(),o.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:cn(e.onPointerDownOutside,l=>{const a=l.detail.originalEvent,h=a.button===0&&a.ctrlKey===!0,p=a.button===2||h;o.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:cn(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),mxt=P.forwardRef((e,t)=>{const n=sv(gC,e.__scopePopover),s=P.useRef(!1),i=P.useRef(!1);return r.jsx(RDe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var h,p;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),RDe=P.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:a,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:x,...y}=e,w=sv(gC,n),j=AI(n);return Bne(),r.jsx(mI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(X1,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:a,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>w.onOpenChange(!1),children:r.jsx(uI,{"data-state":zDe(w.open),role:"dialog",id:w.contentId,...j,...y,ref:t,style:{...y.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)"}})})})}),FDe="PopoverClose",gxt=P.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=sv(FDe,n);return r.jsx(Rn.button,{type:"button",...s,ref:t,onClick:cn(e.onClick,()=>i.onOpenChange(!1))})});gxt.displayName=FDe;var xxt="PopoverArrow",yxt=P.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=AI(n);return r.jsx(hI,{...i,...s,ref:t})});yxt.displayName=xxt;function zDe(e){return e?"open":"closed"}var vxt=EDe,_xt=LDe,bxt=ODe,BDe=DDe;const _h=vxt,bh=_xt,Ou=P.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},i)=>r.jsx(bxt,{children:r.jsx(BDe,{ref:i,align:t,sideOffset:n,className:$t("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]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));Ou.displayName=BDe.displayName;const wxt=YC("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Oxe=P.forwardRef(({className:e,variant:t,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:$t(wxt({variant:t}),e),...n}));Oxe.displayName="Alert";const jxt=P.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:$t("mb-1 font-medium leading-none tracking-tight",e),...t}));jxt.displayName="AlertTitle";const Dxe=P.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("text-sm [&_p]:leading-relaxed",e),...t}));Dxe.displayName="AlertDescription";function kxt({open:e,onOpenChange:t,imageUrl:n,imageId:s,defaultCaption:i="",swagItemId:o,reelId:l}){const a=Wr(),[h,p]=P.useState(i),[x,y]=P.useState([]),[w,j]=P.useState(null),[S,C]=P.useState("now"),[A,E]=P.useState(vhe(ske(new Date),1)),[T,O]=P.useState("12"),[z,F]=P.useState("00"),[q,H]=P.useState("PM");P.useEffect(()=>{if(e){p(i),C("now"),y([]);const ae=vhe(ske(new Date),1);E(ae);const ge=ae.getHours();O(String(ge>12?ge-12:ge===0?12:ge)),F("00"),H(ge>=12?"PM":"AM")}},[e,i]);const K=()=>{if(!A)return null;let ae=parseInt(T);const ge=parseInt(z);return q==="PM"&&ae!==12&&(ae+=12),q==="AM"&&ae===12&&(ae=0),S8e(N8e(A,ae),ge)},{data:Z,isLoading:re}=Jt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:ae}}=await ee.auth.getUser();if(!ae)return[];const{data:ge,error:Me}=await ee.from("social_accounts").select("*").eq("user_id",ae.id).eq("is_active",!0).order("platform",{ascending:!0});if(Me)throw Me;return console.log("Fetched social accounts for posting:",ge),ge},enabled:e,staleTime:0}),ue=cr({mutationFn:async({accountId:ae,platform:ge})=>{j(ae);const{data:Me,error:Ue}=await ee.functions.invoke("social-post",{body:{platform:ge,accountId:ae,imageUrl:n,caption:h}});if(Ue)throw Ue;if(Me!=null&&Me.error)throw new Error(Me.error);return Me},onSuccess:ae=>{const ge=ae.platform==="facebook"?"Facebook":ae.platform==="instagram"?"Instagram":ae.platform==="linkedin"?"LinkedIn":"Google Business";ze.success(`Posted to ${ge}!`)},onError:ae=>{ze.error(`Failed to post: ${ae.message}`)},onSettled:()=>{j(null)}}),he=cr({mutationFn:async({accountId:ae,platform:ge,scheduledFor:Me})=>{const{data:{user:Ue}}=await ee.auth.getUser();if(!Ue)throw new Error("Not authenticated");const{error:Ie}=await ee.from("scheduled_posts").insert({user_id:Ue.id,social_account_id:ae,platform:ge,image_url:n,caption:h,swag_item_id:o||null,reel_id:l||null,scheduled_for:Me.toISOString(),status:"scheduled"});if(Ie)throw Ie;return{platform:ge}},onSuccess:ae=>{const ge=ae.platform==="facebook"?"Facebook":ae.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Post scheduled for ${ge}!`)},onError:ae=>{ze.error(`Failed to schedule: ${ae.message}`)}}),be=async()=>{if(x.length===0){ze.error("Please select at least one account");return}if(S==="schedule"){const ae=K();if(!ae||ae<=new Date){ze.error("Please select a future date and time");return}for(const ge of x){const Me=Z==null?void 0:Z.find(Ue=>Ue.id===ge);Me&&await he.mutateAsync({accountId:ge,platform:Me.platform,scheduledFor:ae})}a.invalidateQueries({queryKey:["scheduled-posts"]}),ze.success(`${x.length} post(s) scheduled for ${fn(ae,"PPp")}`)}else for(const ae of x){const ge=Z==null?void 0:Z.find(Me=>Me.id===ae);ge&&await ue.mutateAsync({accountId:ae,platform:ge.platform})}a.invalidateQueries({queryKey:["scheduled-posts"]}),p(""),y([]),t(!1)},ne=ae=>{y(ge=>ge.includes(ae)?ge.filter(Me=>Me!==ae):[...ge,ae])},ye=(Z==null?void 0:Z.filter(ae=>ae.platform==="facebook"))||[],ie=(Z==null?void 0:Z.filter(ae=>ae.platform==="instagram"))||[],fe=(Z==null?void 0:Z.filter(ae=>ae.platform==="linkedin"))||[],de=(Z==null?void 0:Z.filter(ae=>ae.platform==="google_business"))||[],_e=((Z==null?void 0:Z.length)||0)>0,Ee=ue.isPending||he.isPending,ke=Array.from({length:12},(ae,ge)=>String(ge+1)),pe=["00","15","30","45"];return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create Social Post"}),r.jsx(es,{children:"Share this image to your connected social accounts"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-full max-w-[200px] mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:n,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"caption",children:"Caption"}),r.jsx(ms,{id:"caption",placeholder:"Write a caption for your post...",value:h,onChange:ae=>p(ae.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{children:"Publish Time"}),r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[r.jsx("button",{type:"button",onClick:()=>C("now"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",S==="now"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Post Now"}),r.jsx("button",{type:"button",onClick:()=>C("schedule"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",S==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),S==="schedule"&&r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(_h,{children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!A&&"text-muted-foreground"),children:[r.jsx(Ys,{className:"mr-2 h-4 w-4"}),A?fn(A,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(Ou,{className:"w-auto p-0",align:"start",children:r.jsx(Bj,{mode:"single",selected:A,onSelect:E,disabled:ae=>aer.jsx(Kt,{value:ae,children:ae},ae))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(bn,{value:z,onValueChange:F,children:[r.jsx(vn,{className:"w-[70px]",children:r.jsx(wn,{})}),r.jsx(_n,{children:pe.map(ae=>r.jsx(Kt,{value:ae,children:ae},ae))})]}),r.jsxs(bn,{value:q,onValueChange:ae=>H(ae),children:[r.jsx(vn,{className:"w-[70px]",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"AM",children:"AM"}),r.jsx(Kt,{value:"PM",children:"PM"})]})]})]})]}),A&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",fn(K()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{children:"Post to"}),re&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(nn,{className:"h-6 w-6 animate-spin"})}),!re&&!_e&&r.jsxs(Oxe,{children:[r.jsx(El,{className:"h-4 w-4"}),r.jsxs(Dxe,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(co,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(hd,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),ye.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Pd,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),ye.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Wa,{src:ae.profile_picture_url||""}),r.jsx(di,{children:r.jsx(Pd,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.page_name||ae.platform_username}),w===ae.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),ie.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(eu,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),ie.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Wa,{src:ae.profile_picture_url||""}),r.jsx(di,{children:r.jsx(eu,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",ae.platform_username]}),w===ae.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(pm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),fe.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Wa,{src:ae.profile_picture_url||""}),r.jsx(di,{children:r.jsx(pm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.platform_username}),w===ae.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),de.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(pl,{className:"h-4 w-4 text-red-600"})," Google Business"]}),de.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Wa,{src:ae.profile_picture_url||""}),r.jsx(di,{children:r.jsx(pl,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.page_name||ae.platform_username}),w===ae.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},ae.id))]})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(J,{onClick:be,disabled:x.length===0||Ee,className:"gap-2",children:[Ee?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):S==="schedule"?r.jsx(Ys,{className:"h-4 w-4"}):r.jsx(Lo,{className:"h-4 w-4"}),S==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}var $De="AlertDialog",[Nxt]=Ql($De,[lPe]),fy=lPe(),UDe=e=>{const{__scopeAlertDialog:t,...n}=e,s=fy(t);return r.jsx(Vne,{...s,...n,modal:!0})};UDe.displayName=$De;var Sxt="AlertDialogTrigger",qDe=P.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=fy(n);return r.jsx(Sge,{...i,...s,ref:t})});qDe.displayName=Sxt;var Cxt="AlertDialogPortal",VDe=e=>{const{__scopeAlertDialog:t,...n}=e,s=fy(t);return r.jsx(Hne,{...s,...n})};VDe.displayName=Cxt;var Mxt="AlertDialogOverlay",HDe=P.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=fy(n);return r.jsx(o3,{...i,...s,ref:t})});HDe.displayName=Mxt;var TS="AlertDialogContent",[Txt,Axt]=Nxt(TS),Ext=eAe("AlertDialogContent"),WDe=P.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...i}=e,o=fy(n),l=P.useRef(null),a=ei(t,l),h=P.useRef(null);return r.jsx(hst,{contentName:TS,titleName:GDe,docsSlug:"alert-dialog",children:r.jsx(Txt,{scope:n,cancelRef:h,children:r.jsxs(l3,{role:"alertdialog",...o,...i,ref:a,onOpenAutoFocus:cn(i.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=h.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[r.jsx(Ext,{children:s}),r.jsx(Pxt,{contentRef:l})]})})})});WDe.displayName=TS;var GDe="AlertDialogTitle",KDe=P.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=fy(n);return r.jsx(xI,{...i,...s,ref:t})});KDe.displayName=GDe;var ZDe="AlertDialogDescription",YDe=P.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=fy(n);return r.jsx(yI,{...i,...s,ref:t})});YDe.displayName=ZDe;var Ixt="AlertDialogAction",XDe=P.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=fy(n);return r.jsx(Wne,{...i,...s,ref:t})});XDe.displayName=Ixt;var QDe="AlertDialogCancel",JDe=P.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:i}=Axt(QDe,n),o=fy(n),l=ei(t,i);return r.jsx(Wne,{...o,...s,ref:l})});JDe.displayName=QDe;var Pxt=({contentRef:e})=>{const t=`\`${TS}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${TS}\` by passing a \`${ZDe}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, 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 \`${TS}\`. 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. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return P.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Lxt=UDe,Oxt=qDe,Dxt=VDe,eRe=HDe,tRe=WDe,rRe=XDe,nRe=JDe,sRe=KDe,iRe=YDe;const uh=Lxt,V0=Oxt,Rxt=Dxt,aRe=P.forwardRef(({className:e,...t},n)=>r.jsx(eRe,{className:$t("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",e),...t,ref:n}));aRe.displayName=eRe.displayName;const wu=P.forwardRef(({className:e,...t},n)=>r.jsxs(Rxt,{children:[r.jsx(aRe,{}),r.jsx(tRe,{ref:n,className:$t("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",e),...t})]}));wu.displayName=tRe.displayName;const ju=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",e),...t});ju.displayName="AlertDialogHeader";const ku=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ku.displayName="AlertDialogFooter";const Nu=P.forwardRef(({className:e,...t},n)=>r.jsx(sRe,{ref:n,className:$t("text-lg font-semibold",e),...t}));Nu.displayName=sRe.displayName;const Su=P.forwardRef(({className:e,...t},n)=>r.jsx(iRe,{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));Su.displayName=iRe.displayName;const Jd=P.forwardRef(({className:e,...t},n)=>r.jsx(rRe,{ref:n,className:$t(XA(),e),...t}));Jd.displayName=rRe.displayName;const Cu=P.forwardRef(({className:e,...t},n)=>r.jsx(nRe,{ref:n,className:$t(XA({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Cu.displayName=nRe.displayName;function Fxt(){const e=Wr(),[t,n]=P.useState(void 0),[s,i]=P.useState("all"),[o,l]=P.useState(null),[a,h]=P.useState(""),[p,x]=P.useState(void 0),[y,w]=P.useState("12"),[j,S]=P.useState("00"),[C,A]=P.useState("PM"),{data:E=[],isLoading:T}=Jt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:de,error:_e}=await ee.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(_e)throw _e;return de}}),O=E.filter(de=>{if(s!=="all"&&de.status!==s)return!1;if(t&&de.scheduled_for){const _e=new Date(de.scheduled_for);if(!Kl(_e,t))return!1}return!0}),z=E.filter(de=>de.scheduled_for).map(de=>af(new Date(de.scheduled_for))),F=cr({mutationFn:async de=>{const{error:_e}=await ee.from("scheduled_posts").update({caption:de.caption,scheduled_for:de.scheduled_for}).eq("id",de.id);if(_e)throw _e},onSuccess:()=>{ze.success("Post updated!"),e.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:de=>{ze.error(`Failed to update: ${de.message}`)}}),q=cr({mutationFn:async de=>{const{error:_e}=await ee.from("scheduled_posts").update({status:"cancelled"}).eq("id",de);if(_e)throw _e},onSuccess:()=>{ze.success("Post cancelled"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{ze.error(`Failed to cancel: ${de.message}`)}}),H=cr({mutationFn:async de=>{const{error:_e}=await ee.from("scheduled_posts").delete().eq("id",de);if(_e)throw _e},onSuccess:()=>{ze.success("Post deleted"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{ze.error(`Failed to delete: ${de.message}`)}}),K=cr({mutationFn:async de=>{const{data:_e,error:Ee}=await ee.functions.invoke("social-post",{body:{platform:de.platform,accountId:de.social_account_id,imageUrl:de.image_url,caption:de.caption}});if(Ee)throw Ee;if(_e!=null&&_e.error)throw new Error(_e.error);return await ee.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:_e.postId}).eq("id",de.id),_e},onSuccess:de=>{const _e=de.platform==="facebook"?"Facebook":de.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Posted to ${_e}!`),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{ze.error(`Failed to post: ${de.message}`)}}),Z=de=>{if(l(de),h(de.caption||""),de.scheduled_for){const _e=new Date(de.scheduled_for);x(_e);const Ee=_e.getHours();w(String(Ee>12?Ee-12:Ee===0?12:Ee)),S(String(_e.getMinutes()).padStart(2,"0")),A(Ee>=12?"PM":"AM")}},re=()=>{if(!o||!p)return;let de=parseInt(y);const _e=parseInt(j);C==="PM"&&de!==12&&(de+=12),C==="AM"&&de===12&&(de=0);const Ee=S8e(N8e(p,de),_e);F.mutate({id:o.id,caption:a,scheduled_for:Ee.toISOString()})},ue=de=>{switch(de){case"facebook":return r.jsx(Pd,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(eu,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(pm,{className:"h-4 w-4 text-blue-700"});default:return null}},he=de=>{switch(de){case"scheduled":return r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Ft,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(qa,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Ft,{variant:"destructive",className:"gap-1",children:[r.jsx(zc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Ft,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(El,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Ft,{variant:"outline",children:de})}},be=Array.from({length:12},(de,_e)=>String(_e+1)),ne=["00","15","30","45"],ye=E.filter(de=>de.status==="scheduled").length,ie=E.filter(de=>de.status==="posted").length,fe=E.filter(de=>de.status==="scheduled"&&de.scheduled_for&&bdt(new Date(de.scheduled_for))).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs(We,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ye}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(We,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:fe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(We,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ie}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),r.jsxs(We,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:E.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})]}),r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs(We,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(um,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Bj,{mode:"single",selected:t,onSelect:n,className:$t("pointer-events-auto"),modifiers:{hasPost:z},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),t&&r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>n(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(uj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(de=>r.jsx(J,{variant:s===de?"default":"outline",size:"sm",onClick:()=>i(de),className:"capitalize",children:de},de))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!T&&O.length===0&&r.jsxs(We,{className:"p-8 text-center",children:[r.jsx(Ys,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("h3",{className:"font-medium mb-2",children:"No posts found"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t?`No posts scheduled for ${fn(t,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:O.map(de=>{var _e,Ee;return r.jsx(We,{className:"overflow-hidden",children:r.jsxs("div",{className:"flex flex-col sm:flex-row",children:[r.jsx("div",{className:"sm:w-32 h-32 sm:h-auto bg-muted flex-shrink-0",children:r.jsx("img",{src:de.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(Xe,{className:"flex-1 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ue(de.platform),r.jsx("span",{className:"font-medium",children:((_e=de.social_accounts)==null?void 0:_e.page_name)||((Ee=de.social_accounts)==null?void 0:Ee.platform_username)||"Unknown"}),he(de.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[de.status==="scheduled"&&r.jsxs(fI,{children:[r.jsxs(Ng,{children:[r.jsx(Sg,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>Z(de),children:r.jsx(ha,{className:"h-4 w-4"})})}),r.jsx(ym,{children:"Edit post"})]}),r.jsxs(Ng,{children:[r.jsx(Sg,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>K.mutate(de),disabled:K.isPending,children:K.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(Lo,{className:"h-4 w-4"})})}),r.jsx(ym,{children:"Post now"})]}),r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Cancel this scheduled post?"}),r.jsx(Su,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Keep"}),r.jsx(Jd,{onClick:()=>q.mutate(de.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Jd,{onClick:()=>H.mutate(de.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(de.status==="posted"||de.status==="cancelled"||de.status==="failed")&&r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Delete this post?"}),r.jsx(Su,{children:"This will permanently remove this post from your history."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>H.mutate(de.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),de.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:de.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),de.status==="posted"&&de.posted_at?`Posted ${fn(new Date(de.posted_at),"PPp")}`:de.scheduled_for?`Scheduled for ${fn(new Date(de.scheduled_for),"PPp")}`:"Not scheduled"]}),de.status==="failed"&&de.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",de.error_message]})]})]})},de.id)})})]})]}),r.jsx(Br,{open:!!o,onOpenChange:de=>!de&&l(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Scheduled Post"}),r.jsx(es,{children:"Update the caption or reschedule this post"})]}),o&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-32 mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:o.image_url,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Caption"}),r.jsx(ms,{value:a,onChange:de=>h(de.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(Ve,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(_h,{children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!p&&"text-muted-foreground"),children:[r.jsx(Ys,{className:"mr-2 h-4 w-4"}),p?fn(p,"PPP"):"Pick a date"]})}),r.jsx(Ou,{className:"w-auto p-0",align:"start",children:r.jsx(Bj,{mode:"single",selected:p,onSelect:x,disabled:de=>der.jsx(Kt,{value:de,children:de},de))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(bn,{value:j,onValueChange:S,children:[r.jsx(vn,{className:"w-[70px]",children:r.jsx(wn,{})}),r.jsx(_n,{children:ne.map(de=>r.jsx(Kt,{value:de,children:de},de))})]}),r.jsxs(bn,{value:C,onValueChange:de=>A(de),children:[r.jsx(vn,{className:"w-[70px]",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"AM",children:"AM"}),r.jsx(Kt,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(J,{onClick:re,disabled:F.isPending,children:[F.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function bL(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var oRe={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(n){e.exports=n()})(function(){return function n(s,i,o){function l(p,x){if(!i[p]){if(!s[p]){var y=typeof bL=="function"&&bL;if(!x&&y)return y(p,!0);if(a)return a(p,!0);var w=new Error("Cannot find module '"+p+"'");throw w.code="MODULE_NOT_FOUND",w}var j=i[p]={exports:{}};s[p][0].call(j.exports,function(S){var C=s[p][1][S];return l(C||S)},j,j.exports,n,s,i,o)}return i[p].exports}for(var a=typeof bL=="function"&&bL,h=0;h>2,j=(3&p)<<4|x>>4,S=1>6:64,C=2>4,x=(15&w)<<4|(j=a.indexOf(h.charAt(C++)))>>2,y=(3&j)<<6|(S=a.indexOf(h.charAt(C++))),T[A++]=p,j!==64&&(T[A++]=x),S!==64&&(T[A++]=y);return T}},{"./support":30,"./utils":32}],2:[function(n,s,i){var o=n("./external"),l=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),h=n("./stream/DataLengthProbe");function p(x,y,w,j,S){this.compressedSize=x,this.uncompressedSize=y,this.crc32=w,this.compression=j,this.compressedContent=S}p.prototype={getContentWorker:function(){var x=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),y=this;return x.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new l(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},p.createWorkerFrom=function(x,y,w){return x.pipe(new a).pipe(new h("uncompressedSize")).pipe(y.compressWorker(w)).pipe(new h("compressedSize")).withStreamInfo("compression",y)},s.exports=p},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,i){var o=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,i){var o=n("./utils"),l=function(){for(var a,h=[],p=0;p<256;p++){a=p;for(var x=0;x<8;x++)a=1&a?3988292384^a>>>1:a>>>1;h[p]=a}return h}();s.exports=function(a,h){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(p,x,y,w){var j=l,S=w+y;p^=-1;for(var C=w;C>>8^j[255&(p^x[C])];return-1^p}(0|h,a,a.length,0):function(p,x,y,w){var j=l,S=w+y;p^=-1;for(var C=w;C>>8^j[255&(p^x.charCodeAt(C))];return-1^p}(0|h,a,a.length,0):0}},{"./utils":32}],5:[function(n,s,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,s,i){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),a=n("./utils"),h=n("./stream/GenericWorker"),p=o?"uint8array":"array";function x(y,w){h.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=w,this.meta={}}i.magic="\b\0",a.inherits(x,h),x.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(p,y.data),!1)},x.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(w){y.push({data:w,meta:y.meta})}},i.compressWorker=function(y){return new x("Deflate",y)},i.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,i){function o(j,S){var C,A="";for(C=0;C>>=8;return A}function l(j,S,C,A,E,T){var O,z,F=j.file,q=j.compression,H=T!==p.utf8encode,K=a.transformTo("string",T(F.name)),Z=a.transformTo("string",p.utf8encode(F.name)),re=F.comment,ue=a.transformTo("string",T(re)),he=a.transformTo("string",p.utf8encode(re)),be=Z.length!==F.name.length,ne=he.length!==re.length,ye="",ie="",fe="",de=F.dir,_e=F.date,Ee={crc32:0,compressedSize:0,uncompressedSize:0};S&&!C||(Ee.crc32=j.crc32,Ee.compressedSize=j.compressedSize,Ee.uncompressedSize=j.uncompressedSize);var ke=0;S&&(ke|=8),H||!be&&!ne||(ke|=2048);var pe=0,ae=0;de&&(pe|=16),E==="UNIX"?(ae=798,pe|=function(Me,Ue){var Ie=Me;return Me||(Ie=Ue?16893:33204),(65535&Ie)<<16}(F.unixPermissions,de)):(ae=20,pe|=function(Me){return 63&(Me||0)}(F.dosPermissions)),O=_e.getUTCHours(),O<<=6,O|=_e.getUTCMinutes(),O<<=5,O|=_e.getUTCSeconds()/2,z=_e.getUTCFullYear()-1980,z<<=4,z|=_e.getUTCMonth()+1,z<<=5,z|=_e.getUTCDate(),be&&(ie=o(1,1)+o(x(K),4)+Z,ye+="up"+o(ie.length,2)+ie),ne&&(fe=o(1,1)+o(x(ue),4)+he,ye+="uc"+o(fe.length,2)+fe);var ge="";return ge+=` \0`,ge+=o(ke,2),ge+=q.magic,ge+=o(O,2),ge+=o(z,2),ge+=o(Ee.crc32,4),ge+=o(Ee.compressedSize,4),ge+=o(Ee.uncompressedSize,4),ge+=o(K.length,2),ge+=o(ye.length,2),{fileRecord:y.LOCAL_FILE_HEADER+ge+K+ye,dirRecord:y.CENTRAL_FILE_HEADER+o(ae,2)+ge+o(ue.length,2)+"\0\0\0\0"+o(pe,4)+o(A,4)+K+ye+ue}}var a=n("../utils"),h=n("../stream/GenericWorker"),p=n("../utf8"),x=n("../crc32"),y=n("../signature");function w(j,S,C,A){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=C,this.encodeFileName=A,this.streamFiles=j,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(w,h),w.prototype.push=function(j){var S=j.meta.percent||0,C=this.entriesCount,A=this._sources.length;this.accumulate?this.contentBuffer.push(j):(this.bytesWritten+=j.data.length,h.prototype.push.call(this,{data:j.data,meta:{currentFile:this.currentFile,percent:C?(S+100*(C-A-1))/C:100}}))},w.prototype.openedSource=function(j){this.currentSourceOffset=this.bytesWritten,this.currentFile=j.file.name;var S=this.streamFiles&&!j.file.dir;if(S){var C=l(j,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:C.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(j){this.accumulate=!1;var S=this.streamFiles&&!j.file.dir,C=l(j,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(C.dirRecord),S)this.push({data:function(A){return y.DATA_DESCRIPTOR+o(A.crc32,4)+o(A.compressedSize,4)+o(A.uncompressedSize,4)}(j),meta:{percent:100}});else for(this.push({data:C.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var j=this.bytesWritten,S=0;S=this.index;h--)p=(p<<8)+this.byteAt(h);return this.index+=a,p},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},s.exports=l},{"../utils":32}],19:[function(n,s,i){var o=n("./Uint8ArrayReader");function l(a){o.call(this,a)}n("../utils").inherits(l,o),l.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,i){var o=n("./DataReader");function l(a){o.call(this,a)}n("../utils").inherits(l,o),l.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},l.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},l.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},l.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,s,i){var o=n("./ArrayReader");function l(a){o.call(this,a)}n("../utils").inherits(l,o),l.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,i){var o=n("../utils"),l=n("../support"),a=n("./ArrayReader"),h=n("./StringReader"),p=n("./NodeBufferReader"),x=n("./Uint8ArrayReader");s.exports=function(y){var w=o.getTypeOf(y);return o.checkSupport(w),w!=="string"||l.uint8array?w==="nodebuffer"?new p(y):l.uint8array?new x(o.transformTo("uint8array",y)):new a(o.transformTo("array",y)):new h(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,i){var o=n("./GenericWorker"),l=n("../utils");function a(h){o.call(this,"ConvertWorker to "+h),this.destType=h}l.inherits(a,o),a.prototype.processChunk=function(h){this.push({data:l.transformTo(this.destType,h.data),meta:h.meta})},s.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,i){var o=n("./GenericWorker"),l=n("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,o),a.prototype.processChunk=function(h){this.streamInfo.crc32=l(h.data,this.streamInfo.crc32||0),this.push(h)},s.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,i){var o=n("../utils"),l=n("./GenericWorker");function a(h){l.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}o.inherits(a,l),a.prototype.processChunk=function(h){if(h){var p=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=p+h.data.length}l.prototype.processChunk.call(this,h)},s.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,i){var o=n("../utils"),l=n("./GenericWorker");function a(h){l.call(this,"DataWorker");var p=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(x){p.dataIsReady=!0,p.data=x,p.max=x&&x.length||0,p.type=o.getTypeOf(x),p.isPaused||p._tickAndRepeat()},function(x){p.error(x)})}o.inherits(a,l),a.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,p=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,p);break;case"uint8array":h=this.data.subarray(this.index,p);break;case"array":case"nodebuffer":h=this.data.slice(this.index,p)}return this.index=p,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,i){function o(l){this.name=l||"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(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,a){return this._listeners[l].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,a){if(this._listeners[l])for(var h=0;h "+l:l}},s.exports=o},{}],29:[function(n,s,i){var o=n("../utils"),l=n("./ConvertWorker"),a=n("./GenericWorker"),h=n("../base64"),p=n("../support"),x=n("../external"),y=null;if(p.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(S,C){return new x.Promise(function(A,E){var T=[],O=S._internalType,z=S._outputType,F=S._mimeType;S.on("data",function(q,H){T.push(q),C&&C(H)}).on("error",function(q){T=[],E(q)}).on("end",function(){try{var q=function(H,K,Z){switch(H){case"blob":return o.newBlob(o.transformTo("arraybuffer",K),Z);case"base64":return h.encode(K);default:return o.transformTo(H,K)}}(z,function(H,K){var Z,re=0,ue=null,he=0;for(Z=0;Z"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(o),i.blob=l.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,i){for(var o=n("./utils"),l=n("./support"),a=n("./nodejsUtils"),h=n("./stream/GenericWorker"),p=new Array(256),x=0;x<256;x++)p[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;p[254]=p[254]=1;function y(){h.call(this,"utf-8 decode"),this.leftOver=null}function w(){h.call(this,"utf-8 encode")}i.utf8encode=function(j){return l.nodebuffer?a.newBufferFrom(j,"utf-8"):function(S){var C,A,E,T,O,z=S.length,F=0;for(T=0;T>>6:(A<65536?C[O++]=224|A>>>12:(C[O++]=240|A>>>18,C[O++]=128|A>>>12&63),C[O++]=128|A>>>6&63),C[O++]=128|63&A);return C}(j)},i.utf8decode=function(j){return l.nodebuffer?o.transformTo("nodebuffer",j).toString("utf-8"):function(S){var C,A,E,T,O=S.length,z=new Array(2*O);for(C=A=0;C>10&1023,z[A++]=56320|1023&E)}return z.length!==A&&(z.subarray?z=z.subarray(0,A):z.length=A),o.applyFromCharCode(z)}(j=o.transformTo(l.uint8array?"uint8array":"array",j))},o.inherits(y,h),y.prototype.processChunk=function(j){var S=o.transformTo(l.uint8array?"uint8array":"array",j.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var C=S;(S=new Uint8Array(C.length+this.leftOver.length)).set(this.leftOver,0),S.set(C,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var A=function(T,O){var z;for((O=O||T.length)>T.length&&(O=T.length),z=O-1;0<=z&&(192&T[z])==128;)z--;return z<0||z===0?O:z+p[T[z]]>O?z:O}(S),E=S;A!==S.length&&(l.uint8array?(E=S.subarray(0,A),this.leftOver=S.subarray(A,S.length)):(E=S.slice(0,A),this.leftOver=S.slice(A,S.length))),this.push({data:i.utf8decode(E),meta:j.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=y,o.inherits(w,h),w.prototype.processChunk=function(j){this.push({data:i.utf8encode(j.data),meta:j.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,i){var o=n("./support"),l=n("./base64"),a=n("./nodejsUtils"),h=n("./external");function p(C){return C}function x(C,A){for(var E=0;E>8;this.dir=!!(16&this.externalFileAttributes),j==0&&(this.dosPermissions=63&this.externalFileAttributes),j==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var j=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=j.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=j.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=j.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=j.readInt(4))}},readExtraFields:function(j){var S,C,A,E=j.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});j.index+4>>6:(j<65536?w[A++]=224|j>>>12:(w[A++]=240|j>>>18,w[A++]=128|j>>>12&63),w[A++]=128|j>>>6&63),w[A++]=128|63&j);return w},i.buf2binstring=function(y){return x(y,y.length)},i.binstring2buf=function(y){for(var w=new o.Buf8(y.length),j=0,S=w.length;j>10&1023,T[S++]=56320|1023&C)}return x(T,S)},i.utf8border=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+h[y[j]]>w?j:w}},{"./common":41}],43:[function(n,s,i){s.exports=function(o,l,a,h){for(var p=65535&o|0,x=o>>>16&65535|0,y=0;a!==0;){for(a-=y=2e3>>1:l>>>1;a[h]=l}return a}();s.exports=function(l,a,h,p){var x=o,y=p+h;l^=-1;for(var w=p;w>>8^x[255&(l^a[w])];return-1^l}},{}],46:[function(n,s,i){var o,l=n("../utils/common"),a=n("./trees"),h=n("./adler32"),p=n("./crc32"),x=n("./messages"),y=0,w=4,j=0,S=-2,C=-1,A=4,E=2,T=8,O=9,z=286,F=30,q=19,H=2*z+1,K=15,Z=3,re=258,ue=re+Z+1,he=42,be=113,ne=1,ye=2,ie=3,fe=4;function de(xe,mt){return xe.msg=x[mt],mt}function _e(xe){return(xe<<1)-(4xe.avail_out&&(et=xe.avail_out),et!==0&&(l.arraySet(xe.output,mt.pending_buf,mt.pending_out,et,xe.next_out),xe.next_out+=et,mt.pending_out+=et,xe.total_out+=et,xe.avail_out-=et,mt.pending-=et,mt.pending===0&&(mt.pending_out=0))}function pe(xe,mt){a._tr_flush_block(xe,0<=xe.block_start?xe.block_start:-1,xe.strstart-xe.block_start,mt),xe.block_start=xe.strstart,ke(xe.strm)}function ae(xe,mt){xe.pending_buf[xe.pending++]=mt}function ge(xe,mt){xe.pending_buf[xe.pending++]=mt>>>8&255,xe.pending_buf[xe.pending++]=255&mt}function Me(xe,mt){var et,nt,Ae=xe.max_chain_length,pt=xe.strstart,Be=xe.prev_length,Qe=xe.nice_match,tt=xe.strstart>xe.w_size-ue?xe.strstart-(xe.w_size-ue):0,ht=xe.window,wt=xe.w_mask,Ct=xe.prev,It=xe.strstart+re,jt=ht[pt+Be-1],rr=ht[pt+Be];xe.prev_length>=xe.good_match&&(Ae>>=2),Qe>xe.lookahead&&(Qe=xe.lookahead);do if(ht[(et=mt)+Be]===rr&&ht[et+Be-1]===jt&&ht[et]===ht[pt]&&ht[++et]===ht[pt+1]){pt+=2,et++;do;while(ht[++pt]===ht[++et]&&ht[++pt]===ht[++et]&&ht[++pt]===ht[++et]&&ht[++pt]===ht[++et]&&ht[++pt]===ht[++et]&&ht[++pt]===ht[++et]&&ht[++pt]===ht[++et]&&ht[++pt]===ht[++et]&&pttt&&--Ae!=0);return Be<=xe.lookahead?Be:xe.lookahead}function Ue(xe){var mt,et,nt,Ae,pt,Be,Qe,tt,ht,wt,Ct=xe.w_size;do{if(Ae=xe.window_size-xe.lookahead-xe.strstart,xe.strstart>=Ct+(Ct-ue)){for(l.arraySet(xe.window,xe.window,Ct,Ct,0),xe.match_start-=Ct,xe.strstart-=Ct,xe.block_start-=Ct,mt=et=xe.hash_size;nt=xe.head[--mt],xe.head[mt]=Ct<=nt?nt-Ct:0,--et;);for(mt=et=Ct;nt=xe.prev[--mt],xe.prev[mt]=Ct<=nt?nt-Ct:0,--et;);Ae+=Ct}if(xe.strm.avail_in===0)break;if(Be=xe.strm,Qe=xe.window,tt=xe.strstart+xe.lookahead,ht=Ae,wt=void 0,wt=Be.avail_in,ht=Z)for(pt=xe.strstart-xe.insert,xe.ins_h=xe.window[pt],xe.ins_h=(xe.ins_h<=Z&&(xe.ins_h=(xe.ins_h<=Z)if(nt=a._tr_tally(xe,xe.strstart-xe.match_start,xe.match_length-Z),xe.lookahead-=xe.match_length,xe.match_length<=xe.max_lazy_match&&xe.lookahead>=Z){for(xe.match_length--;xe.strstart++,xe.ins_h=(xe.ins_h<=Z&&(xe.ins_h=(xe.ins_h<=Z&&xe.match_length<=xe.prev_length){for(Ae=xe.strstart+xe.lookahead-Z,nt=a._tr_tally(xe,xe.strstart-1-xe.prev_match,xe.prev_length-Z),xe.lookahead-=xe.prev_length-1,xe.prev_length-=2;++xe.strstart<=Ae&&(xe.ins_h=(xe.ins_h<xe.pending_buf_size-5&&(et=xe.pending_buf_size-5);;){if(xe.lookahead<=1){if(Ue(xe),xe.lookahead===0&&mt===y)return ne;if(xe.lookahead===0)break}xe.strstart+=xe.lookahead,xe.lookahead=0;var nt=xe.block_start+et;if((xe.strstart===0||xe.strstart>=nt)&&(xe.lookahead=xe.strstart-nt,xe.strstart=nt,pe(xe,!1),xe.strm.avail_out===0)||xe.strstart-xe.block_start>=xe.w_size-ue&&(pe(xe,!1),xe.strm.avail_out===0))return ne}return xe.insert=0,mt===w?(pe(xe,!0),xe.strm.avail_out===0?ie:fe):(xe.strstart>xe.block_start&&(pe(xe,!1),xe.strm.avail_out),ne)}),new Re(4,4,8,4,Ie),new Re(4,5,16,8,Ie),new Re(4,6,32,32,Ie),new Re(4,4,16,16,Ke),new Re(8,16,32,32,Ke),new Re(8,16,128,128,Ke),new Re(8,32,128,256,Ke),new Re(32,128,258,1024,Ke),new Re(32,258,258,4096,Ke)],i.deflateInit=function(xe,mt){return Ye(xe,mt,T,15,8,0)},i.deflateInit2=Ye,i.deflateReset=Te,i.deflateResetKeep=Je,i.deflateSetHeader=function(xe,mt){return xe&&xe.state?xe.state.wrap!==2?S:(xe.state.gzhead=mt,j):S},i.deflate=function(xe,mt){var et,nt,Ae,pt;if(!xe||!xe.state||5>8&255),ae(nt,nt.gzhead.time>>16&255),ae(nt,nt.gzhead.time>>24&255),ae(nt,nt.level===9?2:2<=nt.strategy||nt.level<2?4:0),ae(nt,255&nt.gzhead.os),nt.gzhead.extra&&nt.gzhead.extra.length&&(ae(nt,255&nt.gzhead.extra.length),ae(nt,nt.gzhead.extra.length>>8&255)),nt.gzhead.hcrc&&(xe.adler=p(xe.adler,nt.pending_buf,nt.pending,0)),nt.gzindex=0,nt.status=69):(ae(nt,0),ae(nt,0),ae(nt,0),ae(nt,0),ae(nt,0),ae(nt,nt.level===9?2:2<=nt.strategy||nt.level<2?4:0),ae(nt,3),nt.status=be);else{var Be=T+(nt.w_bits-8<<4)<<8;Be|=(2<=nt.strategy||nt.level<2?0:nt.level<6?1:nt.level===6?2:3)<<6,nt.strstart!==0&&(Be|=32),Be+=31-Be%31,nt.status=be,ge(nt,Be),nt.strstart!==0&&(ge(nt,xe.adler>>>16),ge(nt,65535&xe.adler)),xe.adler=1}if(nt.status===69)if(nt.gzhead.extra){for(Ae=nt.pending;nt.gzindex<(65535&nt.gzhead.extra.length)&&(nt.pending!==nt.pending_buf_size||(nt.gzhead.hcrc&&nt.pending>Ae&&(xe.adler=p(xe.adler,nt.pending_buf,nt.pending-Ae,Ae)),ke(xe),Ae=nt.pending,nt.pending!==nt.pending_buf_size));)ae(nt,255&nt.gzhead.extra[nt.gzindex]),nt.gzindex++;nt.gzhead.hcrc&&nt.pending>Ae&&(xe.adler=p(xe.adler,nt.pending_buf,nt.pending-Ae,Ae)),nt.gzindex===nt.gzhead.extra.length&&(nt.gzindex=0,nt.status=73)}else nt.status=73;if(nt.status===73)if(nt.gzhead.name){Ae=nt.pending;do{if(nt.pending===nt.pending_buf_size&&(nt.gzhead.hcrc&&nt.pending>Ae&&(xe.adler=p(xe.adler,nt.pending_buf,nt.pending-Ae,Ae)),ke(xe),Ae=nt.pending,nt.pending===nt.pending_buf_size)){pt=1;break}pt=nt.gzindexAe&&(xe.adler=p(xe.adler,nt.pending_buf,nt.pending-Ae,Ae)),pt===0&&(nt.gzindex=0,nt.status=91)}else nt.status=91;if(nt.status===91)if(nt.gzhead.comment){Ae=nt.pending;do{if(nt.pending===nt.pending_buf_size&&(nt.gzhead.hcrc&&nt.pending>Ae&&(xe.adler=p(xe.adler,nt.pending_buf,nt.pending-Ae,Ae)),ke(xe),Ae=nt.pending,nt.pending===nt.pending_buf_size)){pt=1;break}pt=nt.gzindexAe&&(xe.adler=p(xe.adler,nt.pending_buf,nt.pending-Ae,Ae)),pt===0&&(nt.status=103)}else nt.status=103;if(nt.status===103&&(nt.gzhead.hcrc?(nt.pending+2>nt.pending_buf_size&&ke(xe),nt.pending+2<=nt.pending_buf_size&&(ae(nt,255&xe.adler),ae(nt,xe.adler>>8&255),xe.adler=0,nt.status=be)):nt.status=be),nt.pending!==0){if(ke(xe),xe.avail_out===0)return nt.last_flush=-1,j}else if(xe.avail_in===0&&_e(mt)<=_e(et)&&mt!==w)return de(xe,-5);if(nt.status===666&&xe.avail_in!==0)return de(xe,-5);if(xe.avail_in!==0||nt.lookahead!==0||mt!==y&&nt.status!==666){var Qe=nt.strategy===2?function(tt,ht){for(var wt;;){if(tt.lookahead===0&&(Ue(tt),tt.lookahead===0)){if(ht===y)return ne;break}if(tt.match_length=0,wt=a._tr_tally(tt,0,tt.window[tt.strstart]),tt.lookahead--,tt.strstart++,wt&&(pe(tt,!1),tt.strm.avail_out===0))return ne}return tt.insert=0,ht===w?(pe(tt,!0),tt.strm.avail_out===0?ie:fe):tt.last_lit&&(pe(tt,!1),tt.strm.avail_out===0)?ne:ye}(nt,mt):nt.strategy===3?function(tt,ht){for(var wt,Ct,It,jt,rr=tt.window;;){if(tt.lookahead<=re){if(Ue(tt),tt.lookahead<=re&&ht===y)return ne;if(tt.lookahead===0)break}if(tt.match_length=0,tt.lookahead>=Z&&0tt.lookahead&&(tt.match_length=tt.lookahead)}if(tt.match_length>=Z?(wt=a._tr_tally(tt,1,tt.match_length-Z),tt.lookahead-=tt.match_length,tt.strstart+=tt.match_length,tt.match_length=0):(wt=a._tr_tally(tt,0,tt.window[tt.strstart]),tt.lookahead--,tt.strstart++),wt&&(pe(tt,!1),tt.strm.avail_out===0))return ne}return tt.insert=0,ht===w?(pe(tt,!0),tt.strm.avail_out===0?ie:fe):tt.last_lit&&(pe(tt,!1),tt.strm.avail_out===0)?ne:ye}(nt,mt):o[nt.level].func(nt,mt);if(Qe!==ie&&Qe!==fe||(nt.status=666),Qe===ne||Qe===ie)return xe.avail_out===0&&(nt.last_flush=-1),j;if(Qe===ye&&(mt===1?a._tr_align(nt):mt!==5&&(a._tr_stored_block(nt,0,0,!1),mt===3&&(Ee(nt.head),nt.lookahead===0&&(nt.strstart=0,nt.block_start=0,nt.insert=0))),ke(xe),xe.avail_out===0))return nt.last_flush=-1,j}return mt!==w?j:nt.wrap<=0?1:(nt.wrap===2?(ae(nt,255&xe.adler),ae(nt,xe.adler>>8&255),ae(nt,xe.adler>>16&255),ae(nt,xe.adler>>24&255),ae(nt,255&xe.total_in),ae(nt,xe.total_in>>8&255),ae(nt,xe.total_in>>16&255),ae(nt,xe.total_in>>24&255)):(ge(nt,xe.adler>>>16),ge(nt,65535&xe.adler)),ke(xe),0=et.w_size&&(pt===0&&(Ee(et.head),et.strstart=0,et.block_start=0,et.insert=0),ht=new l.Buf8(et.w_size),l.arraySet(ht,mt,wt-et.w_size,et.w_size,0),mt=ht,wt=et.w_size),Be=xe.avail_in,Qe=xe.next_in,tt=xe.input,xe.avail_in=wt,xe.next_in=0,xe.input=mt,Ue(et);et.lookahead>=Z;){for(nt=et.strstart,Ae=et.lookahead-(Z-1);et.ins_h=(et.ins_h<>>=Z=K>>>24,O-=Z,(Z=K>>>16&255)===0)ye[x++]=65535&K;else{if(!(16&Z)){if(!(64&Z)){K=z[(65535&K)+(T&(1<>>=Z,O-=Z),O<15&&(T+=ne[h++]<>>=Z=K>>>24,O-=Z,!(16&(Z=K>>>16&255))){if(!(64&Z)){K=F[(65535&K)+(T&(1<>>=Z,O-=Z,(Z=x-y)>3,T&=(1<<(O-=re<<3))-1,o.next_in=h,o.next_out=x,o.avail_in=h>>24&255)+(he>>>8&65280)+((65280&he)<<8)+((255&he)<<24)}function T(){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 O(he){var be;return he&&he.state?(be=he.state,he.total_in=he.total_out=be.total=0,he.msg="",be.wrap&&(he.adler=1&be.wrap),be.mode=S,be.last=0,be.havedict=0,be.dmax=32768,be.head=null,be.hold=0,be.bits=0,be.lencode=be.lendyn=new o.Buf32(C),be.distcode=be.distdyn=new o.Buf32(A),be.sane=1,be.back=-1,w):j}function z(he){var be;return he&&he.state?((be=he.state).wsize=0,be.whave=0,be.wnext=0,O(he)):j}function F(he,be){var ne,ye;return he&&he.state?(ye=he.state,be<0?(ne=0,be=-be):(ne=1+(be>>4),be<48&&(be&=15)),be&&(be<8||15=fe.wsize?(o.arraySet(fe.window,be,ne-fe.wsize,fe.wsize,0),fe.wnext=0,fe.whave=fe.wsize):(ye<(ie=fe.wsize-fe.wnext)&&(ie=ye),o.arraySet(fe.window,be,ne-ye,ie,fe.wnext),(ye-=ie)?(o.arraySet(fe.window,be,ne-ye,ye,0),fe.wnext=ye,fe.whave=fe.wsize):(fe.wnext+=ie,fe.wnext===fe.wsize&&(fe.wnext=0),fe.whave>>8&255,ne.check=a(ne.check,pt,2,0),pe=ke=0,ne.mode=2;break}if(ne.flags=0,ne.head&&(ne.head.done=!1),!(1&ne.wrap)||(((255&ke)<<8)+(ke>>8))%31){he.msg="incorrect header check",ne.mode=30;break}if((15&ke)!=8){he.msg="unknown compression method",ne.mode=30;break}if(pe-=4,xe=8+(15&(ke>>>=4)),ne.wbits===0)ne.wbits=xe;else if(xe>ne.wbits){he.msg="invalid window size",ne.mode=30;break}ne.dmax=1<>8&1),512&ne.flags&&(pt[0]=255&ke,pt[1]=ke>>>8&255,ne.check=a(ne.check,pt,2,0)),pe=ke=0,ne.mode=3;case 3:for(;pe<32;){if(_e===0)break e;_e--,ke+=ye[fe++]<>>8&255,pt[2]=ke>>>16&255,pt[3]=ke>>>24&255,ne.check=a(ne.check,pt,4,0)),pe=ke=0,ne.mode=4;case 4:for(;pe<16;){if(_e===0)break e;_e--,ke+=ye[fe++]<>8),512&ne.flags&&(pt[0]=255&ke,pt[1]=ke>>>8&255,ne.check=a(ne.check,pt,2,0)),pe=ke=0,ne.mode=5;case 5:if(1024&ne.flags){for(;pe<16;){if(_e===0)break e;_e--,ke+=ye[fe++]<>>8&255,ne.check=a(ne.check,pt,2,0)),pe=ke=0}else ne.head&&(ne.head.extra=null);ne.mode=6;case 6:if(1024&ne.flags&&(_e<(Me=ne.length)&&(Me=_e),Me&&(ne.head&&(xe=ne.head.extra_len-ne.length,ne.head.extra||(ne.head.extra=new Array(ne.head.extra_len)),o.arraySet(ne.head.extra,ye,fe,Me,xe)),512&ne.flags&&(ne.check=a(ne.check,ye,Me,fe)),_e-=Me,fe+=Me,ne.length-=Me),ne.length))break e;ne.length=0,ne.mode=7;case 7:if(2048&ne.flags){if(_e===0)break e;for(Me=0;xe=ye[fe+Me++],ne.head&&xe&&ne.length<65536&&(ne.head.name+=String.fromCharCode(xe)),xe&&Me<_e;);if(512&ne.flags&&(ne.check=a(ne.check,ye,Me,fe)),_e-=Me,fe+=Me,xe)break e}else ne.head&&(ne.head.name=null);ne.length=0,ne.mode=8;case 8:if(4096&ne.flags){if(_e===0)break e;for(Me=0;xe=ye[fe+Me++],ne.head&&xe&&ne.length<65536&&(ne.head.comment+=String.fromCharCode(xe)),xe&&Me<_e;);if(512&ne.flags&&(ne.check=a(ne.check,ye,Me,fe)),_e-=Me,fe+=Me,xe)break e}else ne.head&&(ne.head.comment=null);ne.mode=9;case 9:if(512&ne.flags){for(;pe<16;){if(_e===0)break e;_e--,ke+=ye[fe++]<>9&1,ne.head.done=!0),he.adler=ne.check=0,ne.mode=12;break;case 10:for(;pe<32;){if(_e===0)break e;_e--,ke+=ye[fe++]<>>=7&pe,pe-=7&pe,ne.mode=27;break}for(;pe<3;){if(_e===0)break e;_e--,ke+=ye[fe++]<>>=1)){case 0:ne.mode=14;break;case 1:if(re(ne),ne.mode=20,be!==6)break;ke>>>=2,pe-=2;break e;case 2:ne.mode=17;break;case 3:he.msg="invalid block type",ne.mode=30}ke>>>=2,pe-=2;break;case 14:for(ke>>>=7&pe,pe-=7&pe;pe<32;){if(_e===0)break e;_e--,ke+=ye[fe++]<>>16^65535)){he.msg="invalid stored block lengths",ne.mode=30;break}if(ne.length=65535&ke,pe=ke=0,ne.mode=15,be===6)break e;case 15:ne.mode=16;case 16:if(Me=ne.length){if(_e>>=5,pe-=5,ne.ndist=1+(31&ke),ke>>>=5,pe-=5,ne.ncode=4+(15&ke),ke>>>=4,pe-=4,286>>=3,pe-=3}for(;ne.have<19;)ne.lens[Be[ne.have++]]=0;if(ne.lencode=ne.lendyn,ne.lenbits=7,et={bits:ne.lenbits},mt=p(0,ne.lens,0,19,ne.lencode,0,ne.work,et),ne.lenbits=et.bits,mt){he.msg="invalid code lengths set",ne.mode=30;break}ne.have=0,ne.mode=19;case 19:for(;ne.have>>16&255,Ce=65535&Ae,!((Ke=Ae>>>24)<=pe);){if(_e===0)break e;_e--,ke+=ye[fe++]<>>=Ke,pe-=Ke,ne.lens[ne.have++]=Ce;else{if(Ce===16){for(nt=Ke+2;pe>>=Ke,pe-=Ke,ne.have===0){he.msg="invalid bit length repeat",ne.mode=30;break}xe=ne.lens[ne.have-1],Me=3+(3&ke),ke>>>=2,pe-=2}else if(Ce===17){for(nt=Ke+3;pe>>=Ke)),ke>>>=3,pe-=3}else{for(nt=Ke+7;pe>>=Ke)),ke>>>=7,pe-=7}if(ne.have+Me>ne.nlen+ne.ndist){he.msg="invalid bit length repeat",ne.mode=30;break}for(;Me--;)ne.lens[ne.have++]=xe}}if(ne.mode===30)break;if(ne.lens[256]===0){he.msg="invalid code -- missing end-of-block",ne.mode=30;break}if(ne.lenbits=9,et={bits:ne.lenbits},mt=p(x,ne.lens,0,ne.nlen,ne.lencode,0,ne.work,et),ne.lenbits=et.bits,mt){he.msg="invalid literal/lengths set",ne.mode=30;break}if(ne.distbits=6,ne.distcode=ne.distdyn,et={bits:ne.distbits},mt=p(y,ne.lens,ne.nlen,ne.ndist,ne.distcode,0,ne.work,et),ne.distbits=et.bits,mt){he.msg="invalid distances set",ne.mode=30;break}if(ne.mode=20,be===6)break e;case 20:ne.mode=21;case 21:if(6<=_e&&258<=Ee){he.next_out=de,he.avail_out=Ee,he.next_in=fe,he.avail_in=_e,ne.hold=ke,ne.bits=pe,h(he,ge),de=he.next_out,ie=he.output,Ee=he.avail_out,fe=he.next_in,ye=he.input,_e=he.avail_in,ke=ne.hold,pe=ne.bits,ne.mode===12&&(ne.back=-1);break}for(ne.back=0;Re=(Ae=ne.lencode[ke&(1<>>16&255,Ce=65535&Ae,!((Ke=Ae>>>24)<=pe);){if(_e===0)break e;_e--,ke+=ye[fe++]<>Je)])>>>16&255,Ce=65535&Ae,!(Je+(Ke=Ae>>>24)<=pe);){if(_e===0)break e;_e--,ke+=ye[fe++]<>>=Je,pe-=Je,ne.back+=Je}if(ke>>>=Ke,pe-=Ke,ne.back+=Ke,ne.length=Ce,Re===0){ne.mode=26;break}if(32&Re){ne.back=-1,ne.mode=12;break}if(64&Re){he.msg="invalid literal/length code",ne.mode=30;break}ne.extra=15&Re,ne.mode=22;case 22:if(ne.extra){for(nt=ne.extra;pe>>=ne.extra,pe-=ne.extra,ne.back+=ne.extra}ne.was=ne.length,ne.mode=23;case 23:for(;Re=(Ae=ne.distcode[ke&(1<>>16&255,Ce=65535&Ae,!((Ke=Ae>>>24)<=pe);){if(_e===0)break e;_e--,ke+=ye[fe++]<>Je)])>>>16&255,Ce=65535&Ae,!(Je+(Ke=Ae>>>24)<=pe);){if(_e===0)break e;_e--,ke+=ye[fe++]<>>=Je,pe-=Je,ne.back+=Je}if(ke>>>=Ke,pe-=Ke,ne.back+=Ke,64&Re){he.msg="invalid distance code",ne.mode=30;break}ne.offset=Ce,ne.extra=15&Re,ne.mode=24;case 24:if(ne.extra){for(nt=ne.extra;pe>>=ne.extra,pe-=ne.extra,ne.back+=ne.extra}if(ne.offset>ne.dmax){he.msg="invalid distance too far back",ne.mode=30;break}ne.mode=25;case 25:if(Ee===0)break e;if(Me=ge-Ee,ne.offset>Me){if((Me=ne.offset-Me)>ne.whave&&ne.sane){he.msg="invalid distance too far back",ne.mode=30;break}Ue=Me>ne.wnext?(Me-=ne.wnext,ne.wsize-Me):ne.wnext-Me,Me>ne.length&&(Me=ne.length),Ie=ne.window}else Ie=ie,Ue=de-ne.offset,Me=ne.length;for(EeH?(Z=Ue[Ie+A[be]],pe[ae+A[be]]):(Z=96,0),T=1<>de)+(O-=T)]=K<<24|Z<<16|re|0,O!==0;);for(T=1<>=1;if(T!==0?(ke&=T-1,ke+=T):ke=0,be++,--ge[he]==0){if(he===ye)break;he=y[w+A[be]]}if(ie>>7)]}function ae(Ae,pt){Ae.pending_buf[Ae.pending++]=255&pt,Ae.pending_buf[Ae.pending++]=pt>>>8&255}function ge(Ae,pt,Be){Ae.bi_valid>E-Be?(Ae.bi_buf|=pt<>E-Ae.bi_valid,Ae.bi_valid+=Be-E):(Ae.bi_buf|=pt<>>=1,Be<<=1,0<--pt;);return Be>>>1}function Ie(Ae,pt,Be){var Qe,tt,ht=new Array(A+1),wt=0;for(Qe=1;Qe<=A;Qe++)ht[Qe]=wt=wt+Be[Qe-1]<<1;for(tt=0;tt<=pt;tt++){var Ct=Ae[2*tt+1];Ct!==0&&(Ae[2*tt]=Ue(ht[Ct]++,Ct))}}function Ke(Ae){var pt;for(pt=0;pt>1;1<=Be;Be--)Je(Ae,ht,Be);for(tt=It;Be=Ae.heap[1],Ae.heap[1]=Ae.heap[Ae.heap_len--],Je(Ae,ht,1),Qe=Ae.heap[1],Ae.heap[--Ae.heap_max]=Be,Ae.heap[--Ae.heap_max]=Qe,ht[2*tt]=ht[2*Be]+ht[2*Qe],Ae.depth[tt]=(Ae.depth[Be]>=Ae.depth[Qe]?Ae.depth[Be]:Ae.depth[Qe])+1,ht[2*Be+1]=ht[2*Qe+1]=tt,Ae.heap[1]=tt++,Je(Ae,ht,1),2<=Ae.heap_len;);Ae.heap[--Ae.heap_max]=Ae.heap[1],function(rr,Ar){var gn,kn,Jr,zn,js,fr,xs=Ar.dyn_tree,bi=Ar.max_code,mi=Ar.stat_desc.static_tree,La=Ar.stat_desc.has_stree,da=Ar.stat_desc.extra_bits,tl=Ar.stat_desc.extra_base,rl=Ar.stat_desc.max_length,Ws=0;for(zn=0;zn<=A;zn++)rr.bl_count[zn]=0;for(xs[2*rr.heap[rr.heap_max]+1]=0,gn=rr.heap_max+1;gn>=7;tt>>=1)if(1&jt&&Ct.dyn_ltree[2*It]!==0)return l;if(Ct.dyn_ltree[18]!==0||Ct.dyn_ltree[20]!==0||Ct.dyn_ltree[26]!==0)return a;for(It=32;It>>3,(ht=Ae.static_len+3+7>>>3)<=tt&&(tt=ht)):tt=ht=Be+5,Be+4<=tt&&pt!==-1?nt(Ae,pt,Be,Qe):Ae.strategy===4||ht===tt?(ge(Ae,2+(Qe?1:0),3),Te(Ae,ue,he)):(ge(Ae,4+(Qe?1:0),3),function(Ct,It,jt,rr){var Ar;for(ge(Ct,It-257,5),ge(Ct,jt-1,5),ge(Ct,rr-4,4),Ar=0;Ar>>8&255,Ae.pending_buf[Ae.d_buf+2*Ae.last_lit+1]=255&pt,Ae.pending_buf[Ae.l_buf+Ae.last_lit]=255&Be,Ae.last_lit++,pt===0?Ae.dyn_ltree[2*Be]++:(Ae.matches++,pt--,Ae.dyn_ltree[2*(ne[Be]+y+1)]++,Ae.dyn_dtree[2*pe(pt)]++),Ae.last_lit===Ae.lit_bufsize-1},i._tr_align=function(Ae){ge(Ae,2,3),Me(Ae,O,ue),function(pt){pt.bi_valid===16?(ae(pt,pt.bi_buf),pt.bi_buf=0,pt.bi_valid=0):8<=pt.bi_valid&&(pt.pending_buf[pt.pending++]=255&pt.bi_buf,pt.bi_buf>>=8,pt.bi_valid-=8)}(Ae)}},{"../utils/common":41}],53:[function(n,s,i){s.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(n,s,i){(function(o){(function(l,a){if(!l.setImmediate){var h,p,x,y,w=1,j={},S=!1,C=l.document,A=Object.getPrototypeOf&&Object.getPrototypeOf(l);A=A&&A.setTimeout?A:l,h={}.toString.call(l.process)==="[object process]"?function(z){process.nextTick(function(){T(z)})}:function(){if(l.postMessage&&!l.importScripts){var z=!0,F=l.onmessage;return l.onmessage=function(){z=!1},l.postMessage("","*"),l.onmessage=F,z}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",O,!1):l.attachEvent("onmessage",O),function(z){l.postMessage(y+z,"*")}):l.MessageChannel?((x=new MessageChannel).port1.onmessage=function(z){T(z.data)},function(z){x.port2.postMessage(z)}):C&&"onreadystatechange"in C.createElement("script")?(p=C.documentElement,function(z){var F=C.createElement("script");F.onreadystatechange=function(){T(z),F.onreadystatechange=null,p.removeChild(F),F=null},p.appendChild(F)}):function(z){setTimeout(T,0,z)},A.setImmediate=function(z){typeof z!="function"&&(z=new Function(""+z));for(var F=new Array(arguments.length-1),q=0;q"u"?o===void 0?this:o:self)}).call(this,typeof Ax<"u"?Ax:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(oRe);var zxt=oRe.exports;const Bxt=za(zxt),$xt=()=>{const{isAdmin:e}=zr(),[t,n]=P.useState(null),[s,i]=P.useState(null),[o,l]=P.useState("all"),[a,h]=P.useState(new Set),[p,x]=P.useState(!1),[y,w]=P.useState(!1),[j,S]=P.useState("images"),[C,A]=P.useState(null),{data:E=[],isLoading:T}=Jt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:_e,error:Ee}=await ee.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ee)throw Ee;return _e}}),{data:O=[]}=Jt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:_e,error:Ee}=await ee.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ee)throw Ee;return _e}}),{data:z=[]}=Jt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:_e,error:Ee}=await ee.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ee)throw Ee;return _e}}),{data:F=[]}=Jt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:_e,error:Ee}=await ee.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ee)throw Ee;return _e||[]}}),q=F.length>0,H=P.useMemo(()=>o==="all"?null:z.find(_e=>_e.month===o)||null,[o,z]),K=P.useMemo(()=>[...new Set(E.map(Ee=>Ee.month))].sort((Ee,ke)=>ke.localeCompare(Ee)),[E]);P.useEffect(()=>{K.length>0&&o==="all"&&l(K[0])},[K,o]);const Z=_e=>{try{const Ee=uxe(_e,"yyyy-MM",new Date);return fn(Ee,"MMMM yyyy")}catch{return _e}},re=P.useMemo(()=>o==="all"?E:E.filter(_e=>_e.month===o),[o,E]),ue=P.useMemo(()=>{var _e;return o==="all"?null:((_e=O.find(Ee=>Ee.month===o))==null?void 0:_e.canva_link)||null},[o,O]),he=async _e=>{try{await navigator.clipboard.writeText(_e),ze.success("Caption copied to clipboard!")}catch{ze.error("Failed to copy caption")}},be=async(_e,Ee)=>{try{const pe=await(await fetch(_e)).blob(),ae=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),ge=navigator.canShare&&navigator.canShare({files:[new File([pe],"test.jpg",{type:"image/jpeg"})]});if(ae&&ge){const Me=new File([pe],`social-swag-${Ee}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Me],title:"Social Swag Image"}),ze.success("Image ready to save!")}else{const Me=window.URL.createObjectURL(pe),Ue=document.createElement("a");Ue.href=Me,Ue.download=`social-swag-${Ee}.jpg`,document.body.appendChild(Ue),Ue.click(),document.body.removeChild(Ue),window.URL.revokeObjectURL(Me),ze.success("Image downloaded!")}}catch(ke){ke.name!=="AbortError"&&ze.error("Failed to download image")}},ne=_e=>{h(Ee=>{const ke=new Set(Ee);return ke.has(_e)?ke.delete(_e):ke.add(_e),ke})},ye=()=>{h(new Set(re.map(_e=>_e.id)))},ie=()=>{h(new Set),x(!1)},fe=async()=>{const _e=re.filter(Ee=>a.has(Ee.id));if(_e.length===0){ze.error("No images selected");return}w(!0),ze.info(`Preparing ${_e.length} images for download...`);try{const Ee=new Bxt,ke=[..._e].sort((Ue,Ie)=>Ue.sort_order-Ie.sort_order);for(let Ue=0;Ue{p?ne(_e.id):n(_e)};return r.jsx(Or,{title:"Social Swag 2.0",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/80 to-info p-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[r.jsxs(Ft,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Ft,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Zo,{className:"h-3 w-3 mr-1"}),E.length," images"]})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Social Swag 📸"}),r.jsx("p",{className:"text-lg text-primary-foreground/90 max-w-2xl",children:"Ready-to-post social media images delivered to you monthly. Just download, copy the caption, and share with your audience!"})]})]}),e?r.jsxs(ba,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(fa,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(ln,{value:"gallery",className:"gap-2",children:[r.jsx(Zo,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(ln,{value:"scheduled",className:"gap-2",children:[r.jsx(um,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(An,{value:"gallery",className:"space-y-6",children:[e?q?r.jsx(We,{className:"border rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(J,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(co,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(We,{className:"border-2 border-dashed border-primary/30 bg-gradient-to-r from-pink-500/5 via-purple-500/5 to-blue-500/5 rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Pd,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(eu,{className:"h-5 w-5 text-pink-600"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Post directly to social media"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook & Instagram accounts to post images with one click!"})]}),r.jsx(J,{asChild:!0,className:"gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600",children:r.jsxs(co,{to:"/social-connections",children:[r.jsx(Yh,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(We,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ki,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Pd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(eu,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(_e=>r.jsx("button",{onClick:()=>l(_e),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===_e?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(_e)},_e))}),o!=="all"&&(ue?r.jsxs("a",{href:ue,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{S("images"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Zo,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{S("reels"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Md,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:ye,className:"gap-2",children:["Select All (",re.length,")"]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(Ts,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(J,{size:"sm",onClick:fe,disabled:y,className:"gap-2",children:[r.jsx(Xa,{className:"h-4 w-4"}),y?"Downloading...":`Download ${a.size} Selected`]}),r.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:"Please ensure your browser allows downloads from the LevelUp Dashboard."})]})]}):r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ca,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:re.map(_e=>{const Ee=a.has(_e.id);return r.jsx(We,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ee&&"ring-2 ring-primary ring-offset-2"),onClick:()=>de(_e),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:_e.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ee?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ee&&r.jsx(Ca,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},_e.id)})}),re.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Zo,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:H?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(We,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(H),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:H.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Ft,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Md,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Md,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Br,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:t&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:t.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ys,{className:"h-4 w-4"}),fn(new Date(t.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:t.caption})})]}),r.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[e&&r.jsxs(J,{onClick:()=>{A({imageUrl:t.image_url,imageId:t.id,caption:t.caption})},className:"w-full gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600 text-white",children:[r.jsx(Lo,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(J,{variant:"outline",onClick:()=>he(t.caption),className:"flex-1 gap-2",children:[r.jsx(jl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(J,{variant:"outline",onClick:()=>be(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(Xa,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Br,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Md,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(J,{onClick:()=>he(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(jl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(J,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(kxt,{open:!!C,onOpenChange:_e=>!_e&&A(null),imageUrl:(C==null?void 0:C.imageUrl)||"",imageId:(C==null?void 0:C.imageId)||"",defaultCaption:(C==null?void 0:C.caption)||"",swagItemId:C==null?void 0:C.imageId})]}),r.jsx(An,{value:"scheduled",children:r.jsx(Fxt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(We,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ki,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Pd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(eu,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(_e=>r.jsx("button",{onClick:()=>l(_e),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===_e?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(_e)},_e))}),o!=="all"&&(ue?r.jsxs("a",{href:ue,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{S("images"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Zo,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{S("reels"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Md,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:ye,className:"gap-2",children:["Select All (",re.length,")"]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(Ts,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs(J,{size:"sm",onClick:fe,disabled:y,className:"gap-2",children:[r.jsx(Xa,{className:"h-4 w-4"}),y?"Downloading...":`Download ${a.size} Selected`]})]}):r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ca,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:re.map(_e=>{const Ee=a.has(_e.id);return r.jsx(We,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ee&&"ring-2 ring-primary ring-offset-2"),onClick:()=>de(_e),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:_e.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ee?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ee&&r.jsx(Ca,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},_e.id)})}),re.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Zo,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:H?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(We,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(H),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:H.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Ft,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Md,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Md,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Br,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:t&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:t.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ys,{className:"h-4 w-4"}),fn(new Date(t.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:t.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[r.jsxs(J,{variant:"outline",onClick:()=>he(t.caption),className:"flex-1 gap-2",children:[r.jsx(jl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(J,{variant:"outline",onClick:()=>be(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(Xa,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Br,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Md,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(J,{onClick:()=>he(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(jl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(J,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},Uxt=()=>{const{swagId:e}=Wc(),{user:t}=zr(),{toast:n}=pa(),s=Wr(),{trackEngagement:i}=SI(),[o,l]=P.useState(""),{data:a,isLoading:h}=Jt({queryKey:["social-swag-detail",e],queryFn:async()=>{const{data:E,error:T}=await ee.from("social_swag").select("*").eq("id",e).single();if(T)throw T;const{data:O}=await ee.from("social_swag_links").select("*").eq("swag_id",e).order("sort_order");return{...E,links:O||[]}},enabled:!!e});P.useEffect(()=>{a&&i("social_swag",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:p=[]}=Jt({queryKey:["social-swag-likes",e],queryFn:async()=>{const{data:E,error:T}=await ee.from("social_swag_likes").select("*").eq("swag_id",e);if(T)throw T;return E},enabled:!!e}),{data:x=[]}=Jt({queryKey:["social-swag-comments",e],queryFn:async()=>{const{data:E,error:T}=await ee.from("social_swag_comments").select("*").eq("swag_id",e).order("created_at",{ascending:!1});if(T)throw T;const O=[...new Set(E.map(q=>q.user_id))],{data:z}=await ee.from("profiles").select("id, name").in("id",O),F=new Map((z==null?void 0:z.map(q=>[q.id,q.name]))||[]);return E.map(q=>({...q,user_name:F.get(q.user_id)||"Unknown User"}))},enabled:!!e}),y=cr({mutationFn:async E=>{const{error:T}=await ee.from("social_swag_comments").insert({swag_id:e,user_id:t.id,content:E});if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),l(""),n({title:"Comment added!"})},onError:E=>{n({title:"Error adding comment",description:E.message,variant:"destructive"})}}),w=cr({mutationFn:async E=>{const{error:T}=await ee.from("social_swag_comments").delete().eq("id",E);if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const E=p.find(T=>T.user_id===(t==null?void 0:t.id));if(E){const{error:T}=await ee.from("social_swag_likes").delete().eq("id",E.id);if(T)throw T}else{const{error:T}=await ee.from("social_swag_likes").insert({swag_id:e,user_id:t.id});if(T)throw T}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",e]})}}),S=p.some(E=>E.user_id===(t==null?void 0:t.id)),C=E=>E.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),A=E=>{E.preventDefault(),!(!o.trim()||!t)&&y.mutate(o.trim())};return h?r.jsx(Or,{title:"Social Swag",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Or,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/social-swag",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Social Swag"]})}),a.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:a.preview_image_url,alt:a.title,className:"w-full max-h-[500px] object-contain"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(f3,{resourceType:"social_swag",resourceId:a.id,resourceTitle:a.title}),r.jsxs(J,{variant:S?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!t||j.isPending,children:[r.jsx(Od,{className:`h-4 w-4 ${S?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.links.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(So,{className:"h-4 w-4"}),a.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:a.links.map(E=>r.jsxs(J,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{i("social_swag",a.id,a.title,"click_canva"),window.open(E.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:E.title}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground"})]},E.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Zl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),t?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(ms,{placeholder:"Add a comment...",value:o,onChange:E=>l(E.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(J,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(E=>r.jsx(We,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:C(E.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:E.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(E.created_at),{addSuffix:!0})}),E.user_id===(t==null?void 0:t.id)&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(E.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:E.content})]})]})})},E.id))})]})]})}):r.jsx(Or,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(So,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Item not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This item may have been removed or is not available."}),r.jsx(J,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/social-swag",children:"Back to Social Swag"})})]})})},qxt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,l]=P.useState(!0),[a,h]=P.useState(!0),[p,x]=P.useState(!0),y=w=>w.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2);return r.jsx("aside",{className:"w-64 shrink-0 hidden lg:block relative z-0",children:r.jsx("div",{className:"sticky top-4 space-y-4 max-h-[calc(100vh-8rem)] overflow-y-auto overscroll-contain",children:r.jsxs("div",{className:"space-y-2 pr-4",children:[r.jsxs(J,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(eS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(kS,{open:o,onOpenChange:l,children:[r.jsx(NS,{asChild:!0,children:r.jsxs(J,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Categories"}),o?r.jsx(Iu,{className:"h-4 w-4"}):r.jsx(Ga,{className:"h-4 w-4"})]})}),r.jsx(SS,{className:"space-y-1 pl-2",children:e.map(w=>r.jsxs(J,{variant:n===w.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(w.id),children:[r.jsx("span",{className:"mr-2",children:w.icon||"📂"}),r.jsx("span",{className:"truncate",children:w.name})]},w.id))})]}),t.length>0&&r.jsxs(kS,{open:a,onOpenChange:h,children:[r.jsx(NS,{asChild:!0,children:r.jsxs(J,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Wf,{className:"h-3 w-3"}),"Your Groups"]}),a?r.jsx(Iu,{className:"h-4 w-4"}):r.jsx(Ga,{className:"h-4 w-4"})]})}),r.jsx(SS,{className:"space-y-1 pl-2",children:t.map(w=>r.jsxs(J,{variant:n===`group:${w.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${w.id}`),children:[r.jsx("span",{className:"mr-2",children:w.icon||"🔒"}),r.jsx("span",{className:"truncate",children:w.name})]},w.id))})]}),r.jsxs(kS,{open:p,onOpenChange:x,children:[r.jsx(NS,{asChild:!0,children:r.jsxs(J,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Kn,{className:"h-3 w-3"}),"Online Now",i.length>0&&r.jsx("span",{className:"ml-1 bg-green-500 text-white text-xs rounded-full px-1.5 py-0.5 min-w-[20px] text-center",children:i.length})]}),p?r.jsx(Iu,{className:"h-4 w-4"}):r.jsx(Ga,{className:"h-4 w-4"})]})}),r.jsx(SS,{className:"pl-2 space-y-1",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):i.map(w=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-md hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(ci,{className:"h-7 w-7",children:[r.jsx(Wa,{src:w.avatarUrl}),r.jsx(di,{className:"text-xs",children:y(w.name)})]}),r.jsx(Pu,{className:"h-2.5 w-2.5 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"text-sm truncate",children:w.name})]},w.id))})]})]})})})},Vxt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,l]=P.useState(!1),a=p=>p.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),h=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const x=n.replace("group:",""),y=t.find(w=>w.id===x);return y?`🔒 ${y.name}`:"Private Group"}const p=e.find(x=>x.id===n);return p?`${p.icon||"📂"} ${p.name}`:"Category"};return r.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:h()}),r.jsx(Iu,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(ap,{className:"w-56 bg-background border",children:[r.jsxs(po,{onClick:()=>s("all"),children:[r.jsx(eS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(fC,{}),r.jsx(ghe,{className:"text-xs text-muted-foreground",children:"Categories"}),e.map(p=>r.jsxs(po,{onClick:()=>s(p.id),children:[r.jsx("span",{className:"mr-2",children:p.icon||"📂"}),p.name]},p.id)),t.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(fC,{}),r.jsxs(ghe,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Wf,{className:"h-3 w-3"}),"Your Groups"]}),t.map(p=>r.jsxs(po,{onClick:()=>s(`group:${p.id}`),children:[r.jsx("span",{className:"mr-2",children:p.icon||"🔒"}),p.name]},p.id))]})]})]}),r.jsxs(Jne,{open:o,onOpenChange:l,children:[r.jsx(Ige,{asChild:!0,children:r.jsxs(J,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(Kn,{className:"h-4 w-4"}),i.length>0&&r.jsx("span",{className:"absolute -top-1 -right-1 bg-green-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:i.length})]})}),r.jsxs(_I,{children:[r.jsx(ese,{children:r.jsxs(tse,{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5"}),"Online Now (",i.length,")"]})}),r.jsx(Jo,{className:"h-[calc(100vh-8rem)] mt-4",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No one else online right now"}):r.jsx("div",{className:"space-y-2",children:i.map(p=>r.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:p.avatarUrl}),r.jsx(di,{children:a(p.name)})]}),r.jsx(Pu,{className:"h-3 w-3 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"font-medium",children:p.name})]},p.id))})})]})]})]})};var sce,Ase="HoverCard",[lRe]=Ql(Ase,[Rg]),Ese=Rg(),[Hxt,Rxe]=lRe(Ase),cRe=e=>{const{__scopeHoverCard:t,children:n,open:s,defaultOpen:i,onOpenChange:o,openDelay:l=700,closeDelay:a=300}=e,h=Ese(t),p=P.useRef(0),x=P.useRef(0),y=P.useRef(!1),w=P.useRef(!1),[j,S]=Lu({prop:s,defaultProp:i??!1,onChange:o,caller:Ase}),C=P.useCallback(()=>{clearTimeout(x.current),p.current=window.setTimeout(()=>S(!0),l)},[l,S]),A=P.useCallback(()=>{clearTimeout(p.current),!y.current&&!w.current&&(x.current=window.setTimeout(()=>S(!1),a))},[a,S]),E=P.useCallback(()=>S(!1),[S]);return P.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(x.current)},[]),r.jsx(Hxt,{scope:t,open:j,onOpenChange:S,onOpen:C,onClose:A,onDismiss:E,hasSelectionRef:y,isPointerDownOnContentRef:w,children:r.jsx(dI,{...h,children:n})})};cRe.displayName=Ase;var dRe="HoverCardTrigger",uRe=P.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,i=Rxe(dRe,n),o=Ese(n);return r.jsx(e3,{asChild:!0,...o,children:r.jsx(Rn.a,{"data-state":i.open?"open":"closed",...s,ref:t,onPointerEnter:cn(e.onPointerEnter,jte(i.onOpen)),onPointerLeave:cn(e.onPointerLeave,jte(i.onClose)),onFocus:cn(e.onFocus,i.onOpen),onBlur:cn(e.onBlur,i.onClose),onTouchStart:cn(e.onTouchStart,l=>l.preventDefault())})})});uRe.displayName=dRe;var Wxt="HoverCardPortal",[KZt,Gxt]=lRe(Wxt,{forceMount:void 0}),wte="HoverCardContent",hRe=P.forwardRef((e,t)=>{const n=Gxt(wte,e.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=e,o=Rxe(wte,e.__scopeHoverCard);return r.jsx(fc,{present:s||o.open,children:r.jsx(Kxt,{"data-state":o.open?"open":"closed",...i,onPointerEnter:cn(e.onPointerEnter,jte(o.onOpen)),onPointerLeave:cn(e.onPointerLeave,jte(o.onClose)),ref:t})})});hRe.displayName=wte;var Kxt=P.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,...a}=e,h=Rxe(wte,n),p=Ese(n),x=P.useRef(null),y=ei(t,x),[w,j]=P.useState(!1);return P.useEffect(()=>{if(w){const S=document.body;return sce=S.style.userSelect||S.style.webkitUserSelect,S.style.userSelect="none",S.style.webkitUserSelect="none",()=>{S.style.userSelect=sce,S.style.webkitUserSelect=sce}}},[w]),P.useEffect(()=>{if(x.current){const S=()=>{j(!1),h.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var A;((A=document.getSelection())==null?void 0:A.toString())!==""&&(h.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",S),()=>{document.removeEventListener("pointerup",S),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!1}}},[h.isPointerDownOnContentRef,h.hasSelectionRef]),P.useEffect(()=>{x.current&&Xxt(x.current).forEach(C=>C.setAttribute("tabindex","-1"))}),r.jsx(X1,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:cn(o,S=>{S.preventDefault()}),onDismiss:h.onDismiss,children:r.jsx(uI,{...p,...a,onPointerDown:cn(a.onPointerDown,S=>{S.currentTarget.contains(S.target)&&j(!0),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!0}),ref:y,style:{...a.style,userSelect:w?"text":void 0,WebkitUserSelect:w?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Zxt="HoverCardArrow",Yxt=P.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,i=Ese(n);return r.jsx(hI,{...i,...s,ref:t})});Yxt.displayName=Zxt;function jte(e){return t=>t.pointerType==="touch"?void 0:e()}function Xxt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var Qxt=cRe,Jxt=uRe,fRe=hRe;const eyt=Qxt,tyt=Jxt,pRe=P.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},i)=>r.jsx(fRe,{ref:i,align:t,sideOffset:n,className:$t("z-50 w-64 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]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));pRe.displayName=fRe.displayName;const ryt=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"},{type:"laugh",emoji:"😂",label:"Haha"},{type:"wow",emoji:"😮",label:"Wow"},{type:"sad",emoji:"😢",label:"Sad"},{type:"angry",emoji:"😠",label:"Angry"}],nyt=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),mRe=({reactions:e,children:t})=>{if(e.length===0)return r.jsx(r.Fragment,{children:t});const n={};return e.forEach(s=>{n[s.reaction_type]||(n[s.reaction_type]=[]),n[s.reaction_type].push(s)}),r.jsxs(eyt,{openDelay:200,closeDelay:100,children:[r.jsx(tyt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:t})}),r.jsx(pRe,{className:"w-64 p-3 bg-popover border shadow-lg z-50",side:"top",align:"start",children:r.jsx("div",{className:"space-y-3",children:Object.entries(n).map(([s,i])=>{const o=ryt.find(l=>l.type===s);return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("span",{className:"text-lg",children:o==null?void 0:o.emoji}),r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[o==null?void 0:o.label," (",i.length,")"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[i.slice(0,10).map(l=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ci,{className:"h-6 w-6",children:[r.jsx(Wa,{src:l.user_avatar||void 0}),r.jsx(di,{className:"text-[10px]",children:nyt(l.user_name||"U")})]}),r.jsx("span",{className:"text-sm text-foreground truncate",children:l.user_name||"Unknown User"})]},l.id)),i.length>10&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",i.length-10," more"]})]})]},s)})})})]})};function syt({images:e,initialIndex:t=0,open:n,onOpenChange:s}){const[i,o]=P.useState(t),[l,a]=P.useState(!1);P.useEffect(()=>{n&&(o(t),a(!1))},[n,t]);const h=()=>{o(w=>w>0?w-1:e.length-1),a(!1)},p=()=>{o(w=>w{n&&(w.key==="ArrowLeft"&&h(),w.key==="ArrowRight"&&p(),w.key==="Escape"&&s(!1))},[n,e.length]);P.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const y=e[i];return r.jsx(Br,{open:n,onOpenChange:s,children:r.jsxs(Fr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>s(!1),children:r.jsx(Ts,{className:"h-6 w-6"})}),e.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:h,children:r.jsx(qc,{className:"h-8 w-8"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:p,children:r.jsx(Ga,{className:"h-8 w-8"})})]}),e.length>1&&r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 text-white text-sm bg-black/50 px-3 py-1 rounded-full",children:[i+1," / ",e.length]}),(y==null?void 0:y.type)==="image"&&r.jsx(J,{variant:"ghost",size:"icon",className:"absolute top-2 left-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>a(!l),children:l?r.jsx(xS,{className:"h-5 w-5"}):r.jsx(gS,{className:"h-5 w-5"})}),r.jsx("div",{className:$t("flex items-center justify-center w-full h-full min-h-[50vh] p-4",l?"cursor-zoom-out overflow-auto":"cursor-zoom-in"),onClick:()=>(y==null?void 0:y.type)==="image"&&a(!l),children:(y==null?void 0:y.type)==="video"?r.jsx("video",{src:y.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-[85vh] object-contain",onClick:w=>w.stopPropagation()}):r.jsx("img",{src:y==null?void 0:y.url,alt:"",className:$t("object-contain transition-transform duration-200",l?"max-w-none max-h-none scale-150":"max-w-full max-h-[85vh]")})}),e.length>1&&r.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-50 flex gap-2 bg-black/50 p-2 rounded-lg max-w-[90vw] overflow-x-auto",children:e.map((w,j)=>r.jsx("button",{onClick:()=>{o(j),a(!1)},className:$t("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",i===j?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:w.type==="video"?r.jsx("video",{src:w.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:w.url,alt:"",className:"w-full h-full object-cover"})},j))})]})})}const wL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],iyt=({commentId:e,reactions:t,currentUserId:n})=>{var p,x;const s=Wr(),[i,o]=P.useState(!1),l=t.find(y=>y.user_id===n),a=cr({mutationFn:async y=>{l?l.reaction_type===y?await ee.from("community_comment_reactions").delete().eq("id",l.id):await ee.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await ee.from("community_comment_reactions").insert({comment_id:e,user_id:n,reaction_type:y})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),h={};return t.forEach(y=>{h[y.reaction_type]=(h[y.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>0&&r.jsx(mRe,{reactions:t,children:r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("div",{className:"flex -space-x-0.5",children:Object.keys(h).slice(0,2).map(y=>{var w;return r.jsx("span",{className:"text-sm",children:(w=wL.find(j=>j.type===y))==null?void 0:w.emoji},y)})}),r.jsx("span",{children:t.length})]})}),n&&r.jsxs(_h,{open:i,onOpenChange:o,children:[r.jsx(bh,{asChild:!0,children:r.jsx("button",{className:`text-xs hover:text-primary transition-colors ${l?"text-primary font-medium":"text-muted-foreground"}`,children:l?r.jsxs("span",{children:[(p=wL.find(y=>y.type===l.reaction_type))==null?void 0:p.emoji," ",(x=wL.find(y=>y.type===l.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(Ou,{className:"w-auto p-1.5 bg-popover border shadow-lg z-50",side:"top",children:r.jsx("div",{className:"flex gap-0.5",children:wL.map(y=>r.jsx("button",{onClick:()=>a.mutate(y.type),className:"text-xl hover:scale-125 transition-transform p-1",title:y.label,children:y.emoji},y.type))})})]})]})};function Fxe({content:e,className:t}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,s=[];let i=0,o,l=0;for(;(o=n.exec(e))!==null;){if(o.index>i&&s.push(e.substring(i,o.index)),o[1]){const a=o[1],h=o[2],p=o[3],x=a==="#";s.push(r.jsx(co,{to:x?`/templates/${p}`:`/profile?user=${p}`,className:$t("font-medium hover:underline",x?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:y=>y.stopPropagation(),children:x?h:`@${h}`},`mention-${l++}`))}else if(o[4]){const a=o[4],h=a.replace(/[.,;:!?)]+$/,""),p=a.slice(h.length);let x;try{const y=new URL(h);x=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{x=h.length>40?h.slice(0,40)+"...":h}s.push(r.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:y=>y.stopPropagation(),children:x},`url-${l++}`)),p&&s.push(p)}i=o.index+o[0].length}return ir.jsx(P.Fragment,{children:a},h))})}function kte({value:e,onChange:t,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:i="80px",onMentionsChange:o,onTemplatesChange:l,onKeyDown:a,mentionFormat:h="encoded",enableTemplateMentions:p=!1}){const x=P.useRef(null),y=P.useRef(null),[w,j]=P.useState(!1),[S,C]=P.useState("user"),[A,E]=P.useState(""),[T,O]=P.useState(null),[z,F]=P.useState(0),[q,H]=P.useState({top:0,left:0,width:0}),K=P.useRef(new Map),Z=P.useRef(new Map),re=pe=>{if(h==="plain"){const Ue=[];return K.current.forEach((Ke,Re)=>{pe.includes(`@${Re}`)&&Ue.push(Ke)}),[...new Set(Ue)]}const ae=/@\[([^\]]+)\]\(([^)]+)\)/g,ge=[];let Me;for(;(Me=ae.exec(pe))!==null;)ge.push(Me[2]);return[...new Set(ge)]},ue=pe=>{if(h==="plain"){const Ue=[];return Z.current.forEach((Ke,Re)=>{pe.includes(`#${Re}`)&&Ue.push(Ke)}),[...new Set(Ue)]}const ae=/#\[([^\]]+)\]\(([^)]+)\)/g,ge=[];let Me;for(;(Me=ae.exec(pe))!==null;)ge.push(Me[2]);return[...new Set(ge)]};P.useEffect(()=>{if(o){const pe=re(e);o(pe)}if(l){const pe=ue(e);l(pe)}},[e,o,l,h]);const{data:he=[],isLoading:be}=Jt({queryKey:["mention-users",A],queryFn:async()=>{const pe=ee.from("profiles").select("id, name").limit(8),ae=A.length>=1?pe.ilike("name",`%${A}%`):pe.order("name"),{data:ge,error:Me}=await ae;if(Me)throw Me;const Ue=ge.map(Ke=>Ke.id),Ie=await P6e(Ue);return ge.map(Ke=>({id:Ke.id,name:Ke.name||"Unknown",avatar_url:Ie.get(Ke.id)}))},enabled:w&&S==="user",staleTime:3e4}),{data:ne=[],isLoading:ye}=Jt({queryKey:["mention-templates",A],queryFn:async()=>{let pe=ee.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);A.length>=1&&(pe=pe.ilike("name",`%${A}%`));const{data:ae,error:ge}=await pe;if(ge)throw ge;return ae||[]},enabled:w&&S==="template"&&p,staleTime:3e4}),ie=S==="user"?be:ye,fe=S==="user"?he:ne,de=pe=>pe.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),_e=pe=>{const ae=pe.target.value,ge=pe.target.selectionStart;t(ae);const Me=ae.substring(0,ge),Ue=Me.lastIndexOf("@"),Ie=p?Me.lastIndexOf("#"):-1;let Ke=-1,Re="user";if(Ue>Ie?(Ke=Ue,Re="user"):Ie>Ue&&p&&(Ke=Ie,Re="template"),Ke!==-1){const Ce=Me.substring(Ke+1),Je=Ce.includes(" "),Te=Ce.includes(` `);if(!Je&&!Te&&Ce.length<=30){O(Ke),E(Ce),C(Re),j(!0),F(0);return}}j(!1),O(null)},Ee=pe=>{if(T===null)return;const ae=e.substring(0,T),ge=e.substring(T+A.length+1),Me=S==="user"?"@":"#",Ue=h==="plain"?`${Me}${pe.name} `:`${Me}[${pe.name}](${pe.id}) `;h==="plain"&&(S==="user"?K.current.set(pe.name,pe.id):Z.current.set(pe.name,pe.id));const Ie=ae+Ue+ge;t(Ie),j(!1),O(null),E(""),setTimeout(()=>{if(x.current){const Ke=ae.length+Ue.length;x.current.focus(),x.current.setSelectionRange(Ke,Ke)}},0)},ke=pe=>{if(!(!w||fe.length===0))switch(pe.key){case"ArrowDown":pe.preventDefault(),F(ae=>(ae+1)%fe.length);break;case"ArrowUp":pe.preventDefault(),F(ae=>(ae-1+fe.length)%fe.length);break;case"Enter":fe[z]&&(pe.preventDefault(),Ee(fe[z]));break;case"Escape":pe.preventDefault(),j(!1);break;case"Tab":fe[z]&&(pe.preventDefault(),Ee(fe[z]));break}};return P.useEffect(()=>{const pe=ae=>{y.current&&!y.current.contains(ae.target)&&x.current&&!x.current.contains(ae.target)&&j(!1)};return document.addEventListener("mousedown",pe),()=>document.removeEventListener("mousedown",pe)},[]),P.useEffect(()=>{if(!w)return;const pe=()=>{const ae=x.current;if(!ae)return;const ge=ae.getBoundingClientRect();H({top:ge.bottom+4,left:ge.left,width:ge.width})};return pe(),window.addEventListener("resize",pe),window.addEventListener("scroll",pe,!0),()=>{window.removeEventListener("resize",pe),window.removeEventListener("scroll",pe,!0)}},[w,e]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ms,{ref:x,value:e,onChange:_e,onKeyDown:pe=>{ke(pe),pe.defaultPrevented||a==null||a(pe)},placeholder:n,className:$t("resize-none",s),style:{minHeight:i}}),w&&hy.createPortal(r.jsxs("div",{ref:y,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:q.top,left:q.left,width:q.width,maxWidth:"320px"},children:[r.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:S==="user"?"👤 Mention a person":"📋 Link a template"}),ie?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):fe.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:A.length<1?`Type to search ${S==="user"?"people":"templates"}...`:`No ${S==="user"?"users":"templates"} found`}):r.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:fe.map((pe,ae)=>r.jsx("li",{className:$t("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",ae===z?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ee(pe),onMouseEnter:()=>F(ae),children:S==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(ci,{className:"h-6 w-6",children:[r.jsx(Wa,{src:pe.avatar_url}),r.jsx(di,{className:"text-xs",children:de(pe.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:pe.name})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center overflow-hidden flex-shrink-0",children:pe.preview_image_url?r.jsx("img",{src:pe.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(Ld,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:pe.name})]})},pe.id))})]}),document.body)]})}function ayt(e){const t=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=t.exec(e))!==null;)n.push(s[2]);return[...new Set(n)]}const Ake=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);function gRe({comment:e,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:l=0}){const a=Wr(),[h,p]=P.useState(!1),[x,y]=P.useState(""),[w,j]=P.useState([]),S=cr({mutationFn:async({content:T,parentCommentId:O})=>{const{data:z,error:F}=await ee.from("community_comments").insert({post_id:t,user_id:n,content:T,parent_comment_id:O}).select("id").single();if(F)throw F;const q=w;if(q.length>0&&z){const H=q.filter(K=>K!==n).map(K=>({comment_id:z.id,mentioned_user_id:K,mentioned_by_user_id:n}));H.length>0&&await ee.from("community_comment_mentions").insert(H)}},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),y(""),j([]),p(!1)}}),C=cr({mutationFn:async T=>{const{error:O}=await ee.from("community_comments").delete().eq("id",T);if(O)throw O},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),A=()=>{x.trim()&&S.mutate({content:x,parentCommentId:e.id})};return r.jsxs("div",{className:l>0?"ml-8 border-l-2 border-muted pl-3":"",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ci,{className:"h-8 w-8 shrink-0",children:[r.jsx(Wa,{src:e.user_avatar||void 0}),r.jsx(di,{className:"text-xs",children:Ake(e.user_name||"U")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"bg-muted rounded-lg px-3 py-2",children:[r.jsx("div",{className:"font-medium text-sm",children:e.user_name}),r.jsx(Fxe,{content:e.content,className:"text-sm break-words"})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground flex-wrap",children:[r.jsx("span",{children:tu(new Date(e.created_at),{addSuffix:!0})}),r.jsx(iyt,{commentId:e.id,reactions:e.reactions,currentUserId:n}),n&&l<2&&r.jsxs("button",{onClick:()=>p(!h),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(qT,{className:"h-3 w-3"}),"Reply"]}),(e.user_id===n||o)&&r.jsx("button",{onClick:()=>C.mutate(e.id),className:"hover:text-destructive",children:e.user_id!==n?"Remove":"Delete"})]}),h&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(ci,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Wa,{src:s||void 0}),r.jsx(di,{className:"text-xs",children:Ake((i==null?void 0:i.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(kte,{placeholder:`Reply to ${e.user_name}...`,value:x,onChange:y,onMentionsChange:j,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(J,{size:"sm",variant:"ghost",onClick:A,disabled:!x.trim()||S.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(Lo,{className:"h-3 w-3"})})]})]})]})]}),e.replies&&e.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:e.replies.map(T=>r.jsx(gRe,{comment:T,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:l+1},T.id))})]})}const jL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"},{type:"laugh",emoji:"😂",label:"Haha"},{type:"wow",emoji:"😮",label:"Wow"},{type:"sad",emoji:"😢",label:"Sad"},{type:"angry",emoji:"😠",label:"Angry"}],oyt=()=>{const{user:e,isBrokerageManager:t,managedBrokerages:n,isAdmin:s}=zr(),{avatarUrl:i}=Ege(e==null?void 0:e.id),{onlineUsers:o}=oOe(),{toast:l}=pa(),a=Wr(),h=P.useRef(null),[p,x]=P.useState("all"),[y,w]=P.useState(""),[j,S]=P.useState(""),[C,A]=P.useState(""),[E,T]=P.useState([]),[O,z]=P.useState([]),[F,q]=P.useState(""),[H,K]=P.useState(!1),[Z,re]=P.useState(null),[ue,he]=P.useState(""),[be,ne]=P.useState(new Set),[ye,ie]=P.useState({}),[fe,de]=P.useState({}),[_e,Ee]=P.useState([]),[ke,pe]=P.useState([]),[ae,ge]=P.useState({open:!1,images:[],index:0});P.useEffect(()=>{if(p.startsWith("group:")){const jt=p.replace("group:","");A(jt),S("")}else p!=="all"?(S(p),A("")):(S(""),A(""))},[p]);const{data:Me=[]}=Jt({queryKey:["community-categories"],queryFn:async()=>{const{data:jt,error:rr}=await ee.from("community_categories").select("*").order("sort_order");if(rr)throw rr;return jt}}),{data:Ue=[]}=Jt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:jt,error:rr}=await ee.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(rr)throw rr;return jt}}),Ie=20,{data:Ke,isLoading:Re,hasNextPage:Ce,fetchNextPage:Je,isFetchingNextPage:Te}=eJe({queryKey:["community-posts",p],initialPageParam:0,queryFn:async({pageParam:jt})=>{var De;const rr=jt*Ie,Ar=rr+Ie;let gn=ee.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(rr,Ar);if(p.startsWith("group:")){const Ge=p.replace("group:","");gn=gn.eq("private_group_id",Ge)}else p==="all"||(gn=gn.eq("category_id",p).is("private_group_id",null));const{data:kn,error:Jr}=await gn;if(Jr)throw Jr;const zn=((kn==null?void 0:kn.length)||0)>Ie,js=(kn||[]).slice(0,Ie);if(js.length===0)return{posts:[],hasMore:!1,nextPage:jt+1};const fr=js.map(Ge=>Ge.id),xs=[...new Set(js.filter(Ge=>Ge.category_id).map(Ge=>Ge.category_id))].filter(Boolean),[bi,mi,La,da,tl]=await Promise.all([xs.length?ee.from("community_categories").select("*").in("id",xs):Promise.resolve({data:[]}),ee.from("community_post_media").select("*").in("post_id",fr).order("sort_order"),ee.from("community_reactions").select("*").in("post_id",fr),ee.from("community_comments").select("*").in("post_id",fr).order("created_at",{ascending:!0}),ee.from("community_post_resources").select("*").in("post_id",fr)]),rl=bi==null?void 0:bi.data,Ws=mi==null?void 0:mi.data,Zi=La==null?void 0:La.data,ks=da==null?void 0:da.data,Ei=tl==null?void 0:tl.data,Ii=(ks||[]).map(Ge=>Ge.id),[Oo,ir]=await Promise.all([Ii.length?ee.from("community_comment_reactions").select("*").in("comment_id",Ii):Promise.resolve({data:[]}),(()=>{const Ge=(Ei||[]).filter(_t=>_t.resource_type==="template").map(_t=>_t.resource_id);return Ge.length===0?Promise.resolve({data:[]}):ee.from("canva_templates").select("id, name, preview_image_url").in("id",Ge)})()]),xo=(Oo==null?void 0:Oo.data)||[],Tc=(ir==null?void 0:ir.data)||[],yo=new Map(Tc.map(Ge=>[Ge.id,{name:Ge.name,preview_image_url:Ge.preview_image_url}])),ss=Array.from(new Set([...js.map(Ge=>Ge.user_id),...(Zi||[]).map(Ge=>Ge.user_id),...(ks||[]).map(Ge=>Ge.user_id),...xo.map(Ge=>Ge.user_id)])),[vo,Bd]=await Promise.all([ss.length?ee.from("profiles").select("id, name").in("id",ss):Promise.resolve({data:[]}),P6e(ss)]),_r=new Map(((De=vo==null?void 0:vo.data)==null?void 0:De.map(Ge=>[Ge.id,Ge.name]))||[]),Vn=new Map((rl||[]).map(Ge=>[Ge.id,Ge])),kt=Ge=>{const _t=new Map,yt=[];return Ge.forEach(At=>{_t.set(At.id,{...At,user_name:_r.get(At.user_id)||"Unknown User",user_avatar:Bd.get(At.user_id),reactions:xo.filter(Bt=>Bt.comment_id===At.id).map(Bt=>({...Bt,user_name:_r.get(Bt.user_id)||"Unknown User",user_avatar:Bd.get(Bt.user_id)})),replies:[]})}),Ge.forEach(At=>{const Bt=_t.get(At.id);if(At.parent_comment_id&&_t.has(At.parent_comment_id)){const Lt=_t.get(At.parent_comment_id);Lt.replies=Lt.replies||[],Lt.replies.push(Bt)}else yt.push(Bt)}),yt};return{posts:js.map(Ge=>{const _t=(Ei||[]).filter(yt=>yt.post_id===Ge.id).map(yt=>{let At="",Bt=null;if(yt.resource_type==="template"){const Lt=yo.get(yt.resource_id);At=(Lt==null?void 0:Lt.name)||"Unknown Template",Bt=(Lt==null?void 0:Lt.preview_image_url)||null}return{id:yt.id,resource_type:yt.resource_type,resource_id:yt.resource_id,resource_name:At,resource_preview_url:Bt}});return{...Ge,user_name:_r.get(Ge.user_id)||"Unknown User",user_avatar:Bd.get(Ge.user_id),category:Ge.category_id?Vn.get(Ge.category_id):null,media:(Ws||[]).filter(yt=>yt.post_id===Ge.id),reactions:((Zi||[]).filter(yt=>yt.post_id===Ge.id)||[]).map(yt=>({...yt,user_name:_r.get(yt.user_id)||"Unknown User",user_avatar:Bd.get(yt.user_id)})),comments:kt((ks||[]).filter(yt=>yt.post_id===Ge.id)),resources:_t}}),hasMore:zn,nextPage:jt+1}},getNextPageParam:jt=>jt.hasMore?jt.nextPage:void 0}),Ye=P.useMemo(()=>(Ke==null?void 0:Ke.pages.flatMap(jt=>jt.posts))??[],[Ke]),xe=cr({mutationFn:async()=>{K(!0);const{data:jt,error:rr}=await ee.from("community_posts").insert({user_id:e.id,category_id:C?null:j||null,private_group_id:C||null,content:y,link_url:F||null}).select().single();if(rr)throw rr;for(let gn=0;gn0){const gn=_e.filter(kn=>kn!==e.id).map(kn=>({post_id:jt.id,mentioned_user_id:kn,mentioned_by_user_id:e.id}));gn.length>0&&await ee.from("community_post_mentions").insert(gn)}const Ar=ayt(y);if(Ar.length>0){const gn=Ar.map(kn=>({post_id:jt.id,resource_type:"template",resource_id:kn}));await ee.from("community_post_resources").insert(gn)}return jt},onSuccess:async jt=>{var rr;a.invalidateQueries({queryKey:["community-posts"]}),w(""),Ee([]),pe([]),S(""),A(""),T([]),z([]),q(""),l({title:"Post created!"});try{const Ar=((rr=e==null?void 0:e.user_metadata)==null?void 0:rr.name)||"Someone",gn=y.length>50?y.substring(0,50)+"...":y;await ee.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Ar}: ${gn}`,url:"/community"}})}catch(Ar){console.error("Failed to send push notification:",Ar)}},onError:jt=>{l({title:"Error creating post",description:jt.message,variant:"destructive"})},onSettled:()=>K(!1)}),mt=cr({mutationFn:async({postId:jt,content:rr})=>{const{error:Ar}=await ee.from("community_posts").update({content:rr}).eq("id",jt);if(Ar)throw Ar},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),re(null),he(""),l({title:"Post updated!"})}}),et=cr({mutationFn:async jt=>{const{error:rr}=await ee.from("community_posts").delete().eq("id",jt);if(rr)throw rr},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),nt=cr({mutationFn:async({postId:jt,isPinned:rr})=>{const{error:Ar}=await ee.from("community_posts").update({is_pinned:!rr,pinned_at:rr?null:new Date().toISOString(),pinned_by:rr?null:e==null?void 0:e.id}).eq("id",jt);if(Ar)throw Ar},onSuccess:(jt,{isPinned:rr})=>{a.invalidateQueries({queryKey:["community-posts"]}),l({title:rr?"Post unpinned":"Post pinned to top"})}}),Ae=cr({mutationFn:async({postId:jt,reactionType:rr})=>{var gn;const Ar=(gn=Ye.find(kn=>kn.id===jt))==null?void 0:gn.reactions.find(kn=>kn.user_id===(e==null?void 0:e.id));Ar?Ar.reaction_type===rr?await ee.from("community_reactions").delete().eq("id",Ar.id):await ee.from("community_reactions").update({reaction_type:rr}).eq("id",Ar.id):await ee.from("community_reactions").insert({post_id:jt,user_id:e.id,reaction_type:rr})},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),pt=cr({mutationFn:async({postId:jt,content:rr})=>{const{data:Ar,error:gn}=await ee.from("community_comments").insert({post_id:jt,user_id:e.id,content:rr}).select("id").single();if(gn)throw gn;const kn=fe[jt]||[];if(kn.length>0&&Ar){const Jr=kn.filter(zn=>zn!==e.id).map(zn=>({comment_id:Ar.id,mentioned_user_id:zn,mentioned_by_user_id:e.id}));Jr.length>0&&await ee.from("community_comment_mentions").insert(Jr)}},onSuccess:(jt,{postId:rr})=>{a.invalidateQueries({queryKey:["community-posts"]}),ie(Ar=>({...Ar,[rr]:""})),de(Ar=>({...Ar,[rr]:[]}))}});cr({mutationFn:async jt=>{const{error:rr}=await ee.from("community_comments").delete().eq("id",jt);if(rr)throw rr},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})});const Be=jt=>{const rr=Array.from(jt.target.files||[]);if(rr.length+E.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}T(Ar=>[...Ar,...rr]),rr.forEach(Ar=>{const gn=new FileReader;gn.onloadend=()=>{z(kn=>[...kn,gn.result])},gn.readAsDataURL(Ar)})},Qe=jt=>{T(rr=>rr.filter((Ar,gn)=>gn!==jt)),z(rr=>rr.filter((Ar,gn)=>gn!==jt))},tt=jt=>jt.split(" ").map(rr=>rr[0]).join("").toUpperCase().slice(0,2),ht=jt=>{const rr={};return jt.forEach(Ar=>{rr[Ar.reaction_type]=(rr[Ar.reaction_type]||0)+1}),rr},wt=jt=>{var rr;return(rr=jt.find(Ar=>Ar.user_id===(e==null?void 0:e.id)))==null?void 0:rr.reaction_type},Ct=jt=>jt.reduce((rr,Ar)=>rr+1+(Ar.replies?Ct(Ar.replies):0),0),It=jt=>{if(s)return!0;if(!t||!jt.private_group_id)return!1;const rr=Ue.find(Ar=>Ar.id===jt.private_group_id);return rr!=null&&rr.brokerage_id?n.some(Ar=>Ar.id===rr.brokerage_id):!1};return r.jsx(Or,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(qxt,{categories:Me,privateGroups:Ue,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsxs("div",{className:"flex-1 min-w-0 max-w-2xl mx-auto lg:mx-0 space-y-6",children:[r.jsxs("div",{className:"px-1",children:[r.jsx("h1",{className:"text-4xl lg:text-5xl font-bold text-foreground",children:"Community"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Connect and share with fellow agents"})]}),r.jsx(Vxt,{categories:Me,privateGroups:Ue,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:i||void 0}),r.jsx(di,{children:e!=null&&e.email?tt(e.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(kte,{placeholder:s?"What's on your mind? Use @ to mention someone, # to link a template":"What's on your mind? Use @ to mention someone",value:y,onChange:w,onMentionsChange:Ee,onTemplatesChange:pe,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),O.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:O.map((jt,rr)=>{var Ar;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Ar=E[rr])!=null&&Ar.type.startsWith("video/")?r.jsx("video",{src:jt,className:"w-full h-full object-cover"}):r.jsx("img",{src:jt,alt:"",className:"w-full h-full object-cover"}),r.jsx(J,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Qe(rr),children:r.jsx(Ts,{className:"h-3 w-3"})})]},rr)})}),F&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ct,{value:F,onChange:jt=>q(jt.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>q(""),children:r.jsx(Ts,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[r.jsx("input",{type:"file",ref:h,onChange:Be,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>{var jt;return(jt=h.current)==null?void 0:jt.click()},children:[r.jsx(Zo,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>{var jt;return(jt=h.current)==null?void 0:jt.click()},children:[r.jsx(Fi,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>q("https://"),children:[r.jsx(So,{className:"h-4 w-4 mr-1"}),"Link"]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[Ue.length>0?r.jsxs(bn,{value:C||j||"none",onValueChange:jt=>{jt==="none"?(S(""),A("")):jt.startsWith("group:")?(A(jt.replace("group:","")),S("")):(S(jt),A(""))},children:[r.jsx(vn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(wn,{placeholder:"Select..."})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"No category"}),Me.map(jt=>r.jsxs(Kt,{value:jt.id,children:[jt.icon," ",jt.name]},jt.id)),Ue.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground border-t mt-1 pt-1",children:"🔒 Private Groups"}),Ue.map(jt=>r.jsxs(Kt,{value:`group:${jt.id}`,children:[jt.icon||"🔒"," ",jt.name]},jt.id))]})]})]}):r.jsxs(bn,{value:j,onValueChange:S,children:[r.jsx(vn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(wn,{placeholder:"Category"})}),r.jsx(_n,{children:Me.map(jt=>r.jsxs(Kt,{value:jt.id,children:[jt.icon," ",jt.name]},jt.id))})]}),r.jsxs(J,{size:"sm",onClick:()=>xe.mutate(),disabled:!y.trim()||H,children:[r.jsx(Lo,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Re?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((jt,rr)=>r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Pr,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Pr,{className:"h-4 w-32"}),r.jsx(Pr,{className:"h-4 w-full"}),r.jsx(Pr,{className:"h-4 w-3/4"})]})]})})},rr))}):Ye.length===0?r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Zl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No posts yet"}),r.jsx("p",{className:"text-muted-foreground",children:"Be the first to start a conversation!"})]})}):r.jsxs("div",{className:"space-y-4",children:[Ye.map(jt=>{var rr,Ar,gn,kn;return r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex gap-3 min-w-0",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:jt.user_avatar||void 0}),r.jsx(di,{children:tt(jt.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:jt.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:tu(new Date(jt.created_at),{addSuffix:!0})}),jt.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:[jt.category.icon," ",jt.category.name]})]})]})]})]}),(jt.user_id===(e==null?void 0:e.id)||It(jt))&&r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(og,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",children:[It(jt)&&jt.private_group_id&&r.jsx(po,{onClick:()=>nt.mutate({postId:jt.id,isPinned:jt.is_pinned}),children:jt.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(BT,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(x1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),jt.user_id===(e==null?void 0:e.id)&&r.jsxs(po,{onClick:()=>{re(jt),he(jt.content)},children:[r.jsx(ha,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(po,{className:"text-destructive",onClick:()=>et.mutate(jt.id),children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),jt.user_id!==(e==null?void 0:e.id)?"Remove (Moderate)":"Delete"]})]})]})]}),jt.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(x1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(Fxe,{content:jt.content})}),jt.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${jt.media.length===1?"grid-cols-1":jt.media.length===2?"grid-cols-2":jt.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:jt.media.slice(0,4).map((Jr,zn)=>{const js=zn===3&&jt.media.length>4,fr=jt.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${jt.media.length===1?"max-h-[500px]":jt.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>ge({open:!0,images:jt.media.map(xs=>({url:xs.media_url,type:xs.media_type==="video"?"video":"image"})),index:zn}),children:[Jr.media_type==="video"?r.jsx("video",{src:Jr.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:Jr.media_url,alt:"",className:"w-full h-full object-cover transition-transform group-hover:scale-105"}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-white",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})})})}),js&&r.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:r.jsxs("span",{className:"text-white text-2xl font-bold",children:["+",fr]})})]},Jr.id)})}),jt.link_url&&r.jsxs("a",{href:jt.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[jt.link_image&&r.jsx("div",{className:"aspect-video bg-muted",children:r.jsx("img",{src:jt.link_image,alt:jt.link_title||"Link preview",className:"w-full h-full object-cover",onError:Jr=>{Jr.currentTarget.style.display="none"}})}),r.jsx("div",{className:"p-3",children:jt.link_title?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:jt.link_title}),jt.link_description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:jt.link_description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(jt.link_url).hostname})]}):r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(So,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:jt.link_url})]})})]}),jt.reactions.length>0&&r.jsx(mRe,{reactions:jt.reactions,children:r.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[r.jsx("div",{className:"flex -space-x-1",children:Object.entries(ht(jt.reactions)).slice(0,3).map(([Jr])=>{var zn;return r.jsx("span",{className:"text-base",children:(zn=jL.find(js=>js.type===Jr))==null?void 0:zn.emoji},Jr)})}),r.jsx("span",{children:jt.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(_h,{children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"ghost",size:"sm",className:"flex-1",children:[wt(jt.reactions)?r.jsx("span",{className:"mr-1",children:(rr=jL.find(Jr=>Jr.type===wt(jt.reactions)))==null?void 0:rr.emoji}):r.jsx(Od,{className:"h-4 w-4 mr-1"}),wt(jt.reactions)?(Ar=jL.find(Jr=>Jr.type===wt(jt.reactions)))==null?void 0:Ar.label:"Like"]})}),r.jsx(Ou,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:jL.map(Jr=>r.jsx("button",{onClick:()=>Ae.mutate({postId:jt.id,reactionType:Jr.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:Jr.label,children:Jr.emoji},Jr.type))})})]}),r.jsxs(J,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ne(Jr=>{const zn=new Set(Jr);return zn.has(jt.id)?zn.delete(jt.id):zn.add(jt.id),zn}),children:[r.jsx(Zl,{className:"h-4 w-4 mr-1"}),(()=>{const Jr=Ct(jt.comments);return Jr>0?`Comment (${Jr})`:"Comment"})()]})]}),be.has(jt.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[jt.comments.map(Jr=>r.jsx(gRe,{comment:Jr,postId:jt.id,currentUserId:e==null?void 0:e.id,currentUserAvatar:i,currentUserEmail:e==null?void 0:e.email,canModerate:It(jt)},Jr.id)),e&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Wa,{src:i||void 0}),r.jsx(di,{className:"text-xs",children:tt(((gn=e.email)==null?void 0:gn.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(kte,{placeholder:"Write a comment... (use @ to mention)",value:ye[jt.id]||"",onChange:Jr=>ie(zn=>({...zn,[jt.id]:Jr})),onMentionsChange:Jr=>de(zn=>({...zn,[jt.id]:Jr})),mentionFormat:"plain",onKeyDown:Jr=>{var zn;Jr.defaultPrevented||Jr.key==="Enter"&&!Jr.shiftKey&&((zn=ye[jt.id])!=null&&zn.trim())&&(Jr.preventDefault(),pt.mutate({postId:jt.id,content:ye[jt.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{var Jr;(Jr=ye[jt.id])!=null&&Jr.trim()&&pt.mutate({postId:jt.id,content:ye[jt.id]})},disabled:!((kn=ye[jt.id])!=null&&kn.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(Lo,{className:"h-4 w-4"})})]})]})]})]})},jt.id)}),Ce&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(J,{variant:"outline",onClick:()=>Je(),disabled:Te,children:Te?"Loading…":"Load more posts"})})]}),r.jsx(Br,{open:!!Z,onOpenChange:()=>re(null),children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Edit Post"})}),r.jsx(ms,{value:ue,onChange:jt=>he(jt.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>re(null),children:"Cancel"}),r.jsx(J,{onClick:()=>{Z&&mt.mutate({postId:Z.id,content:ue})},disabled:!ue.trim(),children:"Save Changes"})]})]})}),r.jsx(syt,{images:ae.images,initialIndex:ae.index,open:ae.open,onOpenChange:jt=>ge(rr=>({...rr,open:jt}))})]})]})})},a4={open:{label:"Open",icon:Ki,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Zl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:qa,color:"bg-green-500"},closed:{label:"Closed",icon:zc,color:"bg-muted-foreground"}},Eke={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function lyt(){const{user:e}=zr(),t=Wr(),[n,s]=P.useState(null),[i,o]=P.useState(""),{data:l=[],isLoading:a}=Jt({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:w}=await ee.from("support_tickets").select("*").eq("user_id",e==null?void 0:e.id).order("created_at",{ascending:!1});if(w)throw w;return y},enabled:!!e}),{data:h=[]}=Jt({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:y,error:w}=await ee.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(w)throw w;return y},enabled:!!n}),p=cr({mutationFn:async y=>{if(!n||!e)throw new Error("Missing data");const{error:w}=await ee.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:y,is_admin_reply:!1});if(w)throw w},onSuccess:()=>{t.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),x=()=>{i.trim()&&p.mutate(i)};if(n){const y=a4[n.status].icon;return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ft,{variant:"secondary",children:Eke[n.category]}),r.jsxs(Ft,{className:a4[n.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),a4[n.status].label]})]})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(En,{children:["Created on ",fn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Xe,{children:[r.jsx(Jo,{className:"h-[300px] pr-4",children:h.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:h.map(w=>{var j;return r.jsxs("div",{className:`p-4 rounded-lg ${w.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:w.is_admin_reply?"Support Team":((j=w.profiles)==null?void 0:j.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:fn(new Date(w.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:w.content})]},w.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ms,{placeholder:"Type your reply...",value:i,onChange:w=>o(w.target.value),className:"min-h-[80px]"}),r.jsx(J,{onClick:x,disabled:!i.trim()||p.isPending,className:"self-end",children:r.jsx(Lo,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(We,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(Xe,{className:"p-6 sm:p-8",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-6",children:[r.jsx("div",{className:"p-4 bg-primary/20 rounded-full",children:r.jsx(Nx,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Need Help?"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Submit a support ticket and our team will get back to you as soon as possible."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsx(yhe,{trigger:r.jsxs(J,{size:"lg",className:"gap-2",children:[r.jsx(jn,{className:"h-5 w-5"}),"Submit a Ticket"]})}),r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted rounded-lg",children:[r.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Or text us: ",r.jsx("span",{className:"font-semibold text-foreground",children:"1-866-527-8668"})]})]})]})]})]})})}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Your Tickets"}),r.jsx(yhe,{trigger:r.jsxs(J,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"New Ticket"]})})]}),a?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):l.length===0?r.jsx(We,{className:"border-dashed",children:r.jsxs(Xe,{className:"text-center py-12",children:[r.jsx(Zl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets yet"}),r.jsx("p",{className:"text-muted-foreground",children:"You haven't submitted any support tickets. Use the button above to get started!"})]})}):r.jsx("div",{className:"space-y-3",children:l.map(y=>{const w=a4[y.status].icon;return r.jsx(We,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(y),children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:y.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ft,{variant:"outline",className:"text-xs",children:Eke[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:fn(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Ft,{className:a4[y.status].color,children:[r.jsx(w,{className:"h-3 w-3 mr-1"}),a4[y.status].label]})]})})},y.id)})})]})})}function cyt({open:e,onOpenChange:t}){return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Ys,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Schedule Agent Onboarding"}),r.jsx(es,{children:"Book a one-on-one onboarding session with LevelUp"})]})]})}),e&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/new-agent-onboarding",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Agent Onboarding"})]})})}function dyt({open:e,onOpenChange:t}){const{brokerageId:n}=zr(),[s,i]=P.useState(""),[o,l]=P.useState([]),[a,h]=P.useState(!1),{data:p,isLoading:x}=Jt({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:C,error:A}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(A)throw A;return C},enabled:e&&!!n}),y=p==null?void 0:p.filter(C=>C.name.toLowerCase().includes(s.toLowerCase())||C.email.toLowerCase().includes(s.toLowerCase())),w=C=>{l(A=>A.includes(C)?A.filter(E=>E!==C):[...A,C])},j=async()=>{if(o.length===0){ze.error("Please select at least one agent");return}h(!0);try{const{data:C,error:A}=await ee.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(A)throw A;ze.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),t(!1)}catch(C){console.error("Error sending onboarding link:",C),ze.error(C.message||"Failed to send onboarding link")}finally{h(!1)}},S=C=>{C||(l([]),i("")),t(C)};return r.jsx(Br,{open:e,onOpenChange:S,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Lo,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Send Onboarding Link"}),r.jsx(es,{children:"Select agents to receive the onboarding booking link"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search agents...",value:s,onChange:C=>i(C.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(y==null?void 0:y.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Kn,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:r.jsx("div",{className:"p-2 space-y-1",children:y==null?void 0:y.map(C=>r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>w(C.id),children:[r.jsx(cc,{checked:o.includes(C.id),onCheckedChange:()=>w(C.id)}),r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"text-xs",children:C.name.split(" ").map(A=>A[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:C.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C.email})]})]},C.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),r.jsx(J,{onClick:j,disabled:o.length===0||a,children:a?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function uyt(){const[e,t]=P.useState(!1),[n,s]=P.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(We,{className:"mb-8",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Kn,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{children:"Agent Onboarding"}),r.jsx(En,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(J,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(J,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(Lo,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(cyt,{open:e,onOpenChange:t}),r.jsx(dyt,{open:n,onOpenChange:s})]})}function hyt({open:e,onOpenChange:t}){return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(_g,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Schedule Launch Meeting"}),r.jsx(es,{children:"Book a private LevelUp information session for your brokerage"})]})]})}),e&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/levelup-launch-call",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Launch Meeting"})]})})}function fyt(){const[e,t]=P.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(We,{className:"mb-8",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(_g,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{children:"Launch or ReLaunch Meeting"}),r.jsx(En,{children:"Schedule a private LevelUp information session for your brokerage. Have one of our staff host a meeting to help your team get the most out of all our trainings, tools, and resources."})]})]})}),r.jsx(Xe,{children:r.jsxs(J,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(_g,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(hyt,{open:e,onOpenChange:t})]})}function pyt(){const e=ns(),[t,n]=P.useState(""),[s,i]=P.useState(null),{data:o,isLoading:l}=Jt({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:C,error:A}=await ee.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(A)throw A;return C}}),{data:a}=Jt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:C,error:A}=await ee.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(A)throw A;return C}}),{data:h}=Jt({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:C,error:A}=await ee.from("brokerage_resource_pdfs").select("resource_id");if(A)throw A;return C}}),{data:p}=Jt({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:C,error:A}=await ee.from("brokerage_resource_videos").select("resource_id");if(A)throw A;return C}}),{data:x}=Jt({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:C,error:A}=await ee.from("brokerage_resource_links").select("resource_id");if(A)throw A;return C}}),y=o==null?void 0:o.filter(C=>{var T;const A=C.title.toLowerCase().includes(t.toLowerCase())||((T=C.description)==null?void 0:T.toLowerCase().includes(t.toLowerCase())),E=!s||C.category_id===s;return A&&E}),w=a==null?void 0:a.filter(C=>o==null?void 0:o.some(A=>A.category_id===C.id)),j=C=>{const A=(h==null?void 0:h.filter(O=>O.resource_id===C).length)||0,E=(p==null?void 0:p.filter(O=>O.resource_id===C).length)||0,T=(x==null?void 0:x.filter(O=>O.resource_id===C).length)||0;return{pdfCount:A,videoCount:E,linkCount:T}},S=C=>{e(`/brokerage-resources/${C}`)};return r.jsx(Or,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(uyt,{}),r.jsx(fyt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search resources...",value:t,onChange:C=>n(C.target.value),className:"pl-10"})]}),w&&w.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Ft,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>i(null),children:"All"}),w.map(C=>r.jsx(Ft,{variant:s===C.id?"default":"outline",className:"cursor-pointer",onClick:()=>i(C.id),children:C.name},C.id))]}),!l&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(y==null?void 0:y.length)||0," resource",(y==null?void 0:y.length)!==1?"s":""," available"]}),l?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((C,A)=>r.jsxs(We,{children:[r.jsx(Pr,{className:"h-40 w-full"}),r.jsx(Wt,{children:r.jsx(Pr,{className:"h-5 w-3/4"})}),r.jsxs(Xe,{children:[r.jsx(Pr,{className:"h-4 w-full mb-2"}),r.jsx(Pr,{className:"h-4 w-2/3"})]})]},A))}):(y==null?void 0:y.length)===0?r.jsxs(We,{className:"p-12 text-center",children:[r.jsx(gh,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resources found"}),r.jsx("p",{className:"text-muted-foreground",children:t||s?"Try adjusting your filters":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:y==null?void 0:y.map(C=>{const{pdfCount:A,videoCount:E,linkCount:T}=j(C.id),O=a==null?void 0:a.find(z=>z.id===C.category_id);return r.jsxs(We,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>S(C.id),children:[C.preview_image_url?r.jsx("img",{src:C.preview_image_url,alt:C.title,className:"w-full h-40 object-cover"}):r.jsx("div",{className:"w-full h-40 bg-muted flex items-center justify-center",children:r.jsx(gh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Xt,{className:"text-lg line-clamp-1",children:C.title}),O&&r.jsx(Ft,{variant:"secondary",className:"shrink-0 text-xs",children:O.name})]})}),r.jsxs(Xe,{children:[C.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:C.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[A>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4"}),A]}),E>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fi,{className:"h-4 w-4"}),E]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(So,{className:"h-4 w-4"}),T]})]})]})]},C.id)})})]})})}const myt=()=>{const{resourceId:e}=Wc(),{data:t,isLoading:n}=Jt({queryKey:["brokerage-resource-detail",e],queryFn:async()=>{const{data:i,error:o}=await ee.from("brokerage_resources").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;const{data:l}=await ee.from("brokerage_resource_pdfs").select("*").eq("resource_id",e).order("sort_order"),{data:a}=await ee.from("brokerage_resource_videos").select("*").eq("resource_id",e).order("sort_order"),{data:h}=await ee.from("brokerage_resource_links").select("*").eq("resource_id",e).order("sort_order");return{...i,pdfs:l||[],videos:a||[],links:h||[]}},enabled:!!e}),s=i=>i?i<1024?i+" B":i<1024*1024?(i/1024).toFixed(1)+" KB":(i/(1024*1024)).toFixed(1)+" MB":"";return n?r.jsx(Or,{title:"Brokerage Resources",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):t?r.jsx(Or,{title:t.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/brokerage-resources",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Resources"]})}),t.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:t.preview_image_url,alt:t.title,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:t.title}),t.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:t.description}})]}),t.videos&&t.videos.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fi,{className:"h-4 w-4"}),"Videos (",t.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:t.videos.map(i=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:i.title}),r.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:i.video_url,className:"absolute top-0 left-0 w-full h-full rounded-lg border",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})]},i.id))})]})}),t.pdfs&&t.pdfs.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Documents (",t.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.pdfs.map(i=>r.jsxs("a",{href:i.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Ai,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:i.name}),i.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:s(i.file_size)})]})]}),r.jsx(Xa,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})}),t.links&&t.links.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Canva Templates (",t.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.links.map(i=>r.jsxs("a",{href:i.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Ls,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:i.title})]}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})})]})}):r.jsx(Or,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(gh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource may have been removed or is not available."}),r.jsx(J,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function gyt(){const{onlineUsers:e,totalOnline:t}=oOe();return r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(Kn,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Ft,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Pu,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),t," online"]})]})}),r.jsx(Xe,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No other users online right now"}):r.jsx(Jo,{className:"h-[300px] pr-4",children:r.jsx("div",{className:"space-y-3",children:e.map(n=>{var s;return r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(ci,{className:"h-9 w-9",children:[r.jsx(Wa,{src:n.avatarUrl,alt:n.name}),r.jsx(di,{className:"text-xs",children:(s=n.name)==null?void 0:s.split(" ").map(i=>i[0]).join("").slice(0,2).toUpperCase()})]}),r.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-green-500 ring-2 ring-background"})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:n.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Online ",tu(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const Ike={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:Kn,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:YT,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:hm,path:"/admin/subscriptions",color:"bg-gradient-to-br from-green-500/20 to-green-500/10 text-green-600"},{title:"Subscription Discounts",description:"Create and manage coupon codes",icon:Hx,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:dc,path:"/admin/referrals",color:"bg-teal-500/10 text-teal-600"}]},content:{label:"Content",sections:[{title:"Manage Templates",description:"Upload and organize Canva templates",icon:Ld,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:h1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:Gx,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Ss,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Ss,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:Vx,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:um,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:gh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:gh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:sS,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:Oh,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:Zs,path:"/admin/email-templates",color:"bg-sky-500/10 text-sky-600"},{title:"The LevelUp Brief",description:"Create popup briefs with videos, links, and polls",icon:mm,path:"/admin/levelup-brief",color:"bg-gradient-to-br from-primary/20 to-primary/10 text-primary"},{title:"Onboarding Checklist",description:"Manage getting started tasks for new users",icon:TT,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:wg,path:"/admin/marketplace",color:"bg-gradient-to-br from-orange-500/20 to-amber-500/10 text-orange-600"},{title:"Reward Store",description:"Manage reward items agents can redeem with points",icon:Va,path:"/admin/reward-store",color:"bg-purple-500/10 text-purple-600"},{title:"Agent Points",description:"View agent points, leaderboard, and award bonus points",icon:Ha,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Facebook & Instagram for social posting",icon:Yh,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Agent Cards",description:"Manage digital business cards for agents",icon:Kn,path:"/admin/agent-cards",color:"bg-gradient-to-br from-violet-500/20 to-purple-500/10 text-violet-600"},{title:"Notification Settings",description:"Test and manage push notifications",icon:mm,path:"/admin/notification-settings",color:"bg-rose-500/10 text-rose-600"}]},community:{label:"Community & Support",sections:[{title:"Community Management",description:"Manage categories and private groups",icon:Po,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:aS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:p1,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:vs,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:Zs,path:"/admin/weekly-digest",color:"bg-indigo-500/10 text-indigo-600"}]},insights:{label:"Insights",sections:[{title:"Analytics",description:"View activity logs and platform statistics",icon:ac,path:"/admin/analytics",color:"bg-emerald-500/10 text-emerald-600"}]},"agent-os":{label:"Agent OS",sections:[{title:"Agent OS Control Center",description:"Manage InnerCircle feature: relationship types, action types, scripts, plans & feature flags",icon:oa,path:"/admin/agent-os",color:"bg-gradient-to-br from-rose-500/20 to-pink-500/10 text-rose-600"},{title:"Listing Exchange",description:"Approve, feature, and moderate community listings",icon:fi,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function xyt(){const e=ns();return r.jsx(Or,{title:"Admin Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Admin Dashboard"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage all aspects of your platform"})]}),r.jsx("div",{className:"w-full lg:w-80",children:r.jsx(gyt,{})})]}),r.jsxs(ba,{defaultValue:"users",className:"w-full",children:[r.jsx(fa,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(Ike).map(([t,n])=>r.jsx(ln,{value:t,className:"data-[state=active]:bg-background",children:n.label},t))}),Object.entries(Ike).map(([t,n])=>r.jsx(An,{value:t,className:"mt-6",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.sections.map(s=>r.jsxs(We,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>e(s.path),children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(s.icon,{className:"h-5 w-5"})}),r.jsx(Xt,{className:"text-base",children:s.title})]}),r.jsx(Xe,{className:"pt-0",children:r.jsx(En,{className:"text-sm",children:s.description})})]},s.path))})},t))]})]})})}const qs=P.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:$t("w-full caption-bottom text-sm",e),...t})}));qs.displayName="Table";const Vs=P.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:$t("[&_tr]:border-b",e),...t}));Vs.displayName="TableHeader";const Hs=P.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:$t("[&_tr:last-child]:border-0",e),...t}));Hs.displayName="TableBody";const yyt=P.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:$t("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));yyt.displayName="TableFooter";const Ir=P.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:$t("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Ir.displayName="TableRow";const Et=P.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:$t("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Et.displayName="TableHead";const vt=P.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:$t("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));vt.displayName="TableCell";const vyt=P.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:$t("mt-4 text-sm text-muted-foreground",e),...t}));vyt.displayName="TableCaption";const _yt=()=>{const{isAdmin:e}=zr(),t=ns(),[n,s]=P.useState([]),[i,o]=P.useState(!0),[l,a]=P.useState(!1),[h,p]=P.useState(null);P.useEffect(()=>{if(!e){t("/dashboard");return}x()},[e]);const x=async()=>{try{const{data:C,error:A}=await ee.from("app_tiles").select("*").order("name");if(A)throw A;s(C||[])}catch(C){console.error("Error loading apps:",C),ze.error("Failed to load apps")}finally{o(!1)}},y=async C=>{C.preventDefault();const A=new FormData(C.currentTarget),E={name:A.get("name"),description:A.get("description"),icon:A.get("icon"),app_id:A.get("app_id"),target_url:A.get("target_url"),required_tags:A.get("required_tags").split(",").map(T=>T.trim()).filter(Boolean)};try{if(h){const{error:T}=await ee.from("app_tiles").update(E).eq("id",h.id);if(T)throw T;ze.success("App updated successfully")}else{const{error:T}=await ee.from("app_tiles").insert([E]);if(T)throw T;ze.success("App created successfully")}a(!1),p(null),x()}catch(T){console.error("Error saving app:",T),ze.error("Failed to save app")}},w=async C=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:A}=await ee.from("app_tiles").delete().eq("id",C);if(A)throw A;ze.success("App deleted successfully"),x()}catch(A){console.error("Error deleting app:",A),ze.error("Failed to delete app")}},j=C=>{p(C),a(!0)},S=()=>{p(null),a(!0)};return i?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}):r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>t("/dashboard"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back"]}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Manage Apps"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Create and configure application tiles"})]})]}),r.jsxs(Br,{open:l,onOpenChange:a,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{onClick:S,children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:h?"Edit App":"Create New App"}),r.jsx(es,{children:"Configure the application tile settings"})]}),r.jsxs("form",{onSubmit:y,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"App Name"}),r.jsx(ct,{id:"name",name:"name",defaultValue:h==null?void 0:h.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"app_id",children:"App ID"}),r.jsx(ct,{id:"app_id",name:"app_id",defaultValue:h==null?void 0:h.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",name:"description",defaultValue:h==null?void 0:h.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(ct,{id:"icon",name:"icon",defaultValue:h==null?void 0:h.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"target_url",children:"Target URL"}),r.jsx(ct,{id:"target_url",name:"target_url",type:"url",defaultValue:h==null?void 0:h.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(ct,{id:"required_tags",name:"required_tags",defaultValue:h==null?void 0:h.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(J,{type:"submit",children:h?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Application Tiles"}),r.jsx(En,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(Xe,{children:n.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsxs(J,{onClick:S,children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Icon"}),r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"App ID"}),r.jsx(Et,{children:"Target URL"}),r.jsx(Et,{children:"Tags"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:n.map(C=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"text-2xl",children:C.icon}),r.jsx(vt,{className:"font-medium",children:C.name}),r.jsx(vt,{className:"font-mono text-sm",children:C.app_id}),r.jsx(vt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:C.target_url}),r.jsx(vt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:C.required_tags.map(A=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:A},A))})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>j(C),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>w(C.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},C.id))})]})})]})})]})};function $u({title:e,description:t,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(co,{to:"/admin",children:r.jsxs(J,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Admin Dashboard"]})}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:e}),t&&r.jsx("p",{className:"text-muted-foreground",children:t})]}),n]})]})}const Pke=({expiresAt:e,className:t})=>{const n=new Date().getTime(),s=new Date(e).getTime(),i=Math.ceil((s-n)/(1e3*60*60*24));return i<=0?r.jsxs(Ft,{variant:"destructive",className:$t("gap-1",t),children:[r.jsx(zh,{className:"h-3 w-3"}),"Trial Expired"]}):i<=1?r.jsxs(Ft,{variant:"destructive",className:$t("gap-1",t),children:[r.jsx(Ki,{className:"h-3 w-3"}),"Trial: <1 day left"]}):i<=3?r.jsxs(Ft,{className:$t("gap-1 bg-amber-500 hover:bg-amber-600",t),children:[r.jsx(Ki,{className:"h-3 w-3"}),"Trial: ",i," days left"]}):r.jsxs(Ft,{variant:"secondary",className:$t("gap-1",t),children:[r.jsx(Ki,{className:"h-3 w-3"}),"Trial: ",i," days left"]})},xRe=({open:e,onOpenChange:t,brokerages:n,fixedBrokerageId:s,onSuccess:i})=>{const{toast:o}=pa(),l=P.useRef(null),[a,h]=P.useState([]),[p,x]=P.useState(""),[y,w]=P.useState(!1),[j,S]=P.useState("upload"),[C,A]=P.useState(null),E=()=>{h([]),x(""),S("upload"),A(null),l.current&&(l.current.value="")},T=()=>{E(),t(!1)},O=K=>{const Z=K.split(` `).map(ne=>ne.trim()).filter(ne=>ne);if(Z.length===0)return[];const re=Z[0].toLowerCase(),he=re.includes("first")||re.includes("last")||re.includes("email")||re.includes("name")||re.includes("phone")||re.includes("sms")||re.includes("consent")?Z.slice(1):Z,be=[];for(const ne of he){const ie=(ne.includes(" ")?ne.split(" "):ne.split(",")).map(fe=>fe.trim().replace(/^["']|["']$/g,""));if(ie.length>=2){let fe="",de="",_e="",Ee="",ke;if(ie.length===2){const ge=ie[0].split(" ");fe=ge[0]||"",de=ge.slice(1).join(" ")||"",_e=ie[1]}else if(ie.length===3)fe=ie[0],de=ie[1],_e=ie[2];else if(ie.length===4)fe=ie[0],de=ie[1],_e=ie[2],Ee=ie[3];else if(ie.length>=5){fe=ie[0],de=ie[1],_e=ie[2],Ee=ie[3];const ge=ie[4].toLowerCase();ke=ge==="true"||ge==="yes"||ge==="1"||ge==="y"}const ae=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_e);be.push({firstName:fe.trim(),lastName:de.trim(),email:_e.trim().toLowerCase(),phone:Ee.trim()||void 0,smsConsent:ke,isValid:ae&&fe.trim().length>0,error:ae?fe.trim()?void 0:"Missing name":"Invalid email"})}}return be},z=K=>{var ue;const Z=(ue=K.target.files)==null?void 0:ue[0];if(!Z)return;const re=new FileReader;re.onload=he=>{var ye;const be=(ye=he.target)==null?void 0:ye.result,ne=O(be);if(ne.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}h(ne),S("preview")},re.readAsText(Z)},F=async()=>{const K=a.filter(re=>re.isValid);if(K.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const Z=s||p||null;w(!0);try{const{data:{session:re}}=await ee.auth.getSession(),ue=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${re==null?void 0:re.access_token}`},body:JSON.stringify({users:K.map(be=>({firstName:be.firstName,lastName:be.lastName,email:be.email,phone:be.phone,smsConsent:be.smsConsent})),brokerageId:Z})}),he=await ue.json();if(!ue.ok)throw new Error(he.error||"Failed to import users");A(he),S("result"),he.created>0&&i(),o({title:"Import Complete",description:`${he.created} user(s) created successfully.${he.failed>0?` ${he.failed} failed.`:""}`})}catch(re){console.error("Import error:",re),o({title:"Import Failed",description:re.message||"Failed to import users",variant:"destructive"})}finally{w(!1)}},q=a.filter(K=>K.isValid).length,H=a.filter(K=>!K.isValid).length;return r.jsx(Br,{open:e,onOpenChange:T,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(u1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(es,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),j==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:z,className:"hidden"}),r.jsx(go,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(J,{onClick:()=>{var K;return(K=l.current)==null?void 0:K.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Expected CSV Format:"}),r.jsxs("code",{className:"text-xs block bg-background p-2 rounded",children:["First Name, Last Name, Email, Phone, SMS Consent",r.jsx("br",{}),"John, Doe, john@example.com, 555-123-4567, yes",r.jsx("br",{}),"Jane, Smith, jane@example.com, 555-987-6543, true"]}),r.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Phone and SMS Consent columns are optional. SMS Consent accepts: yes/no, true/false, 1/0, y/n."})]})]}),j==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[!s&&n&&n.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Assign to Brokerage (optional)"}),r.jsxs(bn,{value:p||"none",onValueChange:K=>x(K==="none"?"":K),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select a brokerage..."})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"No brokerage"}),n.map(K=>r.jsx(Kt,{value:K.id,children:K.name},K.id))]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Za,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[q," valid"]})]}),H>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(El,{className:"h-4 w-4"}),r.jsxs("span",{children:[H," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{className:"bg-muted/30",children:[r.jsx(Et,{children:"First Name"}),r.jsx(Et,{children:"Last Name"}),r.jsx(Et,{children:"Email"}),r.jsx(Et,{children:"Phone"}),r.jsx(Et,{children:"SMS"}),r.jsx(Et,{children:"Status"})]})}),r.jsx(Hs,{children:a.slice(0,100).map((K,Z)=>r.jsxs(Ir,{children:[r.jsx(vt,{children:K.firstName}),r.jsx(vt,{children:K.lastName}),r.jsx(vt,{children:K.email}),r.jsx(vt,{className:"text-muted-foreground",children:K.phone||"-"}),r.jsx(vt,{className:"text-muted-foreground",children:K.smsConsent===!0?"✓":K.smsConsent===!1?"✗":"-"}),r.jsx(vt,{children:K.isValid?r.jsx(Ft,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ft,{variant:"destructive",children:K.error||"Invalid"})})]},Z))})]}),a.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",a.length," users"]})]})]}),j==="result"&&C&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Za,{className:"h-12 w-12 mx-auto text-green-500 mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground mt-2",children:[C.created," agent(s) created and invited"]}),C.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[C.failed," failed to create"]})]}),C.errors.length>0&&r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 max-h-40 overflow-auto",children:[r.jsx("p",{className:"font-medium text-destructive text-sm mb-2",children:"Errors:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[C.errors.slice(0,10).map((K,Z)=>r.jsxs("li",{children:["• ",K]},Z)),C.errors.length>10&&r.jsxs("li",{children:["...and ",C.errors.length-10," more"]})]})]})]}),r.jsxs(ri,{children:[j==="upload"&&r.jsx(J,{variant:"outline",onClick:T,children:"Cancel"}),j==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"outline",onClick:E,children:"Back"}),r.jsx(J,{onClick:F,disabled:y||q===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${q} Agent${q!==1?"s":""}`})]}),j==="result"&&r.jsx(J,{onClick:T,children:"Done"})]})]})})},byt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:vs},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:Ha},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:Nc}];function yRe({open:e,onOpenChange:t,userId:n,userName:s}){const[i,o]=P.useState("custom"),[l,a]=P.useState(""),[h,p]=P.useState(""),x=pnt(),y=j=>{o(j.type),a(j.title),p(j.message)},w=async j=>{if(j.preventDefault(),!l.trim()){$i({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:n,celebration_type:i,title:l.trim(),message:h.trim()||void 0}),$i({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),t(!1),a(""),p(""),o("custom")}catch{$i({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Nc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(es,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(Ve,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:byt.map((j,S)=>r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y(j),className:"text-xs",children:[r.jsx(j.icon,{className:"h-3 w-3 mr-1"}),j.title]},S))})]}),r.jsxs("form",{onSubmit:w,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(bn,{value:i,onValueChange:j=>o(j),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:"h-4 w-4"})," Custom"]})}),r.jsx(Kt,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx(Kt,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx(Kt,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ud,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"title",children:"Title *"}),r.jsx(ct,{id:"title",value:l,onChange:j=>a(j.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"message",children:"Message (optional)"}),r.jsx(ms,{id:"message",value:h,onChange:j=>p(j.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:x.isPending,children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const ice={points_earned:{label:"Points Earned",icon:Ha,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:fi,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:ud,color:"bg-green-500"},custom:{label:"Custom",icon:Ss,color:"bg-purple-500"}};function wyt(){const[e,t]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState("all"),{data:l=[],isLoading:a}=Jt({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:y}=await ee.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(y)throw y;const w=[...new Set([...x.map(C=>C.user_id),...x.map(C=>C.created_by).filter(Boolean)])],{data:j}=await ee.from("profiles").select("id, name, email").in("id",w),S=new Map((j==null?void 0:j.map(C=>[C.id,C]))||[]);return x.map(C=>{var A,E,T;return{...C,user_name:((A=S.get(C.user_id))==null?void 0:A.name)||"Unknown",user_email:((E=S.get(C.user_id))==null?void 0:E.email)||"",creator_name:C.created_by?((T=S.get(C.created_by))==null?void 0:T.name)||"System":"Auto-triggered"}})}}),h=l.filter(x=>{var S,C;const y=((S=x.user_name)==null?void 0:S.toLowerCase().includes(e.toLowerCase()))||((C=x.user_email)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))||x.title.toLowerCase().includes(e.toLowerCase()),w=n==="all"||x.celebration_type===n,j=i==="all"||i==="seen"&&x.seen_at||i==="unseen"&&!x.seen_at;return y&&w&&j}),p={total:l.length,seen:l.filter(x=>x.seen_at).length,unseen:l.filter(x=>!x.seen_at).length,byType:Object.keys(ice).reduce((x,y)=>(x[y]=l.filter(w=>w.celebration_type===y).length,x),{})};return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:p.total})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:p.seen})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:p.unseen})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:p.byType.custom||0})})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Nc,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(En,{children:"View all celebrations awarded to agents"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by agent name, email, or title...",value:e,onChange:x=>t(x.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:n,onValueChange:s,children:[r.jsx(vn,{className:"w-[180px]",children:r.jsx(wn,{placeholder:"Filter by type"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Types"}),Object.entries(ice).map(([x,y])=>r.jsx(Kt,{value:x,children:y.label},x))]})]}),r.jsxs(bn,{value:i,onValueChange:o,children:[r.jsx(vn,{className:"w-[140px]",children:r.jsx(wn,{placeholder:"Status"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Status"}),r.jsx(Kt,{value:"seen",children:"Seen"}),r.jsx(Kt,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Type"}),r.jsx(Et,{children:"Agent"}),r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Points"}),r.jsx(Et,{children:"Created By"}),r.jsx(Et,{children:"Created"}),r.jsx(Et,{children:"Status"})]})}),r.jsx(Hs,{children:h.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):h.map(x=>{const y=ice[x.celebration_type],w=y.icon;return r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(w,{className:"h-3 w-3"}),y.label]})}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.user_name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:x.user_email})]})}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.title}),x.message&&r.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:x.message})]})}),r.jsx(vt,{children:x.points_amount?r.jsxs(Ft,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(vt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(vt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:fn(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(vt,{children:x.seen_at?r.jsx(Ft,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Ft,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),h.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",h.length," of ",l.length," celebrations"]})]})]})]})}const jyt=()=>{const e=ns(),{user:t,isAdmin:n}=zr(),{startImpersonation:s,isLoading:i}=QIe(),{toast:o}=pa(),[l,a]=P.useState([]),[h,p]=P.useState([]),[x,y]=P.useState([]),[w,j]=P.useState({}),[S,C]=P.useState(!0),[A,E]=P.useState({}),[T,O]=P.useState(!1),[z,F]=P.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[q,H]=P.useState(!1),[K,Z]=P.useState(""),[re,ue]=P.useState(1),[he,be]=P.useState(50),[ne,ye]=P.useState("all"),[ie,fe]=P.useState("all"),[de,_e]=P.useState("all"),[Ee,ke]=P.useState("all"),[pe,ae]=P.useState(!1),[ge,Me]=P.useState(!1),[Ue,Ie]=P.useState(null),[Ke,Re]=P.useState(null),[Ce,Je]=P.useState(!1),[Te,Ye]=P.useState({name:"",email:"",brokerage_id:"",phone:""}),[xe,mt]=P.useState(null),[et,nt]=P.useState(!1),[Ae,pt]=P.useState(""),[Be,Qe]=P.useState(!1),[tt,ht]=P.useState(!1),[wt,Ct]=P.useState(null),[It,jt]=P.useState(""),[rr,Ar]=P.useState(!1),[gn,kn]=P.useState(!1),[Jr,zn]=P.useState(null),[js,fr]=P.useState(!1),[xs,bi]=P.useState(!1),[mi,La]=P.useState(null),[da,tl]=P.useState(""),[rl,Ws]=P.useState(!1),[Zi,ks]=P.useState({email:"",name:"",password:"",phone:""}),[Ei,Ii]=P.useState(!1),[Oo,ir]=P.useState(!1),[xo,Tc]=P.useState(""),[yo,ss]=P.useState(!1),[vo,Bd]=P.useState(!1),[_r,Vn]=P.useState(""),[kt,we]=P.useState(new Set),[De,Ge]=P.useState(!1),[_t,yt]=P.useState(!1),[At,Bt]=P.useState(null),[Lt,Ut]=P.useState(!1),[gr,ar]=P.useState(null);P.useEffect(()=>{!t||!n||(tn(),Vr())},[t,n]);const Xr=async()=>{try{const{data:St,error:Cr}=await ee.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(Cr)throw Cr;const dr={};for(const bs of St??[])dr[bs.brokerage_id]||(dr[bs.brokerage_id]=[]),dr[bs.brokerage_id].push(bs.user_id);j(dr)}catch(St){console.error("Error loading brokerage manager assignments:",St)}},tn=async()=>{try{C(!0);const{data:St,error:Cr}=await ee.functions.invoke("get-user-details");if(Cr)throw Cr;a(St.users||[]),y(St.brokerages||[]),await Xr()}catch(St){console.error("Error loading members:",St),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{C(!1)}},Vr=async()=>{try{const{data:St,error:Cr}=await ee.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(Cr)throw Cr;p(St||[])}catch(St){console.error("Error loading apps:",St),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},ts=async St=>{if(!Te.name.trim()||!Te.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Te.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:dr}=await ee.from("profiles").update({name:Te.name.trim(),email:Te.email.trim(),brokerage_id:Te.brokerage_id||null,phone:Te.phone.trim()||null}).eq("id",St);if(dr)throw dr;o({title:"Success",description:"Member details updated successfully"}),Ie(null),tn()}catch(dr){console.error("Error updating member:",dr),o({title:"Error",description:dr.message||"Failed to update member",variant:"destructive"})}},Xn=async St=>{try{const{data:{session:Cr}}=await ee.auth.getSession(),dr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Cr==null?void 0:Cr.access_token}`},body:JSON.stringify({userId:St})}),bs=await dr.json();if(!dr.ok)throw new Error(bs.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(Cr){console.error("Error resending welcome email:",Cr),o({title:"Error",description:Cr.message||"Failed to resend welcome email",variant:"destructive"})}},Qn=async(St,Cr)=>{try{const{error:dr}=await ee.functions.invoke("send-password-reset",{body:{email:St,redirectTo:window.location.origin}});if(dr)throw dr;o({title:"Password Reset Sent",description:`Password reset email sent to ${Cr}`})}catch(dr){console.error("Error sending password reset:",dr),o({title:"Error",description:dr.message||"Failed to send password reset email",variant:"destructive"})}},Fs=async(St,Cr)=>{if(confirm(`Are you sure you want to delete ${Cr}? This action cannot be undone.`))try{const{data:{session:dr}}=await ee.auth.getSession(),bs=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:St})}),zs=await bs.json();if(!bs.ok)throw new Error(zs.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),tn()}catch(dr){console.error("Error deleting user:",dr),o({title:"Error",description:dr.message||"Failed to delete user",variant:"destructive"})}},Ta=async()=>{if(!z.email||!z.name||!z.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if(z.role==="brokerage_manager"&&!z.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}O(!0);try{const{data:{session:St}}=await ee.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${St==null?void 0:St.access_token}`},body:JSON.stringify(z)}),dr=await Cr.json();if(!Cr.ok)throw new Error(dr.error||"Failed to create user");if(z.role&&z.role!=="user"&&dr.userId){const bs=z.role==="brokerage_manager"?z.brokerage_id:void 0;await Ka(dr.userId,z.role,"add",bs)}o({title:"Success",description:`User ${z.email} created successfully`}),F({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),H(!1),tn()}catch(St){console.error("Error creating user:",St),o({title:"Error",description:St.message||"Failed to create user",variant:"destructive"})}finally{O(!1)}},Ka=async(St,Cr,dr,bs)=>{try{const{data:{session:zs}}=await ee.auth.getSession(),Mo={userId:St,role:Cr,action:dr};if(Cr==="brokerage_manager"){if(!bs){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}Mo.brokerageId=bs}const so=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${zs==null?void 0:zs.access_token}`},body:JSON.stringify(Mo)}),io=await so.json();if(!so.ok)throw new Error(io.error||"Failed to manage user role");o({title:"Success",description:`Role ${dr==="add"?"added":"removed"} successfully`}),tn()}catch(zs){console.error("Error managing user role:",zs),o({title:"Error",description:zs.message||"Failed to manage user role",variant:"destructive"})}},Oa=(St,Cr)=>Cr.length===0?!0:Cr.some(dr=>St.includes(dr)),ho=async(St,Cr,dr)=>{const bs=`${St}-${Cr.id}`;mt(bs);try{if(dr){const zs=l.find(so=>so.id===St),Mo=Cr.required_tags.filter(so=>zs==null?void 0:zs.tags.includes(so));for(const so of Mo){const{error:io}=await ee.from("user_tags").delete().eq("user_id",St).eq("tag",so);if(io)throw io}o({title:"Access Removed",description:`Removed access to ${Cr.name}`})}else if(Cr.required_tags.length>0){const{error:zs}=await ee.from("user_tags").insert({user_id:St,tag:Cr.required_tags[0]});if(zs)throw zs;o({title:"Access Granted",description:`Granted access to ${Cr.name}`})}await tn()}catch(zs){console.error("Error toggling access:",zs),o({title:"Error",description:zs.message||"Failed to update access",variant:"destructive"})}finally{mt(null)}},wa=async()=>{const St=Ae.trim();if(!St){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(St.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(x.find(dr=>dr.name.toLowerCase()===St.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Qe(!0);try{const{error:dr}=await ee.from("brokerages").insert({name:St});if(dr)throw dr;o({title:"Success",description:`Brokerage "${St}" created successfully`}),pt(""),nt(!1),tn()}catch(dr){console.error("Error creating brokerage:",dr),o({title:"Error",description:dr.message||"Failed to create brokerage",variant:"destructive"})}finally{Qe(!1)}},Gs=St=>{Ct(St),jt(St.name),ht(!0)},ma=()=>{Ct(null),jt(""),ht(!1)},zi=async()=>{if(!wt)return;const St=It.trim();if(!St){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(St.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}Ar(!0);try{const{error:Cr}=await ee.from("brokerages").update({name:St}).eq("id",wt.id);if(Cr)throw Cr;o({title:"Success",description:"Brokerage updated successfully"}),ma(),tn()}catch(Cr){console.error("Error updating brokerage:",Cr),o({title:"Error",description:Cr.message||"Failed to update brokerage",variant:"destructive"})}finally{Ar(!1)}},Cs=async(St,Cr)=>{var dr;if(!Cr||typeof Cr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const bs={userId:St,role:"brokerage_manager",action:"add",brokerageId:Cr};console.debug("[assignManagerToBrokerage] payload",bs);const{data:{session:zs}}=await ee.auth.getSession(),Mo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${zs==null?void 0:zs.access_token}`},body:JSON.stringify(bs)}),so=await Mo.json();if(!Mo.ok&&!((dr=so.error)!=null&&dr.includes("duplicate")))throw new Error(so.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await tn()}catch(bs){console.error("Error assigning manager:",bs),o({title:"Error",description:bs.message||"Failed to assign manager",variant:"destructive"})}},Ba=St=>{zn(St),kn(!0)},Nl=async()=>{if(Jr){fr(!0);try{const St=l.filter(bs=>bs.brokerage_id===Jr.id),{data:{session:Cr}}=await ee.auth.getSession();for(const bs of St){const zs=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Cr==null?void 0:Cr.access_token}`},body:JSON.stringify({userId:bs.id})});if(!zs.ok){const Mo=await zs.json();console.error(`Failed to delete user ${bs.email}:`,Mo.error)}}const{error:dr}=await ee.from("brokerages").delete().eq("id",Jr.id);if(dr)throw dr;o({title:"Success",description:`Brokerage "${Jr.name}" and ${St.length} member(s) deleted`}),kn(!1),zn(null),tn()}catch(St){console.error("Error deleting brokerage:",St),o({title:"Error",description:St.message||"Failed to delete brokerage",variant:"destructive"})}finally{fr(!1)}}},Rl=St=>{La(St),tl(""),bi(!0)},Ac=()=>{La(null),tl(""),bi(!1)},dp=async St=>{try{const{error:Cr}=await ee.from("profiles").update({brokerage_id:null}).eq("id",St);if(Cr)throw Cr;o({title:"Success",description:"User removed from brokerage"}),tn()}catch(Cr){console.error("Error removing user from brokerage:",Cr),o({title:"Error",description:Cr.message||"Failed to remove user",variant:"destructive"})}},nl=async(St,Cr)=>{try{const{error:dr}=await ee.from("profiles").update({brokerage_id:Cr}).eq("id",St);if(dr)throw dr;o({title:"Success",description:"User added to brokerage"}),tn()}catch(dr){console.error("Error adding user to brokerage:",dr),o({title:"Error",description:dr.message||"Failed to add user",variant:"destructive"})}},yd=async()=>{if(!mi||!Zi.email||!Zi.name||!Zi.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Ii(!0);try{const{data:{session:St}}=await ee.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${St==null?void 0:St.access_token}`},body:JSON.stringify({...Zi,brokerage_id:mi.id,role:"user"})}),dr=await Cr.json();if(!Cr.ok)throw new Error(dr.error||"Failed to create agent");o({title:"Success",description:`Agent ${Zi.email} created successfully`}),ks({email:"",name:"",password:"",phone:""}),Ws(!1),tn()}catch(St){console.error("Error creating agent:",St),o({title:"Error",description:St.message||"Failed to create agent",variant:"destructive"})}finally{Ii(!1)}},sl=St=>l.filter(Cr=>Cr.brokerage_id===St),iu=St=>{const Cr=sl(St);if(!da)return Cr;const dr=da.toLowerCase();return Cr.filter(bs=>bs.name.toLowerCase().includes(dr)||bs.email.toLowerCase().includes(dr))},zo=St=>l.filter(Cr=>Cr.brokerage_id!==St),df=l.filter(St=>{var Cr;if(K){const dr=K.toLowerCase();if(!(St.name.toLowerCase().includes(dr)||St.email.toLowerCase().includes(dr)||((Cr=St.brokerage_name)==null?void 0:Cr.toLowerCase().includes(dr))))return!1}return!(ne==="claimed"&&!St.claimed||ne==="unclaimed"&&St.claimed||ie!=="all"&&!St.roles.includes(ie)||de==="trial"&&!St.is_trial||de==="non-trial"&&St.is_trial||Ee==="none"&&St.brokerage_id||Ee!=="all"&&Ee!=="none"&&St.brokerage_id!==Ee)}),Uu=df.length,Jl=Math.ceil(Uu/he),up=(re-1)*he,Am=up+he,Kc=df.slice(up,Am),qu=St=>{Z(St),ue(1)},Ec=St=>{be(St),ue(1)},Zc=(St,Cr)=>{St(Cr),ue(1)},vd=async(St,Cr)=>{ae(!0);try{const dr=l.find(so=>so.id===St);if(!dr)return;const bs=dr.trial_expires_at?new Date(dr.trial_expires_at):new Date,zs=new Date(bs.getTime()+Cr*24*60*60*1e3),{error:Mo}=await ee.from("profiles").update({trial_expires_at:zs.toISOString()}).eq("id",St);if(Mo)throw Mo;o({title:"Trial Extended",description:`Trial extended by ${Cr} days`}),tn()}catch(dr){console.error("Error extending trial:",dr),o({title:"Error",description:dr.message||"Failed to extend trial",variant:"destructive"})}finally{ae(!1)}},$d=async St=>{Me(!0);try{const{error:Cr}=await ee.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",St);if(Cr)throw Cr;o({title:"Account Converted",description:"User has been converted to a full account"}),tn(),Vu()}catch(Cr){console.error("Error converting trial:",Cr),o({title:"Error",description:Cr.message||"Failed to convert account",variant:"destructive"})}finally{Me(!1)}},au=St=>{Re(St),Ye({name:St.name,email:St.email,brokerage_id:St.brokerage_id||"",phone:St.phone||""}),Je(!0)},Vu=()=>{Re(null),Je(!1),Ye({name:"",email:"",brokerage_id:"",phone:""})},hp=async()=>{Ke&&(await ts(Ke.id),Vu())},vy=St=>{we(Cr=>{const dr=new Set(Cr);return dr.has(St)?dr.delete(St):dr.add(St),dr})},fp=()=>{if(kt.size===Kc.length&&Kc.every(St=>kt.has(St.id))){const St=new Set(kt);Kc.forEach(Cr=>St.delete(Cr.id)),we(St)}else{const St=new Set(kt);Kc.forEach(Cr=>St.add(Cr.id)),we(St)}},pp=()=>{we(new Set)},uk=async()=>{if(kt.size===0)return;Ge(!0);let St=0,Cr=0;try{const{data:{session:dr}}=await ee.auth.getSession();for(const bs of kt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:bs})})).ok?St++:Cr++}catch{Cr++}o({title:"Bulk Email Complete",description:`Sent ${St} emails${Cr>0?`, ${Cr} failed`:""}`}),pp()}catch(dr){o({title:"Error",description:dr.message||"Failed to send emails",variant:"destructive"})}finally{Ge(!1)}},qg=async()=>{if(kt.size===0)return;Ge(!0);let St=0,Cr=0;try{const{data:{session:dr}}=await ee.auth.getSession();for(const bs of kt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:bs})})).ok?St++:Cr++}catch{Cr++}o({title:"Bulk Password Reset Complete",description:`Sent ${St} reset emails${Cr>0?`, ${Cr} failed`:""}`}),pp()}catch(dr){o({title:"Error",description:dr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ge(!1)}},Yc=async()=>{if(kt.size===0)return;const St=l.filter(zs=>kt.has(zs.id)).map(zs=>zs.name).slice(0,5).join(", "),Cr=kt.size>5?` and ${kt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${kt.size} users (${St}${Cr})? This action cannot be undone.`))return;Ge(!0);let dr=0,bs=0;try{const{data:{session:zs}}=await ee.auth.getSession();for(const Mo of kt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${zs==null?void 0:zs.access_token}`},body:JSON.stringify({userId:Mo})})).ok?dr++:bs++}catch{bs++}o({title:"Bulk Delete Complete",description:`Deleted ${dr} users${bs>0?`, ${bs} failed`:""}`}),pp(),tn()}catch(zs){o({title:"Error",description:zs.message||"Failed to delete users",variant:"destructive"})}finally{Ge(!1)}},_y=async()=>{yt(!0);try{const{data:{session:St}}=await ee.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${St==null?void 0:St.access_token}`}});if(!Cr.ok){const bs=await Cr.json();throw new Error(bs.error||"Failed to sync phones")}const dr=await Cr.json();o({title:"Phone Sync Complete",description:`Pulled ${dr.summary.pulledFromGHL} from GHL, pushed ${dr.summary.pushedToGHL} to GHL, ${dr.summary.alreadySynced} already synced`}),tn()}catch(St){o({title:"Error",description:St.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{yt(!1)}},mp=async(St,Cr)=>{Bt(St);try{const{data:{session:dr}}=await ee.auth.getSession(),{data:bs}=await ee.from("profiles").select("phone").eq("id",St).single(),zs=(bs==null?void 0:bs.phone)||"",Mo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({email:Cr,action:"update",phone:zs||void 0})});if(!Mo.ok){const io=await Mo.json();throw new Error(io.error||"Failed to sync with GHL")}const so=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(Cr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:zs?`Phone ${zs} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),tn()}catch(dr){o({title:"Error",description:dr.message||"Failed to sync phone",variant:"destructive"})}finally{Bt(null)}},Hu=async St=>{await s(St)},M3=()=>{if(kt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const St=l.filter(io=>kt.has(io.id)),Cr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],dr=St.map(io=>[io.name,io.email,io.phone||"",io.brokerage_name||"",io.roles.join("; "),io.claimed?"Claimed":"Unclaimed",new Date(io.created_at).toLocaleDateString()]),bs=[Cr.join(","),...dr.map(io=>io.map(Vg=>`"${(Vg||"").replace(/"/g,'""')}"`).join(","))].join(` `),zs=new Blob([bs],{type:"text/csv"}),Mo=URL.createObjectURL(zs),so=document.createElement("a");so.href=Mo,so.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,so.click(),URL.revokeObjectURL(Mo),o({title:"Export complete",description:`Exported ${St.length} member(s)`})};return S?r.jsx(Or,{title:"Members",children:r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(Or,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Member Management",description:"Manage users, roles, and permissions"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(J,{size:"sm",variant:"outline",onClick:_y,disabled:_t,children:[_t?r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(ca,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:_t?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:_t?"Syncing...":"Sync GHL"})]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:()=>ir(!0),children:[r.jsx(u1,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Import CSV"}),r.jsx("span",{className:"sm:hidden",children:"Import"})]}),r.jsxs(Br,{open:q,onOpenChange:H,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{size:"sm",children:[r.jsx(Qh,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Add Member"}),r.jsx("span",{className:"sm:hidden",children:"Add"})]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New User"}),r.jsx(es,{children:"Add a new user to the system. They'll be able to sign in immediately."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",placeholder:"John Doe",value:z.name,onChange:St=>F({...z,name:St.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"email",children:"Email"}),r.jsx(ct,{id:"email",type:"email",placeholder:"john@example.com",value:z.email,onChange:St=>F({...z,email:St.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"password",children:"Password"}),r.jsx(ct,{id:"password",type:"password",placeholder:"Min 6 characters",value:z.password,onChange:St=>F({...z,password:St.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(ct,{id:"phone",type:"tel",placeholder:"555-123-4567",value:z.phone,onChange:St=>F({...z,phone:St.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{htmlFor:"brokerage",children:["Brokerage",z.role==="brokerage_manager"?" (required)":""]}),r.jsxs(bn,{value:z.brokerage_id||"none",onValueChange:St=>F({...z,brokerage_id:St==="none"?"":St}),children:[r.jsx(vn,{id:"brokerage",children:r.jsx(wn,{placeholder:z.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"None"}),x.map(St=>r.jsx(Kt,{value:St.id,children:St.name},St.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"role",children:"Role"}),r.jsxs(bn,{value:z.role,onValueChange:St=>F({...z,role:St}),children:[r.jsx(vn,{id:"role",children:r.jsx(wn,{placeholder:"Select role"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"user",children:"User"}),r.jsx(Kt,{value:"moderator",children:"Moderator"}),r.jsx(Kt,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx(Kt,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(bn,{value:z.trial_days||"none",onValueChange:St=>F({...z,trial_days:St==="none"?"":St}),children:[r.jsx(vn,{id:"trial_days",children:r.jsx(wn,{placeholder:"No trial (full access)"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"No trial (full access)"}),r.jsx(Kt,{value:"7",children:"7-day trial"}),r.jsx(Kt,{value:"30",children:"30-day trial"}),r.jsx(Kt,{value:"60",children:"60-day trial"}),r.jsx(Kt,{value:"90",children:"90-day trial"}),r.jsx(Kt,{value:"365",children:"1-year trial"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Trial accounts don't require a credit card. Access expires after the trial period."})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>H(!1),children:"Cancel"}),r.jsx(J,{onClick:Ta,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(ba,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"members",children:"Members"}),r.jsx(ln,{value:"brokerages",children:"Brokerages"}),r.jsx(ln,{value:"access",children:"Access Matrix"}),r.jsx(ln,{value:"celebrations",children:"Celebrations"})]}),r.jsxs(An,{value:"members",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search members...",value:K,onChange:St=>qu(St.target.value),className:"pl-10 h-9"})]}),r.jsxs(bn,{value:ne,onValueChange:St=>Zc(ye,St),children:[r.jsx(vn,{className:"w-[130px] h-9",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Status"}),r.jsx(Kt,{value:"claimed",children:"Active"}),r.jsx(Kt,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(bn,{value:ie,onValueChange:St=>Zc(fe,St),children:[r.jsx(vn,{className:"w-[130px] h-9",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Roles"}),r.jsx(Kt,{value:"admin",children:"Admin"}),r.jsx(Kt,{value:"brokerage_manager",children:"Manager"}),r.jsx(Kt,{value:"user",children:"User"})]})]}),r.jsxs(bn,{value:de,onValueChange:St=>Zc(_e,St),children:[r.jsx(vn,{className:"w-[130px] h-9",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Users"}),r.jsx(Kt,{value:"trial",children:"Trial Only"}),r.jsx(Kt,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(bn,{value:Ee,onValueChange:St=>Zc(ke,St),children:[r.jsx(vn,{className:"w-[150px] h-9",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Brokerages"}),r.jsx(Kt,{value:"none",children:"No Brokerage"}),x.map(St=>r.jsx(Kt,{value:St.id,children:St.name},St.id))]})]}),(K||ne!=="all"||ie!=="all"||de!=="all"||Ee!=="all")&&r.jsxs(J,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{Z(""),ye("all"),fe("all"),_e("all"),ke("all"),ue(1)},children:[r.jsx(Ts,{className:"h-4 w-4 mr-1"}),"Clear"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",up+1,"-",Math.min(Am,Uu)," of ",Uu," members"]}),r.jsxs(bn,{value:he.toString(),onValueChange:St=>Ec(Number(St)),children:[r.jsx(vn,{className:"h-9 w-[110px]",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"50",children:"50 / page"}),r.jsx(Kt,{value:"100",children:"100 / page"}),r.jsx(Kt,{value:"250",children:"250 / page"})]})]})]})]}),kt.size>0&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/20 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(p0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[kt.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(J,{size:"sm",variant:"outline",onClick:uk,disabled:De,children:[De?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Zs,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Resend Invite"}),r.jsx("span",{className:"sm:hidden",children:"Invite"})]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:qg,disabled:De,children:[De?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Zh,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Password Reset"}),r.jsx("span",{className:"sm:hidden",children:"Reset"})]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:M3,children:[r.jsx(Xa,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Export"}),r.jsx("span",{className:"sm:hidden",children:"CSV"})]}),r.jsxs(J,{size:"sm",variant:"destructive",onClick:Yc,disabled:De,children:[De?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Zn,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Delete"}),r.jsx("span",{className:"sm:hidden",children:"Del"})]}),r.jsx(J,{size:"sm",variant:"ghost",onClick:pp,disabled:De,children:r.jsx(Ts,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Et,{className:"w-[50px]",children:r.jsx(cc,{checked:Kc.length>0&&Kc.every(St=>kt.has(St.id)),onCheckedChange:fp,"aria-label":"Select all on page"})}),r.jsx(Et,{className:"font-semibold",children:"Name"}),r.jsx(Et,{className:"font-semibold",children:"Brokerage"}),r.jsx(Et,{className:"font-semibold",children:"Status"}),r.jsx(Et,{className:"font-semibold",children:"Role"}),r.jsx(Et,{className:"font-semibold",children:"Last Login"}),r.jsx(Et,{className:"w-[100px]"})]})}),r.jsx(Hs,{children:Kc.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Kc.map(St=>r.jsxs(Ir,{className:`hover:bg-muted/30 ${kt.has(St.id)?"bg-primary/5":""}`,children:[r.jsx(vt,{children:r.jsx(cc,{checked:kt.has(St.id),onCheckedChange:()=>vy(St.id),"aria-label":`Select ${St.name}`})}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>au(St),className:"text-primary hover:underline font-medium text-left",children:St.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:St.email})]})}),r.jsx(vt,{className:"text-muted-foreground",children:St.brokerage_name||"—"}),r.jsx(vt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Ft,{variant:St.claimed?"default":"secondary",className:St.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:St.claimed?"Active":"Pending"}),St.is_trial&&St.trial_expires_at&&r.jsx(Pke,{expiresAt:St.trial_expires_at,className:"w-fit"})]})}),r.jsx(vt,{children:St.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:St.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(vt,{className:"text-muted-foreground",children:St.last_sign_in_at?new Date(St.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(vt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{ar(St),Ut(!0)},title:"Send celebration",children:r.jsx(Nc,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>au(St),title:"Edit member",children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>mp(St.id,St.email),disabled:At===St.id,title:"Sync phone with GHL",children:At===St.id?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(ca,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Xn(St.id),title:"Resend welcome email",children:r.jsx(Zs,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Qn(St.email,St.name),title:"Send password reset",children:r.jsx(mj,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Hu(St.id),disabled:i||St.id===(t==null?void 0:t.id),title:St.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${St.name}`,children:i?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(lS,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Fs(St.id,St.name),title:"Delete user",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},St.id))})]})}),Jl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",re," of ",Jl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{variant:"outline",size:"sm",onClick:()=>ue(1),disabled:re===1,children:"First"}),r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ue(St=>Math.max(1,St-1)),disabled:re===1,children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Jl)},(St,Cr)=>{let dr;return Jl<=5||re<=3?dr=Cr+1:re>=Jl-2?dr=Jl-4+Cr:dr=re-2+Cr,r.jsx(J,{variant:re===dr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ue(dr),children:dr},dr)})}),r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ue(St=>Math.min(Jl,St+1)),disabled:re===Jl,children:r.jsx(Ga,{className:"h-4 w-4"})}),r.jsx(J,{variant:"outline",size:"sm",onClick:()=>ue(Jl),disabled:re===Jl,children:"Last"})]})]})]}),r.jsx(Br,{open:Ce,onOpenChange:Je,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Member"}),r.jsx(es,{children:"Update member details, roles, and app access"})]}),Ke&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"edit-name",children:"Name"}),r.jsx(ct,{id:"edit-name",value:Te.name,onChange:St=>Ye({...Te,name:St.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"edit-email",children:"Email"}),r.jsx(ct,{id:"edit-email",type:"email",value:Te.email,onChange:St=>Ye({...Te,email:St.target.value}),maxLength:255})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(ct,{id:"edit-phone",type:"tel",value:Te.phone,onChange:St=>Ye({...Te,phone:St.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(bn,{value:Te.brokerage_id||"none",onValueChange:St=>Ye({...Te,brokerage_id:St==="none"?"":St}),children:[r.jsx(vn,{id:"edit-brokerage",children:r.jsx(wn,{placeholder:"Select brokerage"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"None"}),x.map(St=>r.jsx(Kt,{value:St.id,children:St.name},St.id))]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Roles"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Ke.roles.map(St=>r.jsxs(Ft,{variant:"default",className:"gap-1",children:[r.jsx(Gf,{className:"h-3 w-3"}),St,St==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>Ka(Ke.id,St,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(Ts,{className:"h-3 w-3"})})]},St)),Ke.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(bn,{onValueChange:St=>Ka(Ke.id,St,"add"),children:[r.jsx(vn,{className:"w-[200px]",children:r.jsx(wn,{placeholder:"Add role..."})}),r.jsxs(_n,{children:[!Ke.roles.includes("admin")&&r.jsx(Kt,{value:"admin",children:"Admin"}),!Ke.roles.includes("user")&&r.jsx(Kt,{value:"user",children:"User"})]})]}),!Ke.roles.includes("brokerage_manager")&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"To add as brokerage manager, use Brokerages tab → Manage"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"App Access"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Toggle which apps this member can access"}),r.jsx("div",{className:"grid gap-3",children:h.map(St=>{const Cr=Oa(Ke.tags,St.required_tags),dr=`${Ke.id}-${St.id}`,bs=xe===dr,zs=St.required_tags.length===0;return r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-xl",children:St.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:St.name}),zs&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:bs?r.jsx(nn,{className:"h-4 w-4 animate-spin text-muted-foreground"}):zs?r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx($s,{checked:Cr,onCheckedChange:()=>ho(Ke.id,St,Cr)})})]},St.id)})})]}),Ke.is_trial&&r.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Trial Status"]}),r.jsxs("div",{className:"p-4 rounded-lg border bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("div",{children:Ke.trial_expires_at&&r.jsx(Pke,{expiresAt:Ke.trial_expires_at})}),Ke.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Ke.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(J,{size:"sm",variant:"outline",onClick:()=>vd(Ke.id,7),disabled:pe,children:[r.jsx(lj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:()=>vd(Ke.id,14),disabled:pe,children:[r.jsx(lj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:()=>vd(Ke.id,30),disabled:pe,children:[r.jsx(lj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(J,{size:"sm",variant:"default",onClick:()=>$d(Ke.id),disabled:ge,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(vj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Ke.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Ke.trial_started_at).toLocaleDateString(),Ke.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Ke.trial_claimed_at).toLocaleDateString()]})]})]})]}),r.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Account Information"}),r.jsxs("div",{className:"text-sm space-y-1 text-muted-foreground",children:[Ke.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Ke.email_confirmed_at).toLocaleString()]}),Ke.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Ke.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Ke.created_at).toLocaleString()]})]})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:Vu,children:"Cancel"}),r.jsx(J,{onClick:hp,children:"Save Changes"})]})]})}),r.jsxs(An,{value:"access",children:[h.length===0?r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(J,{onClick:()=>e("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Member Access Matrix"}),r.jsx(En,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),h.map(St=>r.jsx("th",{className:"text-center p-4 font-semibold min-w-[120px]",children:r.jsxs("div",{className:"flex flex-col items-center gap-1",children:[r.jsx("span",{className:"text-2xl",children:St.icon}),r.jsx("span",{className:"text-sm",children:St.name})]})},St.id))]})}),r.jsxs("tbody",{children:[Kc.map(St=>r.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[r.jsx("td",{className:"p-4 sticky left-0 bg-card z-10",children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:St.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:St.email})]})}),h.map(Cr=>{const dr=Oa(St.tags,Cr.required_tags),bs=`${St.id}-${Cr.id}`,zs=xe===bs;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:zs?r.jsx(nn,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx($s,{checked:dr,onCheckedChange:()=>ho(St.id,Cr,dr),disabled:Cr.required_tags.length===0})})},Cr.id)})]},St.id)),Kc.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:h.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Jl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",up+1,"-",Math.min(Am,Uu)," of ",Uu," • Page ",re," of ",Jl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ue(St=>Math.max(1,St-1)),disabled:re===1,children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ue(St=>Math.min(Jl,St+1)),disabled:re===Jl,children:r.jsx(Ga,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(J,{variant:"outline",onClick:()=>e("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(An,{value:"brokerages",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search brokerages...",value:xo,onChange:St=>Tc(St.target.value),className:"pl-10"})]}),r.jsxs(Br,{open:et,onOpenChange:nt,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{size:"sm",children:[r.jsx(na,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New Brokerage"}),r.jsx(es,{children:"Add a new brokerage to the system."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(ct,{id:"brokerage-name",placeholder:"Enter brokerage name",value:Ae,onChange:St=>pt(St.target.value),maxLength:100})]})}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>nt(!1),children:"Cancel"}),r.jsx(J,{onClick:wa,disabled:Be,children:Be?"Creating...":"Create Brokerage"})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Et,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(Et,{className:"font-semibold",children:"Manager(s)"}),r.jsx(Et,{className:"font-semibold",children:"Agents"}),r.jsx(Et,{className:"w-[150px]"})]})}),r.jsx(Hs,{children:(()=>{const St=x.filter(Cr=>Cr.name.toLowerCase().includes(xo.toLowerCase()));return St.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:xo?"No brokerages match your search":"No brokerages found"})}):St.map(Cr=>{const dr=l.filter(so=>so.brokerage_id===Cr.id),zs=(w[Cr.id]??[]).map(so=>l.find(io=>io.id===so)).filter(Boolean),Mo=dr.length;return r.jsxs(Ir,{className:"hover:bg-muted/30",children:[r.jsx(vt,{children:r.jsx("button",{onClick:()=>Gs(Cr),className:"text-primary hover:underline font-medium",children:Cr.name})}),r.jsx(vt,{children:zs.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:zs.map(so=>r.jsx(Ft,{variant:"secondary",className:"text-xs",children:so.name},so.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(vt,{children:[Mo," member",Mo!==1?"s":""]}),r.jsx(vt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(J,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Rl(Cr),children:[r.jsx(Kn,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Gs(Cr),title:"Edit brokerage",children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ba(Cr),title:"Delete brokerage",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Cr.id)})})()})]})}),r.jsx(Br,{open:tt,onOpenChange:ht,children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Brokerage"}),r.jsx(es,{children:"Update brokerage details and manage managers"})]}),wt&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(ct,{id:"edit-brokerage-name",value:It,onChange:St=>jt(St.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{children:"Managers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Click × to remove manager access for this brokerage (keeps them as a member)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{const Cr=(w[wt.id]??[]).map(dr=>l.find(bs=>bs.id===dr)).filter(Boolean);return Cr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):Cr.map(dr=>r.jsxs(Ft,{variant:"default",className:"gap-1",children:[r.jsx(Gf,{className:"h-3 w-3"}),dr.name,r.jsx("button",{onClick:()=>Ka(dr.id,"brokerage_manager","remove",wt.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(Ts,{className:"h-3 w-3"})})]},dr.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(_h,{open:yo,onOpenChange:ss,children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",role:"combobox","aria-expanded":yo,className:"w-full justify-between",children:["Search for a member...",r.jsx(Mi,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ou,{className:"w-full p-0",align:"start",children:r.jsxs($1,{children:[r.jsx(U1,{placeholder:"Search by name or email..."}),r.jsxs(q1,{className:"max-h-[200px]",children:[r.jsx(V1,{children:"No members found."}),r.jsx(H1,{children:(()=>{const St=new Set(w[wt.id]??[]);return l.filter(Cr=>!St.has(Cr.id)&&(n||Cr.brokerage_id===wt.id)).map(Cr=>r.jsxs(W1,{value:`${Cr.name} ${Cr.email}`,onSelect:()=>{Cs(Cr.id,wt.id),ss(!1)},children:[Cr.name," (",Cr.email,")"]},Cr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:l.filter(St=>St.brokerage_id===wt.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(St=>St.brokerage_id===wt.id).map(St=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:St.name}),St.roles.includes("brokerage_manager")&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Manager"})]},St.id))})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:ma,children:"Cancel"}),r.jsx(J,{onClick:zi,disabled:rr,children:rr?"Saving...":"Save Changes"})]})]})}),r.jsx(Br,{open:gn,onOpenChange:kn,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(es,{children:['Are you sure you want to delete "',Jr==null?void 0:Jr.name,'"?']})]}),r.jsx("div",{className:"py-4",children:r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-destructive",children:"Warning: This action cannot be undone!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"This will permanently delete:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground list-disc list-inside",children:[r.jsxs("li",{children:['The brokerage "',Jr==null?void 0:Jr.name,'"']}),r.jsxs("li",{children:["All ",l.filter(St=>St.brokerage_id===(Jr==null?void 0:Jr.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>kn(!1),children:"Cancel"}),r.jsx(J,{variant:"destructive",onClick:Nl,disabled:js,children:js?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Br,{open:xs,onOpenChange:bi,children:r.jsxs(Fr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-5 w-5"}),"Manage ",mi==null?void 0:mi.name]}),r.jsx(es,{children:"Add, remove, or manage users in this brokerage"})]}),mi&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search members...",value:da,onChange:St=>tl(St.target.value),className:"pl-10 h-9"})]}),r.jsxs(Br,{open:rl,onOpenChange:Ws,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{size:"sm",children:[r.jsx(Qh,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Add New Agent"}),r.jsxs(es,{children:["Create a new agent for ",mi.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"agent-name",children:"Name"}),r.jsx(ct,{id:"agent-name",placeholder:"John Doe",value:Zi.name,onChange:St=>ks({...Zi,name:St.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"agent-email",children:"Email"}),r.jsx(ct,{id:"agent-email",type:"email",placeholder:"john@example.com",value:Zi.email,onChange:St=>ks({...Zi,email:St.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"agent-password",children:"Password"}),r.jsx(ct,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:Zi.password,onChange:St=>ks({...Zi,password:St.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(ct,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:Zi.phone,onChange:St=>ks({...Zi,phone:St.target.value})})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>Ws(!1),children:"Cancel"}),r.jsx(J,{onClick:yd,disabled:Ei,children:Ei?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ve,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(_h,{open:vo,onOpenChange:Bd,children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",role:"combobox","aria-expanded":vo,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(Mi,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ou,{className:"w-[300px] p-0",align:"start",children:r.jsxs($1,{children:[r.jsx(U1,{placeholder:"Search users...",value:_r,onValueChange:Vn}),r.jsxs(q1,{children:[r.jsx(V1,{children:"No users found."}),r.jsx(H1,{children:zo(mi.id).filter(St=>_r===""||St.name.toLowerCase().includes(_r.toLowerCase())||St.email.toLowerCase().includes(_r.toLowerCase())).map(St=>r.jsxs(W1,{value:`${St.name} ${St.email}`,onSelect:()=>{nl(St.id,mi.id),Bd(!1),Vn("")},children:[St.name," (",St.email,")"]},St.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Et,{className:"font-semibold",children:"Name"}),r.jsx(Et,{className:"font-semibold",children:"Email"}),r.jsx(Et,{className:"font-semibold",children:"Status"}),r.jsx(Et,{className:"font-semibold",children:"Role"}),r.jsx(Et,{className:"w-[120px]"})]})}),r.jsx(Hs,{children:iu(mi.id).length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:da?"No matching members found":"No members in this brokerage"})}):iu(mi.id).map(St=>r.jsxs(Ir,{className:"hover:bg-muted/30",children:[r.jsx(vt,{className:"font-medium",children:St.name}),r.jsx(vt,{className:"text-muted-foreground",children:St.email}),r.jsx(vt,{children:St.claimed?r.jsx(Ft,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Ft,{variant:"secondary",children:"Pending"})}),r.jsx(vt,{children:St.roles.includes("brokerage_manager")?r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(Gf,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!St.claimed&&r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Xn(St.id),title:"Resend welcome email",children:r.jsx(Zs,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>dp(St.id),title:"Remove from brokerage",children:r.jsx(Ts,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Hu(St.id),disabled:i||St.id===(t==null?void 0:t.id),title:St.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${St.name}`,children:i?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(lS,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Fs(St.id,St.name),title:"Delete user",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},St.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[sl(mi.id).length," total member",sl(mi.id).length!==1?"s":""," •",sl(mi.id).filter(St=>St.roles.includes("brokerage_manager")).length," manager",sl(mi.id).filter(St=>St.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(ri,{children:r.jsx(J,{variant:"outline",onClick:Ac,children:"Close"})})]})})]}),r.jsx(An,{value:"celebrations",children:r.jsx(wyt,{})})]})]}),r.jsx(xRe,{open:Oo,onOpenChange:ir,brokerages:x,onSuccess:tn}),gr&&r.jsx(yRe,{open:Lt,onOpenChange:St=>{Ut(St),St||ar(null)},userId:gr.id,userName:gr.name})]})},kyt=()=>{const[e,t]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[l,a]=P.useState(""),[h,p]=P.useState(""),[x,y]=P.useState(""),[w,j]=P.useState("");P.useEffect(()=>{S()},[]);const S=async()=>{const{data:F,error:q}=await ee.from("invite_codes").select("*").order("created_at",{ascending:!1});q?(ze.error("Failed to load invite codes"),console.error(q)):t(F||[]),s(!1)},C=async F=>{if(F.preventDefault(),!l.trim()){ze.error("Please enter a code");return}o(!0);const{error:q}=await ee.from("invite_codes").insert({code:l.trim().toUpperCase(),description:h.trim()||null,max_uses:x?parseInt(x):null,trial_days:w?parseInt(w):null});q?q.code==="23505"?ze.error("This code already exists"):(ze.error("Failed to create invite code"),console.error(q)):(ze.success("Invite code created"),a(""),p(""),y(""),j(""),S()),o(!1)},A=async(F,q)=>{const{error:H}=await ee.from("invite_codes").update({is_active:!q}).eq("id",F);H?ze.error("Failed to update code"):t(e.map(K=>K.id===F?{...K,is_active:!q}:K))},E=async F=>{const{error:q}=await ee.from("invite_codes").delete().eq("id",F);q?ze.error("Failed to delete code"):(ze.success("Code deleted"),t(e.filter(H=>H.id!==F)))},T="https://dashboard.relevelup.com",O=F=>{const q=`${T}/join?code=${F}`;navigator.clipboard.writeText(q),ze.success("Link copied to clipboard")},z=`${T}/join`;return r.jsx(Or,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Create New Code"}),r.jsxs(En,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:z})]})]}),r.jsx(Xe,{children:r.jsxs("form",{onSubmit:C,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"code",children:"Code"}),r.jsx(ct,{id:"code",placeholder:"WELCOME2024",value:l,onChange:F=>a(F.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(Ve,{htmlFor:"description",children:"Description (optional)"}),r.jsx(ct,{id:"description",placeholder:"For marketing campaign",value:h,onChange:F=>p(F.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(ct,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:F=>y(F.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(ct,{id:"trialDays",type:"number",placeholder:"None",value:w,onChange:F=>j(F.target.value),className:"w-28"})]}),r.jsxs(J,{type:"submit",disabled:i,children:[i?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Active Codes"})}),r.jsx(Xe,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.length===0?r.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No invite codes yet"}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Code"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{children:"Uses"}),r.jsx(Et,{children:"Trial"}),r.jsx(Et,{children:"Created"}),r.jsx(Et,{children:"Active"}),r.jsx(Et,{className:"w-24",children:"Actions"})]})}),r.jsx(Hs,{children:e.map(F=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-mono font-medium",children:F.code}),r.jsx(vt,{className:"text-muted-foreground",children:F.description||"—"}),r.jsxs(vt,{children:[F.uses_count,F.max_uses&&` / ${F.max_uses}`]}),r.jsx(vt,{children:F.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[F.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(vt,{className:"text-muted-foreground",children:fn(new Date(F.created_at),"MMM d, yyyy")}),r.jsx(vt,{children:r.jsx($s,{checked:F.is_active,onCheckedChange:()=>A(F.id,F.is_active)})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>O(F.code),title:"Copy invite link",children:r.jsx(jl,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>E(F.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},F.id))})]})})]})]})})};function Cd(e){this.content=e}Cd.prototype={constructor:Cd,find:function(e){for(var t=0;t>1}};Cd.from=function(e){if(e instanceof Cd)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Cd(t)};function vRe(e,t,n){for(let s=0;;s++){if(s==e.childCount||s==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(s),o=t.child(s);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let l=0;i.text[l]==o.text[l];l++)n++;return n}if(i.content.size||o.content.size){let l=vRe(i.content,o.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function _Re(e,t,n,s){for(let i=e.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:s};let l=e.child(--i),a=t.child(--o),h=l.nodeSize;if(l==a){n-=h,s-=h;continue}if(!l.sameMarkup(a))return{a:n,b:s};if(l.isText&&l.text!=a.text){let p=0,x=Math.min(l.text.length,a.text.length);for(;pt&&s(h,i+a,o||null,l)!==!1&&h.content.size){let x=a+1;h.nodesBetween(Math.max(0,t-x),Math.min(h.content.size,n-x),s,i+x)}a=p}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,s,i){let o="",l=!0;return this.nodesBetween(t,n,(a,h)=>{let p=a.isText?a.text.slice(Math.max(t,h)-h,n-h):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&p||a.isTextblock)&&s&&(l?l=!1:o+=s),o+=p},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,s=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(i[i.length-1]=n.withText(n.text+s.text),o=1);ot)for(let o=0,l=0;lt&&((ln)&&(a.isText?a=a.cut(Math.max(0,t-l),Math.min(a.text.length,n-l)):a=a.cut(Math.max(0,t-l-1),Math.min(a.content.size,n-l-1))),s.push(a),i+=a.nodeSize),l=h}return new yn(s,i)}cutByIndex(t,n){return t==n?yn.empty:t==0&&n==this.content.length?this:new yn(this.content.slice(t,n))}replaceChild(t,n){let s=this.content[t];if(s==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return i[t]=n,new yn(i,o)}addToStart(t){return new yn([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new yn(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;nthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,s=0;;n++){let i=this.child(n),o=s+i.nodeSize;if(o>=t)return o==t?kL(n+1,o):kL(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return yn.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new yn(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return yn.empty;let n,s=0;for(let i=0;ithis.type.rank&&(n||(n=t.slice(0,i)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=t.slice()),s||n.push(this),n}removeFromSet(t){for(let n=0;ns.type.rank-i.type.rank),n}};Do.none=[];class Ste extends Error{}class fs{constructor(t,n,s){this.content=t,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let s=wRe(this.content,t+this.openStart,n);return s&&new fs(s,this.openStart,this.openEnd)}removeBetween(t,n){return new fs(bRe(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return fs.empty;let s=n.openStart||0,i=n.openEnd||0;if(typeof s!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fs(yn.fromJSON(t,n.content),s,i)}static maxOpen(t,n=!0){let s=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new fs(t,s,i)}}fs.empty=new fs(yn.empty,0,0);function bRe(e,t,n){let{index:s,offset:i}=e.findIndex(t),o=e.maybeChild(s),{index:l,offset:a}=e.findIndex(n);if(i==t||o.isText){if(a!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(s!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(s,o.copy(bRe(o.content,t-i-1,n-i-1)))}function wRe(e,t,n,s){let{index:i,offset:o}=e.findIndex(t),l=e.maybeChild(i);if(o==t||l.isText)return s&&!s.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=wRe(l.content,t-o-1,n,l);return a&&e.replaceChild(i,l.copy(a))}function Nyt(e,t,n){if(n.openStart>e.depth)throw new Ste("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ste("Inconsistent open depths");return jRe(e,t,n,0)}function jRe(e,t,n,s){let i=e.index(s),o=e.node(s);if(i==t.index(s)&&s=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function lA(e,t,n,s){let i=(t||e).node(n),o=0,l=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(_j(e.nodeAfter,s),o++));for(let a=o;ai&&Ihe(e,t,i+1),l=s.depth>i&&Ihe(n,s,i+1),a=[];return lA(null,e,i,a),o&&l&&t.index(i)==n.index(i)?(kRe(o,l),_j(bj(o,NRe(e,t,n,s,i+1)),a)):(o&&_j(bj(o,Cte(e,t,i+1)),a),lA(t,n,i,a),l&&_j(bj(l,Cte(n,s,i+1)),a)),lA(s,null,i,a),new yn(a)}function Cte(e,t,n){let s=[];if(lA(null,e,n,s),e.depth>n){let i=Ihe(e,t,n+1);_j(bj(i,Cte(e,t,n+1)),s)}return lA(t,null,n,s),new yn(s)}function Syt(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)i=t.node(o).copy(yn.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}class sE{constructor(t,n,s){this.pos=t,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let s=this.pos-this.path[this.path.length-1],i=t.child(n);return s?t.child(n).cut(s):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let s=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos=0;s--)if(t.pos<=this.end(s)&&(!n||n(this.node(s))))return new Mte(this,t,s);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let s=[],i=0,o=n;for(let l=t;;){let{index:a,offset:h}=l.content.findIndex(o),p=o-h;if(s.push(l,a,i+h),!p||(l=l.child(a),l.isText))break;o=p-1,i+=h+1}return new sE(n,s,o)}static resolveCached(t,n){let s=Lke.get(t);if(s)for(let o=0;ot&&this.nodesBetween(t,n,o=>(s.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),SRe(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,s=yn.empty,i=0,o=s.childCount){let l=this.contentMatchAt(t).matchFragment(s,i,o),a=l&&l.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let h=i;hn.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,s)}let i=yn.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,i,s);return o.type.checkAttrs(o.attrs),o}};N1.prototype.text=void 0;class Tte extends N1{constructor(t,n,s,i){if(super(t,n,null,i),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):SRe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Tte(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Tte(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function SRe(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class $j{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let s=new Ayt(t,n);if(s.next==null)return $j.empty;let i=CRe(s);s.next&&s.err("Unexpected trailing text");let o=Ryt(Dyt(i));return Fyt(o,s),o}matchType(t){for(let n=0;np.createAndFill()));for(let p=0;p=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(s){t.push(s);for(let i=0;i{let o=i+(s.validEnd?"*":" ")+" ";for(let l=0;l"+t.indexOf(s.next[l].next);return o}).join(` `)}}$j.empty=new $j(!0);class Ayt{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function CRe(e){let t=[];do t.push(Eyt(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Eyt(e){let t=[];do t.push(Iyt(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Iyt(e){let t=Oyt(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=Pyt(e,t);else break;return t}function Oke(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Pyt(e,t){let n=Oke(e),s=n;return e.eat(",")&&(e.next!="}"?s=Oke(e):s=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:t}}function Lyt(e,t){let n=e.nodeTypes,s=n[t];if(s)return[s];let i=[];for(let o in n){let l=n[o];l.isInGroup(t)&&i.push(l)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function Oyt(e){if(e.eat("(")){let t=CRe(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=Lyt(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function Dyt(e){let t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function s(l,a,h){let p={term:h,to:a};return t[l].push(p),p}function i(l,a){l.forEach(h=>h.to=a)}function o(l,a){if(l.type=="choice")return l.exprs.reduce((h,p)=>h.concat(o(p,a)),[]);if(l.type=="seq")for(let h=0;;h++){let p=o(l.exprs[h],a);if(h==l.exprs.length-1)return p;i(p,a=n())}else if(l.type=="star"){let h=n();return s(a,h),i(o(l.expr,h),h),[s(h)]}else if(l.type=="plus"){let h=n();return i(o(l.expr,a),h),i(o(l.expr,h),h),[s(h)]}else{if(l.type=="opt")return[s(a)].concat(o(l.expr,a));if(l.type=="range"){let h=a;for(let p=0;p{e[l].forEach(({term:a,to:h})=>{if(!a)return;let p;for(let x=0;x{p||i.push([a,p=[]]),p.indexOf(x)==-1&&p.push(x)})})});let o=t[s.join(",")]=new $j(s.indexOf(e.length-1)>-1);for(let l=0;l-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:ARe(this.attrs,t)}create(t=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new N1(this,this.computeAttrs(t),yn.from(n),Do.setFrom(s))}createChecked(t=null,n,s){return n=yn.from(n),this.checkContent(n),new N1(this,this.computeAttrs(t),n,Do.setFrom(s))}createAndFill(t=null,n,s){if(t=this.computeAttrs(t),n=yn.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(yn.empty,!0);return o?new N1(this,t,n.append(o),Do.setFrom(s)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let s=0;s-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;ns[o]=new PRe(o,n,l));let i=n.spec.topNode||"doc";if(!s[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let o in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function zyt(e,t,n){let s=n.split("|");return i=>{let o=i===null?"null":typeof i;if(s.indexOf(o)<0)throw new RangeError(`Expected value of type ${s} for attribute ${t} on type ${e}, got ${o}`)}}class Byt{constructor(t,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?zyt(t,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class Ise{constructor(t,n,s,i){this.name=t,this.rank=n,this.schema=s,this.spec=i,this.attrs=IRe(t,i.attrs),this.excluded=null;let o=TRe(this.attrs);this.instance=o?new Do(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Do(this,ARe(this.attrs,t))}static compile(t,n){let s=Object.create(null),i=0;return t.forEach((o,l)=>s[o]=new Ise(o,i++,n,l)),s}removeFromSet(t){for(var n=0;n-1}}class LRe{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=Cd.from(t.nodes),n.marks=Cd.from(t.marks||{}),this.nodes=Rke.compile(this.spec.nodes,this),this.marks=Ise.compile(this.spec.marks,this);let s=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],l=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=s[l]||(s[l]=$j.parse(l,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Fke(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:Fke(this,l.split(" "))}this.nodeFromJSON=i=>N1.fromJSON(this,i),this.markFromJSON=i=>Do.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,s,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Rke){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,s,i)}text(t,n){let s=this.nodes.text;return new Tte(s,s.defaultAttrs,t,Do.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function Fke(e,t){let n=[];for(let s=0;s-1)&&n.push(l=h)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[s]+"'")}return n}function $yt(e){return e.tag!=null}function Uyt(e){return e.style!=null}let cA=class Lhe{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(i=>{if($yt(i))this.tags.push(i);else if(Uyt(i)){let o=/[^=]*/.exec(i.style)[0];s.indexOf(o)<0&&s.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=t.nodes[i.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let s=new Bke(this,n,!1);return s.addAll(t,Do.none,n.from,n.to),s.finish()}parseSlice(t,n={}){let s=new Bke(this,n,!0);return s.addAll(t,Do.none,n.from,n.to),fs.maxOpen(s.finish())}matchTag(t,n,s){for(let i=s?this.tags.indexOf(s)+1:0;it.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(l.getAttrs){let h=l.getAttrs(n);if(h===!1)continue;l.attrs=h||void 0}return l}}}static schemaRules(t){let n=[];function s(i){let o=i.priority==null?50:i.priority,l=0;for(;l{s(l=$ke(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(l=>{s(l=$ke(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Lhe(t,Lhe.schemaRules(t)))}};const ORe={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},qyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},DRe={ol:!0,ul:!0},iE=1,Ohe=2,dA=4;function zke(e,t,n){return t!=null?(t?iE:0)|(t==="full"?Ohe:0):e&&e.whitespace=="pre"?iE|Ohe:n&~dA}class NL{constructor(t,n,s,i,o,l){this.type=t,this.attrs=n,this.marks=s,this.solid=i,this.options=l,this.content=[],this.activeMarks=Do.none,this.match=o||(l&dA?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(yn.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,i;return(i=s.findWrapping(t.type))?(this.match=s,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&iE)){let s=this.content[this.content.length-1],i;if(s&&s.isText&&(i=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=yn.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(yn.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!ORe.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Bke{constructor(t,n,s){this.parser=t,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,l=zke(null,n.preserveWhitespace,0)|(s?dA:0);i?o=new NL(i.type,i.attrs,Do.none,!0,n.topMatch||i.type.contentMatch,l):s?o=new NL(null,null,Do.none,!0,null,l):o=new NL(t.schema.topNodeType,null,Do.none,!0,null,l),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let s=t.nodeValue,i=this.top,o=i.options&Ohe?"full":this.localPreserveWS||(i.options&iE)>0,{schema:l}=this.parser;if(o==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,` `);else if(l.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(l.linebreakReplacement.create())){let a=s.split(/\r?\n|\r/);for(let h=0;h!h.clearMark(p)):n=n.concat(this.parser.schema.marks[h.mark].create(h.attrs)),h.consuming===!1)a=h;else break}}return n}addElementByRule(t,n,s,i){let o,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),s,t.nodeName=="BR")||this.leafFallback(t,s);else{let h=this.enter(l,n.attrs||null,s,n.preserveWhitespace);h&&(o=!0,s=h)}else{let h=this.parser.schema.marks[n.mark];s=s.concat(h.create(n.attrs))}let a=this.top;if(l&&l.isLeaf)this.findInside(t);else if(i)this.addElement(t,s,i);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(h=>this.insertNode(h,s,!1));else{let h=t;typeof n.contentElement=="string"?h=t.querySelector(n.contentElement):typeof n.contentElement=="function"?h=n.contentElement(t):n.contentElement&&(h=n.contentElement),this.findAround(t,h,!0),this.addAll(h,s),this.findAround(t,h,!1)}o&&this.sync(a)&&this.open--}addAll(t,n,s,i){let o=s||0;for(let l=s?t.childNodes[s]:t.firstChild,a=i==null?null:t.childNodes[i];l!=a;l=l.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(l,n);this.findAtPoint(t,o)}findPlace(t,n,s){let i,o;for(let l=this.open,a=0;l>=0;l--){let h=this.nodes[l],p=h.findWrapping(t);if(p&&(!i||i.length>p.length+a)&&(i=p,o=h,!p.length))break;if(h.solid){if(s)break;a+=2}}if(!i)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(p.type):Uke(p.type,t))?(h=p.addToSet(h),!1):!0),this.nodes.push(new NL(t,n,h,i,null,a)),this.open++,s}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=iE)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let i=s.length-1;i>=0;i--)t+=s[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let s=0;s-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),s=this.options.context,i=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(i?0:1),l=(a,h)=>{for(;a>=0;a--){let p=n[a];if(p==""){if(a==n.length-1||a==0)continue;for(;h>=o;h--)if(l(a-1,h))return!0;return!1}else{let x=h>0||h==0&&i?this.nodes[h].type:s&&h>=o?s.node(h-o).type:null;if(!x||x.name!=p&&!x.isInGroup(p))return!1;h--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}}function Vyt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let s=t.nodeType==1?t.nodeName.toLowerCase():null;s&&DRe.hasOwnProperty(s)&&n?(n.appendChild(t),t=n):s=="li"?n=t:s&&(n=null)}}function Hyt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function $ke(e){let t={};for(let n in e)t[n]=e[n];return t}function Uke(e,t){let n=t.schema.nodes;for(let s in n){let i=n[s];if(!i.allowsMarkType(e))continue;let o=[],l=a=>{o.push(a);for(let h=0;h{if(o.length||l.marks.length){let a=0,h=0;for(;a=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(t,n,s={}){let i=this.marks[t.type.name];return i&&dee(oce(s),i(t,n),null,t.attrs)}static renderSpec(t,n,s=null,i){return dee(t,n,s,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ik(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=qke(t.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(t){return qke(t.marks)}}function qke(e){let t={};for(let n in e){let s=e[n].spec.toDOM;s&&(t[n]=s)}return t}function oce(e){return e.document||window.document}const Vke=new WeakMap;function Wyt(e){let t=Vke.get(e);return t===void 0&&Vke.set(e,t=Gyt(e)),t}function Gyt(e){let t=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")t||(t=[]),t.push(s);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let a,h=n?e.createElementNS(n,i):e.createElement(i),p=t[1],x=1;if(p&&typeof p=="object"&&p.nodeType==null&&!Array.isArray(p)){x=2;for(let y in p)if(p[y]!=null){let w=y.indexOf(" ");w>0?h.setAttributeNS(y.slice(0,w),y.slice(w+1),p[y]):y=="style"&&h.style?h.style.cssText=p[y]:h.setAttribute(y,p[y])}}for(let y=x;yx)throw new RangeError("Content hole must be the only child of its parent node");return{dom:h,contentDOM:h}}else{let{dom:j,contentDOM:S}=dee(e,w,n,s);if(h.appendChild(j),S){if(a)throw new RangeError("Multiple content holes");a=S}}}return{dom:h,contentDOM:a}}const RRe=65535,FRe=Math.pow(2,16);function Kyt(e,t){return e+t*FRe}function Hke(e){return e&RRe}function Zyt(e){return(e-(e&RRe))/FRe}const zRe=1,BRe=2,uee=4,$Re=8;class Dhe{constructor(t,n,s){this.pos=t,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&$Re)>0}get deletedBefore(){return(this.delInfo&(zRe|uee))>0}get deletedAfter(){return(this.delInfo&(BRe|uee))>0}get deletedAcross(){return(this.delInfo&uee)>0}}class qh{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&qh.empty)return qh.empty}recover(t){let n=0,s=Hke(t);if(!this.inverted)for(let i=0;it)break;let p=this.ranges[a+o],x=this.ranges[a+l],y=h+p;if(t<=y){let w=p?t==h?-1:t==y?1:n:n,j=h+i+(w<0?0:x);if(s)return j;let S=t==(n<0?h:y)?null:Kyt(a/3,t-h),C=t==h?BRe:t==y?zRe:uee;return(n<0?t!=h:t!=y)&&(C|=$Re),new Dhe(j,C,S)}i+=x-p}return s?t+i:new Dhe(t+i,0,null)}touches(t,n){let s=0,i=Hke(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;at)break;let p=this.ranges[a+o],x=h+p;if(t<=x&&a==i*3)return!0;s+=this.ranges[a+l]-p}return!1}forEach(t){let n=this.inverted?2:1,s=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=t.getMirror(n);this.appendMap(t._maps[n].invert(),i!=null&&i>n?s-i-1:void 0)}}invert(){let t=new aE;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let s=this.from;so&&h!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return kc.fromReplace(t,this.from,this.to,o)}invert(){return new fg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new H0(n.pos,s.pos,this.mark)}merge(t){return t instanceof H0&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new H0(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new H0(n.from,n.to,t.markFromJSON(n.mark))}}su.jsonID("addMark",H0);class fg extends su{constructor(t,n,s){super(),this.from=t,this.to=n,this.mark=s}apply(t){let n=t.slice(this.from,this.to),s=new fs(zxe(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return kc.fromReplace(t,this.from,this.to,s)}invert(){return new H0(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new fg(n.pos,s.pos,this.mark)}merge(t){return t instanceof fg&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new fg(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fg(n.from,n.to,t.markFromJSON(n.mark))}}su.jsonID("removeMark",fg);class W0 extends su{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return kc.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return kc.fromReplace(t,this.pos,this.pos+1,new fs(yn.from(s),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let i=0;is.pos?null:new fd(n.pos,s.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new fd(n.from,n.to,n.gapFrom,n.gapTo,fs.fromJSON(t,n.slice),n.insert,!!n.structure)}}su.jsonID("replaceAround",fd);function Rhe(e,t,n){let s=e.resolve(t),i=n-t,o=s.depth;for(;i>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,i--;if(i>0){let l=s.node(o).maybeChild(s.indexAfter(o));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function Yyt(e,t,n,s){let i=[],o=[],l,a;e.doc.nodesBetween(t,n,(h,p,x)=>{if(!h.isInline)return;let y=h.marks;if(!s.isInSet(y)&&x.type.allowsMarkType(s.type)){let w=Math.max(p,t),j=Math.min(p+h.nodeSize,n),S=s.addToSet(y);for(let C=0;Ce.step(h)),o.forEach(h=>e.step(h))}function Xyt(e,t,n,s){let i=[],o=0;e.doc.nodesBetween(t,n,(l,a)=>{if(!l.isInline)return;o++;let h=null;if(s instanceof Ise){let p=l.marks,x;for(;x=s.isInSet(p);)(h||(h=[])).push(x),p=x.removeFromSet(p)}else s?s.isInSet(l.marks)&&(h=[s]):h=l.marks;if(h&&h.length){let p=Math.min(a+l.nodeSize,n);for(let x=0;xe.step(new fg(l.from,l.to,l.style)))}function Bxe(e,t,n,s=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),l=[],a=t+1;for(let h=0;h=0;h--)e.step(l[h])}function Qyt(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function p3(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let s=e.depth,i=0,o=0;;--s){let l=e.$from.node(s),a=e.$from.index(s)+i,h=e.$to.indexAfter(s)-o;if(sn;S--)C||s.index(S)>0?(C=!0,x=yn.from(s.node(S).copy(x)),y++):h--;let w=yn.empty,j=0;for(let S=o,C=!1;S>n;S--)C||i.after(S+1)=0;l--){if(s.size){let a=n[l].type.contentMatch.matchFragment(s);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=yn.from(n[l].type.create(n[l].attrs,s))}let i=t.start,o=t.end;e.step(new fd(i,o,i,o,new fs(s,0,0),n.length,!0))}function n0t(e,t,n,s,i){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(l,a)=>{let h=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(s,h)&&s0t(e.doc,e.mapping.slice(o).map(a),s)){let p=null;if(s.schema.linebreakReplacement){let j=s.whitespace=="pre",S=!!s.contentMatch.matchType(s.schema.linebreakReplacement);j&&!S?p=!1:!j&&S&&(p=!0)}p===!1&&qRe(e,l,a,o),Bxe(e,e.mapping.slice(o).map(a,1),s,void 0,p===null);let x=e.mapping.slice(o),y=x.map(a,1),w=x.map(a+l.nodeSize,1);return e.step(new fd(y,w,y+1,w-1,new fs(yn.from(s.create(h,null,l.marks)),0,0),1,!0)),p===!0&&URe(e,l,a,o),!1}})}function URe(e,t,n,s){t.forEach((i,o)=>{if(i.isText){let l,a=/\r?\n|\r/g;for(;l=a.exec(i.text);){let h=e.mapping.slice(s).map(n+1+o+l.index);e.replaceWith(h,h+1,t.type.schema.linebreakReplacement.create())}}})}function qRe(e,t,n,s){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let l=e.mapping.slice(s).map(n+1+o);e.replaceWith(l,l+1,t.type.schema.text(` `))}})}function s0t(e,t,n){let s=e.resolve(t),i=s.index();return s.parent.canReplaceWith(i,i+1,n)}function i0t(e,t,n,s,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let l=n.create(s,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,l);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new fd(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new fs(yn.from(l),0,0),1,!0))}function Kx(e,t,n=1,s){let i=e.resolve(t),o=i.depth-n,l=s&&s[s.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let p=i.depth-1,x=n-2;p>o;p--,x--){let y=i.node(p),w=i.index(p);if(y.type.spec.isolating)return!1;let j=y.content.cutByIndex(w,y.childCount),S=s&&s[x+1];S&&(j=j.replaceChild(0,S.type.create(S.attrs)));let C=s&&s[x]||y;if(!y.canReplace(w+1,y.childCount)||!C.type.validContent(j))return!1}let a=i.indexAfter(o),h=s&&s[0];return i.node(o).canReplaceWith(a,a,h?h.type:i.node(o+1).type)}function a0t(e,t,n=1,s){let i=e.doc.resolve(t),o=yn.empty,l=yn.empty;for(let a=i.depth,h=i.depth-n,p=n-1;a>h;a--,p--){o=yn.from(i.node(a).copy(o));let x=s&&s[p];l=yn.from(x?x.type.create(x.attrs,l):i.node(a).copy(l))}e.step(new od(t,t,new fs(o.append(l),n,n),!0))}function iv(e,t){let n=e.resolve(t),s=n.index();return VRe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function o0t(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:s}=e.type.schema;for(let i=0;i0?(o=s.node(i+1),a++,l=s.node(i).maybeChild(a)):(o=s.node(i).maybeChild(a-1),l=s.node(i+1)),o&&!o.isTextblock&&VRe(o,l)&&s.node(i).canReplace(a,a+1))return t;if(i==0)break;t=n<0?s.before(i):s.after(i)}}function l0t(e,t,n){let s=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),l=o.node().type;if(i&&l.inlineContent){let x=l.whitespace=="pre",y=!!l.contentMatch.matchType(i);x&&!y?s=!1:!x&&y&&(s=!0)}let a=e.steps.length;if(s===!1){let x=e.doc.resolve(t+n);qRe(e,x.node(),x.before(),a)}l.inlineContent&&Bxe(e,t+n-1,l,o.node().contentMatchAt(o.index()),s==null);let h=e.mapping.slice(a),p=h.map(t-n);if(e.step(new od(p,h.map(t+n,-1),fs.empty,!0)),s===!0){let x=e.doc.resolve(p);URe(e,x.node(),x.before(),e.steps.length)}return e}function c0t(e,t,n){let s=e.resolve(t);if(s.parent.canReplaceWith(s.index(),s.index(),n))return t;if(s.parentOffset==0)for(let i=s.depth-1;i>=0;i--){let o=s.index(i);if(s.node(i).canReplaceWith(o,o,n))return s.before(i+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let i=s.depth-1;i>=0;i--){let o=s.indexAfter(i);if(s.node(i).canReplaceWith(o,o,n))return s.after(i+1);if(o=0;l--){let a=l==s.depth?0:s.pos<=(s.start(l+1)+s.end(l+1))/2?-1:1,h=s.index(l)+(a>0?1:0),p=s.node(l),x=!1;if(o==1)x=p.canReplace(h,h,i);else{let y=p.contentMatchAt(h).findWrapping(i.firstChild.type);x=y&&p.canReplaceWith(h,h,y[0])}if(x)return a==0?s.pos:a<0?s.before(l+1):s.after(l+1)}return null}function Lse(e,t,n=t,s=fs.empty){if(t==n&&!s.size)return null;let i=e.resolve(t),o=e.resolve(n);return WRe(i,o,s)?new od(t,n,s):new d0t(i,o,s).fit()}function WRe(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class d0t{constructor(t,n,s){this.$from=t,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=yn.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=yn.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let p=this.findFittable();p?this.placeNodes(p):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,i=this.close(t<0?this.$to:s.doc.resolve(t));if(!i)return null;let o=this.placed,l=s.depth,a=i.depth;for(;l&&a&&o.childCount==1;)o=o.firstChild.content,l--,a--;let h=new fs(o,l,a);return t>-1?new fd(s.pos,t,this.$to.pos,this.$to.end(),h,n):h.size||s.pos!=this.$to.pos?new od(s.pos,i.pos,h):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,i=this.unplaced.openEnd;s1&&(i=0),o.type.spec.isolating&&i<=s){t=s;break}n=o.content}for(let n=1;n<=2;n++)for(let s=n==1?t:this.unplaced.openStart;s>=0;s--){let i,o=null;s?(o=cce(this.unplaced.content,s-1).firstChild,i=o.content):i=this.unplaced.content;let l=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:h,match:p}=this.frontier[a],x,y=null;if(n==1&&(l?p.matchType(l.type)||(y=p.fillBefore(yn.from(l),!1)):o&&h.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:a,parent:o,inject:y};if(n==2&&l&&(x=p.findWrapping(l.type)))return{sliceDepth:s,frontierDepth:a,parent:o,wrap:x};if(o&&p.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:s}=this.unplaced,i=cce(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new fs(t,n+1,Math.max(s,i.size+n>=t.size-s?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:s}=this.unplaced,i=cce(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new fs(uT(t,n-1,1),n-1,o?n-1:s)}else this.unplaced=new fs(uT(t,n,1),n,s)}placeNodes({sliceDepth:t,frontierDepth:n,parent:s,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let C=0;C1||h==0||C.content.size)&&(y=A,x.push(GRe(C.mark(w.allowedMarks(C.marks)),p==1?h:0,p==a.childCount?j:-1)))}let S=p==a.childCount;S||(j=-1),this.placed=hT(this.placed,n,yn.from(x)),this.frontier[n].match=y,S&&j<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let C=0,A=a;C1&&i==this.$to.end(--s);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:s,type:i}=this.frontier[n],o=n=0;a--){let{match:h,type:p}=this.frontier[a],x=dce(t,a,p,h,!0);if(!x||x.childCount)continue e}return{depth:n,fit:l,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=hT(this.placed,n.depth,n.fit)),t=n.move;for(let s=n.depth+1;s<=t.depth;s++){let i=t.node(s),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(s));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,s){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=hT(this.placed,this.depth,yn.from(t.create(n,s))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(yn.empty,!0);n.childCount&&(this.placed=hT(this.placed,this.frontier.length,n))}}function uT(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(uT(e.firstChild.content,t-1,n)))}function hT(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(hT(e.lastChild.content,t-1,n)))}function cce(e,t){for(let n=0;n1&&(s=s.replaceChild(0,GRe(s.firstChild,t-1,s.childCount==1?n-1:0))),t>0&&(s=e.type.contentMatch.fillBefore(s).append(s),n<=0&&(s=s.append(e.type.contentMatch.matchFragment(s).fillBefore(yn.empty,!0)))),e.copy(s)}function dce(e,t,n,s,i){let o=e.node(t),l=i?e.indexAfter(t):e.index(t);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let a=s.fillBefore(o.content,!0,l);return a&&!u0t(n,o.content,l)?a:null}function u0t(e,t,n){for(let s=n;s0;w--,j--){let S=i.node(w).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;l.indexOf(w)>-1?a=w:i.before(w)==j&&l.splice(1,0,-w)}let h=l.indexOf(a),p=[],x=s.openStart;for(let w=s.content,j=0;;j++){let S=w.firstChild;if(p.push(S),j==s.openStart)break;w=S.content}for(let w=x-1;w>=0;w--){let j=p[w],S=h0t(j.type);if(S&&!j.sameMarkup(i.node(Math.abs(a)-1)))x=w;else if(S||!j.type.isTextblock)break}for(let w=s.openStart;w>=0;w--){let j=(w+x+1)%(s.openStart+1),S=p[j];if(S)for(let C=0;C=0&&(e.replace(t,n,s),!(e.steps.length>y));w--){let j=l[w];j<0||(t=i.before(j),n=o.after(j))}}function KRe(e,t,n,s,i){if(ts){let o=i.contentMatchAt(0),l=o.fillBefore(e).append(e);e=l.append(o.matchFragment(l).fillBefore(yn.empty,!0))}return e}function p0t(e,t,n,s){if(!s.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=c0t(e.doc,t,s.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new fs(yn.from(s),0,0))}function m0t(e,t,n){let s=e.doc.resolve(t),i=e.doc.resolve(n),o=ZRe(s,i);for(let l=0;l0&&(h||s.node(a-1).canReplace(s.index(a-1),i.indexAfter(a-1))))return e.delete(s.before(a),i.after(a))}for(let l=1;l<=s.depth&&l<=i.depth;l++)if(t-s.start(l)==s.depth-l&&n>s.end(l)&&i.end(l)-n!=i.depth-l&&s.start(l-1)==i.start(l-1)&&s.node(l-1).canReplace(s.index(l-1),i.index(l-1)))return e.delete(s.before(l),n);e.delete(t,n)}function ZRe(e,t){let n=[],s=Math.min(e.depth,t.depth);for(let i=s;i>=0;i--){let o=e.start(i);if(ot.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(o==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==o-1)&&n.push(i)}return n}class AS extends su{constructor(t,n,s){super(),this.pos=t,this.attr=n,this.value=s}apply(t){let n=t.nodeAt(this.pos);if(!n)return kc.fail("No node at attribute step's position");let s=Object.create(null);for(let o in n.attrs)s[o]=n.attrs[o];s[this.attr]=this.value;let i=n.type.create(s,null,n.marks);return kc.fromReplace(t,this.pos,this.pos+1,new fs(yn.from(i),0,n.isLeaf?0:1))}getMap(){return qh.empty}invert(t){return new AS(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new AS(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new AS(n.pos,n.attr,n.value)}}su.jsonID("attr",AS);class oE extends su{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let s=t.type.create(n,t.content,t.marks);return kc.ok(s)}getMap(){return qh.empty}invert(t){return new oE(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new oE(n.attr,n.value)}}su.jsonID("docAttr",oE);let xC=class extends Error{};xC=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};xC.prototype=Object.create(Error.prototype);xC.prototype.constructor=xC;xC.prototype.name="TransformError";class YRe{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new aE}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new xC(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,s=fs.empty){let i=Lse(this.doc,t,n,s);return i&&this.step(i),this}replaceWith(t,n,s){return this.replace(t,n,new fs(yn.from(s),0,0))}delete(t,n){return this.replace(t,n,fs.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,s){return f0t(this,t,n,s),this}replaceRangeWith(t,n,s){return p0t(this,t,n,s),this}deleteRange(t,n){return m0t(this,t,n),this}lift(t,n){return Jyt(this,t,n),this}join(t,n=1){return l0t(this,t,n),this}wrap(t,n){return r0t(this,t,n),this}setBlockType(t,n=t,s,i=null){return n0t(this,t,n,s,i),this}setNodeMarkup(t,n,s=null,i){return i0t(this,t,n,s,i),this}setNodeAttribute(t,n,s){return this.step(new AS(t,n,s)),this}setDocAttribute(t,n){return this.step(new oE(t,n)),this}addNodeMark(t,n){return this.step(new W0(t,n)),this}removeNodeMark(t,n){let s=this.doc.nodeAt(t);if(!s)throw new RangeError("No node at position "+t);if(n instanceof Do)n.isInSet(s.marks)&&this.step(new Uj(t,n));else{let i=s.marks,o,l=[];for(;o=n.isInSet(i);)l.push(new Uj(t,o)),i=o.removeFromSet(i);for(let a=l.length-1;a>=0;a--)this.step(l[a])}return this}split(t,n=1,s){return a0t(this,t,n,s),this}addMark(t,n,s){return Yyt(this,t,n,s),this}removeMark(t,n,s){return Xyt(this,t,n,s),this}clearIncompatible(t,n,s){return Bxe(this,t,n,s),this}}const uce=Object.create(null);class la{constructor(t,n,s){this.$anchor=t,this.$head=n,this.ranges=s||[new g0t(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n=0;o--){let l=n<0?v4(t.node(0),t.node(o),t.before(o+1),t.index(o),n,s):v4(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,s);if(l)return l}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new ef(t.node(0))}static atStart(t){return v4(t,t,0,0,1)||new ef(t)}static atEnd(t){return v4(t,t,t.content.size,t.childCount,-1)||new ef(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=uce[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(t,n)}static jsonID(t,n){if(t in uce)throw new RangeError("Duplicate use of selection JSON ID "+t);return uce[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Ui.between(this.$anchor,this.$head).getBookmark()}}la.prototype.visible=!0;class g0t{constructor(t,n){this.$from=t,this.$to=n}}let Gke=!1;function Kke(e){!Gke&&!e.parent.inlineContent&&(Gke=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Ui extends la{constructor(t,n=t){Kke(t),Kke(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let s=t.resolve(n.map(this.head));if(!s.parent.inlineContent)return la.near(s);let i=t.resolve(n.map(this.anchor));return new Ui(i.parent.inlineContent?i:s,s)}replace(t,n=fs.empty){if(super.replace(t,n),n==fs.empty){let s=this.$from.marksAcross(this.$to);s&&t.ensureMarks(s)}}eq(t){return t instanceof Ui&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Ose(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ui(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,s=n){let i=t.resolve(n);return new this(i,s==n?i:t.resolve(s))}static between(t,n,s){let i=t.pos-n.pos;if((!s||i)&&(s=i>=0?1:-1),!n.parent.inlineContent){let o=la.findFrom(n,s,!0)||la.findFrom(n,-s,!0);if(o)n=o.$head;else return la.near(n,s)}return t.parent.inlineContent||(i==0?t=n:(t=(la.findFrom(t,-s,!0)||la.findFrom(t,s,!0)).$anchor,t.pos0?0:1);i>0?l=0;l+=i){let a=t.child(l);if(a.isAtom){if(!o&&si.isSelectable(a))return si.create(e,n-(i<0?a.nodeSize:0))}else{let h=v4(e,a,n+i,i<0?a.childCount:0,i,o);if(h)return h}n+=a.nodeSize*i}return null}function Zke(e,t,n){let s=e.steps.length-1;if(s{l==null&&(l=x)}),e.setSelection(la.near(e.doc.resolve(l),n))}const Yke=1,SL=2,Xke=4;class y0t extends YRe{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=SL,this}ensureMarks(t){return Do.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&SL)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~SL,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let s=this.selection;return n&&(t=t.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||Do.none))),s.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,s){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(s==null&&(s=n),!t)return this.deleteRange(n,s);let o=this.storedMarks;if(!o){let l=this.doc.resolve(n);o=s==n?l.marks():l.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(n,s,i.text(t,o)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(la.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Xke,this}get scrolledIntoView(){return(this.updated&Xke)>0}}function Qke(e,t){return!t||!e?e:e.bind(t)}class fT{constructor(t,n,s){this.name=t,this.init=Qke(n.init,s),this.apply=Qke(n.apply,s)}}const v0t=[new fT("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new fT("selection",{init(e,t){return e.selection||la.atStart(t.doc)},apply(e){return e.selection}}),new fT("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,s){return s.selection.$cursor?e.storedMarks:null}}),new fT("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class hce{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=v0t.slice(),n&&n.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new fT(s.key,s.spec.state,s))})}}class L4{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let s=0;ss.toJSON())),t&&typeof t=="object")for(let s in t){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[s],o=i.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,s){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new hce(t.schema,t.plugins),o=new L4(i);return i.fields.forEach(l=>{if(l.name=="doc")o.doc=N1.fromJSON(t.schema,n.doc);else if(l.name=="selection")o.selection=la.fromJSON(o.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(s)for(let a in s){let h=s[a],p=h.spec.state;if(h.key==l.name&&p&&p.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[l.name]=p.fromJSON.call(h,t,n[a],o);return}}o[l.name]=l.init(t,o)}}),o}}function XRe(e,t,n){for(let s in e){let i=e[s];i instanceof Function?i=i.bind(t):s=="handleDOMEvents"&&(i=XRe(i,t,{})),n[s]=i}return n}class zd{constructor(t){this.spec=t,this.props={},t.props&&XRe(t.props,this,this.props),this.key=t.key?t.key.key:QRe("plugin")}getState(t){return t[this.key]}}const fce=Object.create(null);function QRe(e){return e in fce?e+"$"+ ++fce[e]:(fce[e]=0,e+"$")}class cf{constructor(t="key"){this.key=QRe(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Ad=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},yC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Fhe=null;const wx=function(e,t,n){let s=Fhe||(Fhe=document.createRange());return s.setEnd(e,n??e.nodeValue.length),s.setStart(e,t||0),s},_0t=function(){Fhe=null},qj=function(e,t,n,s){return n&&(Jke(e,t,n,s,-1)||Jke(e,t,n,s,1))},b0t=/^(img|br|input|textarea|hr)$/i;function Jke(e,t,n,s,i){for(var o;;){if(e==n&&t==s)return!0;if(t==(i<0?0:Rf(e))){let l=e.parentNode;if(!l||l.nodeType!=1||EI(e)||b0t.test(e.nodeName)||e.contentEditable=="false")return!1;t=Ad(e)+(i<0?0:1),e=l}else if(e.nodeType==1){let l=e.childNodes[t+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)t+=i;else return!1;else e=l,t=i<0?Rf(e):0}else return!1}}function Rf(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function w0t(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Rf(e)}else if(e.parentNode&&!EI(e))t=Ad(e),e=e.parentNode;else return null}}function j0t(e,t){for(;;){if(e.nodeType==3&&t2),If=vC||(Ig?/Mac/.test(Ig.platform):!1),tFe=Ig?/Win/.test(Ig.platform):!1,Lx=/Android \d/.test(av),II=!!eNe&&"webkitFontSmoothing"in eNe.documentElement.style,C0t=II?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function M0t(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function px(e,t){return typeof e=="number"?e:e[t]}function T0t(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,s=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*s}}function tNe(e,t,n){let s=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(l.nodeType!=1){l=yC(l);continue}let a=l,h=a==o.body,p=h?M0t(o):T0t(a),x=0,y=0;if(t.topp.bottom-px(s,"bottom")&&(y=t.bottom-t.top>p.bottom-p.top?t.top+px(i,"top")-p.top:t.bottom-p.bottom+px(i,"bottom")),t.leftp.right-px(s,"right")&&(x=t.right-p.right+px(i,"right")),x||y)if(h)o.defaultView.scrollBy(x,y);else{let j=a.scrollLeft,S=a.scrollTop;y&&(a.scrollTop+=y),x&&(a.scrollLeft+=x);let C=a.scrollLeft-j,A=a.scrollTop-S;t={left:t.left-C,top:t.top-A,right:t.right-C,bottom:t.bottom-A}}let w=h?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(w))break;l=w=="absolute"?l.offsetParent:yC(l)}}function A0t(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),s,i;for(let o=(t.left+t.right)/2,l=n+1;l=n-20){s=a,i=h.top;break}}return{refDOM:s,refTop:i,stack:rFe(e.dom)}}function rFe(e){let t=[],n=e.ownerDocument;for(let s=e;s&&(t.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),e!=n);s=yC(s));return t}function E0t({refDOM:e,refTop:t,stack:n}){let s=e?e.getBoundingClientRect().top:0;nFe(n,s==0?0:s-t)}function nFe(e,t){for(let n=0;n=a){l=Math.max(S.bottom,l),a=Math.min(S.top,a);let C=S.left>t.left?S.left-t.left:S.right=(S.left+S.right)/2?1:0));continue}}else S.top>t.top&&!h&&S.left<=t.left&&S.right>=t.left&&(h=x,p={left:Math.max(S.left,Math.min(S.right,t.left)),top:S.top});!n&&(t.left>=S.right&&t.top>=S.top||t.left>=S.left&&t.top>=S.bottom)&&(o=y+1)}}return!n&&h&&(n=h,i=p,s=0),n&&n.nodeType==3?P0t(n,i):!n||s&&n.nodeType==1?{node:e,offset:o}:sFe(n,i)}function P0t(e,t){let n=e.nodeValue.length,s=document.createRange(),i;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return s.detach(),i||{node:e,offset:0}}function qxe(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function L0t(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left(l.left+l.right)/2?1:-1}return e.docView.posFromDOM(s,i,o)}function D0t(e,t,n,s){let i=-1;for(let o=t,l=!1;o!=e.dom;){let a=e.docView.nearestDesc(o,!0),h;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((h=a.dom.getBoundingClientRect()).width||h.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!l&&h.left>s.left||h.top>s.top?i=a.posBefore:(!l&&h.right-1?i:e.docView.posFromDOM(t,n,-1)}function iFe(e,t,n){let s=e.childNodes.length;if(s&&n.topt.top&&i++}let p;II&&i&&s.nodeType==1&&(p=s.childNodes[i-1]).nodeType==1&&p.contentEditable=="false"&&p.getBoundingClientRect().top>=t.top&&i--,s==e.dom&&i==s.childNodes.length-1&&s.lastChild.nodeType==1&&t.top>s.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(i==0||s.nodeType!=1||s.childNodes[i-1].nodeName!="BR")&&(a=D0t(e,s,i,t))}a==null&&(a=O0t(e,l,t));let h=e.docView.nearestDesc(l,!0);return{pos:a,inside:h?h.posAtStart-h.border:-1}}function rNe(e){return e.top=0&&i==s.nodeValue.length?(h--,x=1):n<0?h--:p++,$M(c0(wx(s,h,p),x),x<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Rf(s))){let h=s.childNodes[i-1];if(h.nodeType==1)return pce(h.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==Rf(s))){let h=s.childNodes[i-1],p=h.nodeType==3?wx(h,Rf(h)-(l?0:1)):h.nodeType==1&&(h.nodeName!="BR"||!h.nextSibling)?h:null;if(p)return $M(c0(p,1),!1)}if(o==null&&i=0)}function $M(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function pce(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function oFe(e,t,n){let s=e.state,i=e.root.activeElement;s!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{s!=t&&e.updateState(s),i!=e.dom&&i&&i.focus()}}function z0t(e,t,n){let s=t.selection,i=n=="up"?s.$from:s.$to;return oFe(e,t,()=>{let{node:o}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let l=aFe(e,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let h;if(a.nodeType==1)h=a.getClientRects();else if(a.nodeType==3)h=wx(a,0,a.nodeValue.length).getClientRects();else continue;for(let p=0;px.top+1&&(n=="up"?l.top-x.top>(x.bottom-l.top)*2:x.bottom-l.bottom>(l.bottom-x.top)*2))return!1}}return!0})}const B0t=/[\u0590-\u08ac]/;function $0t(e,t,n){let{$head:s}=t.selection;if(!s.parent.isTextblock)return!1;let i=s.parentOffset,o=!i,l=i==s.parent.content.size,a=e.domSelection();return a?!B0t.test(s.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:l:oFe(e,t,()=>{let{focusNode:h,focusOffset:p,anchorNode:x,anchorOffset:y}=e.domSelectionRange(),w=a.caretBidiLevel;a.modify("move",n,"character");let j=s.depth?e.docView.domAfterPos(s.before()):e.dom,{focusNode:S,focusOffset:C}=e.domSelectionRange(),A=S&&!j.contains(S.nodeType==1?S:S.parentNode)||h==S&&p==C;try{a.collapse(x,y),h&&(h!=x||p!=y)&&a.extend&&a.extend(h,p)}catch{}return w!=null&&(a.caretBidiLevel=w),A}):s.pos==s.start()||s.pos==s.end()}let nNe=null,sNe=null,iNe=!1;function U0t(e,t,n){return nNe==t&&sNe==n?iNe:(nNe=t,sNe=n,iNe=n=="up"||n=="down"?z0t(e,t,n):$0t(e,t,n))}const Xf=0,aNe=1,Bw=2,Pg=3;class PI{constructor(t,n,s,i){this.parent=t,this.children=n,this.dom=s,this.contentDOM=i,this.dirty=Xf,s.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,s){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;nAd(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??s>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let s=!0,i=t;i;i=i.parentNode){let o=this.getDesc(i),l;if(o&&(!n||o.node))if(s&&(l=o.nodeDOM)&&!(l.nodeType==1?l.contains(t.nodeType==1?t:t.parentNode):l==t))s=!1;else return o}}getDesc(t){let n=t.pmViewDesc;for(let s=n;s;s=s.parent)if(s==this)return n}posFromDOM(t,n,s){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,n,s)}return-1}descAt(t){for(let n=0,s=0;nt||l instanceof cFe){i=t-o;break}o=a}if(i)return this.children[s].domFromPos(i-this.children[s].border,n);for(let o;s&&!(o=this.children[s-1]).size&&o instanceof lFe&&o.side>=0;s--);if(n<=0){let o,l=!0;for(;o=s?this.children[s-1]:null,!(!o||o.dom.parentNode==this.contentDOM);s--,l=!1);return o&&n&&l&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Ad(o.dom)+1:0}}else{let o,l=!0;for(;o=s=x&&n<=p-h.border&&h.node&&h.contentDOM&&this.contentDOM.contains(h.contentDOM))return h.parseRange(t,n,x);t=l;for(let y=a;y>0;y--){let w=this.children[y-1];if(w.size&&w.dom.parentNode==this.contentDOM&&!w.emptyChildAt(1)){i=Ad(w.dom)+1;break}t-=w.size}i==-1&&(i=0)}if(i>-1&&(p>n||a==this.children.length-1)){n=p;for(let x=a+1;xS&&ln){let S=a;a=h,h=S}let j=document.createRange();j.setEnd(h.node,h.offset),j.setStart(a.node,a.offset),p.removeAllRanges(),p.addRange(j)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let s=0,i=0;i=s:ts){let a=s+o.border,h=l-o.border;if(t>=a&&n<=h){this.dirty=t==s||n==l?Bw:aNe,t==a&&n==h&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Pg:o.markDirty(t-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Bw:Pg}s=l}this.dirty=Bw}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let s=t==1?Bw:aNe;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(l.nodeType!=1){let a=document.createElement("span");a.appendChild(l),l=a}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(t,[],l,null),this.widget=n,this.widget=n,o=this}matchesWidget(t){return this.dirty==Xf&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class q0t extends PI{constructor(t,n,s,i){super(t,[],n,null),this.textDOM=s,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Vj extends PI{constructor(t,n,s,i,o){super(t,[],s,i),this.mark=n,this.spec=o}static create(t,n,s,i){let o=i.nodeViews[n.type.name],l=o&&o(n,i,s);return(!l||!l.dom)&&(l=ik.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new Vj(t,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Pg||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Pg&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Xf){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=qhe(o,0,t,s));for(let a=0;a{if(!h)return l;if(h.parent)return h.parent.posBeforeChild(h)},s,i),x=p&&p.dom,y=p&&p.contentDOM;if(n.isText){if(!x)x=document.createTextNode(n.text);else if(x.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else x||({dom:x,contentDOM:y}=ik.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!y&&!n.isText&&x.nodeName!="BR"&&(x.hasAttribute("contenteditable")||(x.contentEditable="false"),n.type.spec.draggable&&(x.draggable=!0));let w=x;return x=hFe(x,s,n),p?h=new V0t(t,n,s,i,x,y||null,w,p,o,l+1):n.isText?new Rse(t,n,s,i,x,w,o):new C1(t,n,s,i,x,y||null,w,o,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let s=this.children[n];if(this.dom.contains(s.dom.parentNode)){t.contentElement=s.dom.parentNode;break}}t.contentElement||(t.getContent=()=>yn.empty)}return t}matchesNode(t,n,s){return this.dirty==Xf&&t.eq(this.node)&&Ate(n,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let s=this.node.inlineContent,i=n,o=t.composing?this.localCompositionInfo(t,n):null,l=o&&o.pos>-1?o:null,a=o&&o.pos<0,h=new W0t(this,l&&l.node,t);Z0t(this.node,this.innerDeco,(p,x,y)=>{p.spec.marks?h.syncToMarks(p.spec.marks,s,t):p.type.side>=0&&!y&&h.syncToMarks(x==this.node.childCount?Do.none:this.node.child(x).marks,s,t),h.placeWidget(p,t,i)},(p,x,y,w)=>{h.syncToMarks(p.marks,s,t);let j;h.findNodeMatch(p,x,y,w)||a&&t.state.selection.from>i&&t.state.selection.to-1&&h.updateNodeAt(p,x,y,j,t)||h.updateNextNode(p,x,y,t,w,i)||h.addNode(p,x,y,t,i),i+=p.nodeSize}),h.syncToMarks([],s,t),this.node.isTextblock&&h.addTextblockHacks(),h.destroyRest(),(h.changed||this.dirty==Bw)&&(l&&this.protectLocalComposition(t,l),dFe(this.contentDOM,this.children,t),vC&&Y0t(this.dom))}localCompositionInfo(t,n){let{from:s,to:i}=t.state.selection;if(!(t.state.selection instanceof Ui)||sn+this.node.content.size)return null;let o=t.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,a=X0t(this.node.content,l,s-n,i-n);return a<0?null:{node:o,pos:a,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:s,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let l=new q0t(this,o,n,i);t.input.compositionNodes.push(l),this.children=qhe(this.children,s,s+i.length,t,l)}update(t,n,s,i){return this.dirty==Pg||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,s,i),!0)}updateInner(t,n,s,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=s,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Xf}updateOuterDeco(t){if(Ate(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=uFe(this.dom,this.nodeDOM,Uhe(this.outerDeco,this.node,n),Uhe(t,this.node,n)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function oNe(e,t,n,s,i){hFe(s,t,e);let o=new C1(void 0,e,t,n,s,s,s,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Rse extends C1{constructor(t,n,s,i,o,l,a){super(t,n,s,i,o,null,l,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,s,i){return this.dirty==Pg||this.dirty!=Xf&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Xf||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=Xf,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,s){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,s)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,s){let i=this.node.cut(t,n),o=document.createTextNode(i.text);return new Rse(this.parent,i,this.outerDeco,this.innerDeco,o,o,s)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Pg)}get domAtom(){return!1}isText(t){return this.node.text==t}}class cFe extends PI{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Xf&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class V0t extends C1{constructor(t,n,s,i,o,l,a,h,p,x){super(t,n,s,i,o,l,a,p,x),this.spec=h}update(t,n,s,i){if(this.dirty==Pg)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,n,s);return o&&this.updateInner(t,n,s,i),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,s,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,s,i){this.spec.setSelection?this.spec.setSelection(t,n,s.root):super.setSelection(t,n,s,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function dFe(e,t,n){let s=e.firstChild,i=!1;for(let o=0;o>1,l=Math.min(o,t.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let h=Vj.create(this.top,t[o],n,s);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,s,i){let o=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(t,n,s))o=this.top.children.indexOf(l,this.index);else for(let a=this.index,h=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(s){let p=n.children[s-1];if(p instanceof Vj)n=p,s=p.children.length;else{a=p,s--;break}}else{if(n==t)break e;s=n.parent.children.indexOf(n),n=n.parent}let h=a.node;if(h){if(h!=e.child(i-1))break;--i,o.set(a,i),l.push(a)}}return{index:i,matched:o,matches:l.reverse()}}function K0t(e,t){return e.type.side-t.type.side}function Z0t(e,t,n,s){let i=t.locals(e),o=0;if(i.length==0){for(let p=0;po;)a.push(i[l++]);let S=o+w.nodeSize;if(w.isText){let A=S;l!A.inline):a.slice();s(w,C,t.forChild(o,w),j),o=S}}function Y0t(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function X0t(e,t,n,s){for(let i=0,o=0;i=n){if(o>=s&&h.slice(s-t.length-a,s-a)==t)return s-t.length;let p=a=0&&p+t.length+a>=n)return a+p;if(n==s&&h.length>=s+t.length-a&&h.slice(s-a,s-a+t.length)==t)return s}}return-1}function qhe(e,t,n,s,i){let o=[];for(let l=0,a=0;l=n||x<=t?o.push(h):(pn&&o.push(h.slice(n-p,h.size,s)))}return o}function Vxe(e,t=null){let n=e.domSelectionRange(),s=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&i.size==0,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let a=s.resolve(l),h,p;if(Dse(n)){for(h=l;i&&!i.node;)i=i.parent;let y=i.node;if(i&&y.isAtom&&si.isSelectable(y)&&i.parent&&!(y.isInline&&k0t(n.focusNode,n.focusOffset,i.dom))){let w=i.posBefore;p=new si(l==w?a:s.resolve(w))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let y=l,w=l;for(let j=0;j{(n.anchorNode!=s||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!fFe(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function J0t(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,s=n.nodeName=="IMG";s?t.collapse(n.parentNode,Ad(n)+1):t.collapse(n,0),!s&&!e.state.selection.visible&&yh&&S1<=11&&(n.disabled=!0,n.disabled=!1)}function pFe(e,t){if(t instanceof si){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(hNe(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else hNe(e)}function hNe(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Hxe(e,t,n,s){return e.someProp("createSelectionBetween",i=>i(e,t,n))||Ui.between(t,n,s)}function fNe(e){return e.editable&&!e.hasFocus()?!1:mFe(e)}function mFe(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function e1t(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return qj(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Vhe(e,t){let{$anchor:n,$head:s}=e.selection,i=t>0?n.max(s):n.min(s),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&la.findFrom(o,t)}function y0(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function pNe(e,t,n){let s=e.state.selection;if(s instanceof Ui)if(n.indexOf("s")>-1){let{$head:i}=s,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=e.state.doc.resolve(i.pos+o.nodeSize*(t<0?-1:1));return y0(e,new Ui(s.$anchor,l))}else if(s.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=Vhe(e.state,t);return i&&i instanceof si?y0(e,i):!1}else if(!(If&&n.indexOf("m")>-1)){let i=s.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,l;if(!o||o.isText)return!1;let a=t<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(l=e.docView.descAt(a))&&!l.contentDOM?si.isSelectable(o)?y0(e,new si(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):II?y0(e,new Ui(e.state.doc.resolve(t<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof si&&s.node.isInline)return y0(e,new Ui(t>0?s.$to:s.$from));{let i=Vhe(e.state,t);return i?y0(e,i):!1}}}function Ete(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function hA(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function l4(e,t){return t<0?t1t(e):r1t(e)}function t1t(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let i,o,l=!1;for(Yf&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let a=n.childNodes[s-1];if(hA(a,-1))i=n,o=--s;else if(a.nodeType==3)n=a,s=n.nodeValue.length;else break}}else{if(gFe(n))break;{let a=n.previousSibling;for(;a&&hA(a,-1);)i=n.parentNode,o=Ad(a),a=a.previousSibling;if(a)n=a,s=Ete(n);else{if(n=n.parentNode,n==e.dom)break;s=0}}}l?Hhe(e,n,s):i&&Hhe(e,i,o)}function r1t(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let i=Ete(n),o,l;for(;;)if(s{e.state==i&&Zx(e)},50)}function mNe(e,t){let n=e.state.doc.resolve(t);if(!(cd||tFe)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),l=(o.top+o.bottom)/2;if(l>i.top&&l1)return o.lefti.top&&l1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function gNe(e,t,n){let s=e.state.selection;if(s instanceof Ui&&!s.empty||n.indexOf("s")>-1||If&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=s;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=Vhe(e.state,t);if(l&&l instanceof si)return y0(e,l)}if(!i.parent.inlineContent){let l=t<0?i:o,a=s instanceof ef?la.near(l,t):la.findFrom(l,t);return a?y0(e,a):!1}return!1}function xNe(e,t){if(!(e.state.selection instanceof Ui))return!0;let{$head:n,$anchor:s,empty:i}=e.state.selection;if(!n.sameParent(s))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let l=e.state.tr;return t<0?l.delete(n.pos-o.nodeSize,n.pos):l.delete(n.pos,n.pos+o.nodeSize),e.dispatch(l),!0}return!1}function yNe(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function i1t(e){if(!nu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let s=t.firstChild;yNe(e,s,"true"),setTimeout(()=>yNe(e,s,"false"),20)}return!1}function a1t(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function o1t(e,t){let n=t.keyCode,s=a1t(t);if(n==8||If&&n==72&&s=="c")return xNe(e,-1)||l4(e,-1);if(n==46&&!t.shiftKey||If&&n==68&&s=="c")return xNe(e,1)||l4(e,1);if(n==13||n==27)return!0;if(n==37||If&&n==66&&s=="c"){let i=n==37?mNe(e,e.state.selection.from)=="ltr"?-1:1:-1;return pNe(e,i,s)||l4(e,i)}else if(n==39||If&&n==70&&s=="c"){let i=n==39?mNe(e,e.state.selection.from)=="ltr"?1:-1:1;return pNe(e,i,s)||l4(e,i)}else{if(n==38||If&&n==80&&s=="c")return gNe(e,-1,s)||l4(e,-1);if(n==40||If&&n==78&&s=="c")return i1t(e)||gNe(e,1,s)||l4(e,1);if(s==(If?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Wxe(e,t){e.someProp("transformCopied",j=>{t=j(t,e)});let n=[],{content:s,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){i--,o--;let j=s.firstChild;n.push(j.type.name,j.attrs!=j.type.defaultAttrs?j.attrs:null),s=j.content}let l=e.someProp("clipboardSerializer")||ik.fromSchema(e.state.schema),a=wFe(),h=a.createElement("div");h.appendChild(l.serializeFragment(s,{document:a}));let p=h.firstChild,x,y=0;for(;p&&p.nodeType==1&&(x=bFe[p.nodeName.toLowerCase()]);){for(let j=x.length-1;j>=0;j--){let S=a.createElement(x[j]);for(;h.firstChild;)S.appendChild(h.firstChild);h.appendChild(S),y++}p=h.firstChild}p&&p.nodeType==1&&p.setAttribute("data-pm-slice",`${i} ${o}${y?` -${y}`:""} ${JSON.stringify(n)}`);let w=e.someProp("clipboardTextSerializer",j=>j(t,e))||t.content.textBetween(0,t.content.size,` `);return{dom:h,text:w,slice:t}}function xFe(e,t,n,s,i){let o=i.parent.type.spec.code,l,a;if(!n&&!t)return null;let h=!!t&&(s||o||!n);if(h){if(e.someProp("transformPastedText",w=>{t=w(t,o||s,e)}),o)return a=new fs(yn.from(e.state.schema.text(t.replace(/\r\n?/g,` `))),0,0),e.someProp("transformPasted",w=>{a=w(a,e,!0)}),a;let y=e.someProp("clipboardTextParser",w=>w(t,i,s,e));if(y)a=y;else{let w=i.marks(),{schema:j}=e.state,S=ik.fromSchema(j);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(C=>{let A=l.appendChild(document.createElement("p"));C&&A.appendChild(S.serializeNode(j.text(C,w)))})}}else e.someProp("transformPastedHTML",y=>{n=y(n,e)}),l=u1t(n),II&&h1t(l);let p=l&&l.querySelector("[data-pm-slice]"),x=p&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute("data-pm-slice")||"");if(x&&x[3])for(let y=+x[3];y>0;y--){let w=l.firstChild;for(;w&&w.nodeType!=1;)w=w.nextSibling;if(!w)break;l=w}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||cA.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(h||x),context:i,ruleFromNode(w){return w.nodeName=="BR"&&!w.nextSibling&&w.parentNode&&!l1t.test(w.parentNode.nodeName)?{ignore:!0}:null}})),x)a=f1t(vNe(a,+x[1],+x[2]),x[4]);else if(a=fs.maxOpen(c1t(a.content,i),!0),a.openStart||a.openEnd){let y=0,w=0;for(let j=a.content.firstChild;y{a=y(a,e,h)}),a}const l1t=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function c1t(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),o,l=[];if(e.forEach(a=>{if(!l)return;let h=i.findWrapping(a.type),p;if(!h)return l=null;if(p=l.length&&o.length&&vFe(h,o,a,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=_Fe(l[l.length-1],o.length));let x=yFe(a,h);l.push(x),i=i.matchType(x.type),o=h}}),l)return yn.from(l)}return e}function yFe(e,t,n=0){for(let s=t.length-1;s>=n;s--)e=t[s].create(null,yn.from(e));return e}function vFe(e,t,n,s,i){if(i1&&(o=0),i=n&&(a=t<0?l.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(yn.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(a))}function vNe(e,t,n){return tn})),gce.createHTML(e)):e}function u1t(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=wFe().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),i;if((i=s&&bFe[s[1].toLowerCase()])&&(e=i.map(o=>"<"+o+">").join("")+e+i.map(o=>"").reverse().join("")),n.innerHTML=d1t(e),i)for(let o=0;o=0;a-=2){let h=n.nodes[s[a]];if(!h||h.hasRequiredAttrs())break;i=yn.from(h.create(s[a+1],i)),o++,l++}return new fs(i,o,l)}const Du={},Ru={},p1t={touchstart:!0,touchmove:!0};class m1t{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function g1t(e){for(let t in Du){let n=Du[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=s=>{y1t(e,s)&&!Gxe(e,s)&&(e.editable||!(s.type in Ru))&&n(e,s)},p1t[t]?{passive:!0}:void 0)}nu&&e.dom.addEventListener("input",()=>null),Ghe(e)}function G0(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function x1t(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Ghe(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=s=>Gxe(e,s))})}function Gxe(e,t){return e.someProp("handleDOMEvents",n=>{let s=n[t.type];return s?s(e,t)||t.defaultPrevented:!1})}function y1t(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function v1t(e,t){!Gxe(e,t)&&Du[t.type]&&(e.editable||!(t.type in Ru))&&Du[t.type](e,t)}Ru.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!kFe(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Lx&&cd&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),vC&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let s=Date.now();e.input.lastIOSEnter=s,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==s&&(e.someProp("handleKeyDown",i=>i(e,Ew(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",s=>s(e,n))||o1t(e,n)?n.preventDefault():G0(e,"key")};Ru.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Ru.keypress=(e,t)=>{let n=t;if(kFe(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||If&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let s=e.state.selection;if(!(s instanceof Ui)||!s.$from.sameParent(s.$to)){let i=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",l=>l(e,s.$from.pos,s.$to.pos,i,o))&&e.dispatch(o()),n.preventDefault()}};function Fse(e){return{left:e.clientX,top:e.clientY}}function _1t(e,t){let n=t.x-e.clientX,s=t.y-e.clientY;return n*n+s*s<100}function Kxe(e,t,n,s,i){if(s==-1)return!1;let o=e.state.doc.resolve(s);for(let l=o.depth+1;l>0;l--)if(e.someProp(t,a=>l>o.depth?a(e,n,o.nodeAfter,o.before(l),i,!0):a(e,n,o.node(l),o.before(l),i,!1)))return!0;return!1}function ES(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let s=e.state.tr.setSelection(t);s.setMeta("pointer",!0),e.dispatch(s)}function b1t(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),s=n.nodeAfter;return s&&s.isAtom&&si.isSelectable(s)?(ES(e,new si(n)),!0):!1}function w1t(e,t){if(t==-1)return!1;let n=e.state.selection,s,i;n instanceof si&&(s=n.node);let o=e.state.doc.resolve(t);for(let l=o.depth+1;l>0;l--){let a=l>o.depth?o.nodeAfter:o.node(l);if(si.isSelectable(a)){s&&n.$from.depth>0&&l>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(l);break}}return i!=null?(ES(e,si.create(e.state.doc,i)),!0):!1}function j1t(e,t,n,s,i){return Kxe(e,"handleClickOn",t,n,s)||e.someProp("handleClick",o=>o(e,t,s))||(i?w1t(e,n):b1t(e,n))}function k1t(e,t,n,s){return Kxe(e,"handleDoubleClickOn",t,n,s)||e.someProp("handleDoubleClick",i=>i(e,t,s))}function N1t(e,t,n,s){return Kxe(e,"handleTripleClickOn",t,n,s)||e.someProp("handleTripleClick",i=>i(e,t,s))||S1t(e,n,s)}function S1t(e,t,n){if(n.button!=0)return!1;let s=e.state.doc;if(t==-1)return s.inlineContent?(ES(e,Ui.create(s,0,s.content.size)),!0):!1;let i=s.resolve(t);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(l.inlineContent)ES(e,Ui.create(s,a+1,a+1+l.content.size));else if(si.isSelectable(l))ES(e,si.create(s,a));else continue;return!0}}function Zxe(e){return Ite(e)}const jFe=If?"metaKey":"ctrlKey";Du.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let s=Zxe(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&_1t(n,e.input.lastClick)&&!n[jFe]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let l=e.posAtCoords(Fse(n));l&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new C1t(e,l,n,!!s)):(o=="doubleClick"?k1t:N1t)(e,l.pos,l.inside,n)?n.preventDefault():G0(e,"pointer"))};class C1t{constructor(t,n,s,i){this.view=t,this.pos=n,this.event=s,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!s[jFe],this.allowDefault=s.shiftKey;let o,l;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),l=n.inside;else{let x=t.state.doc.resolve(n.pos);o=x.parent,l=x.depth?x.before():0}const a=i?null:s.target,h=a?t.docView.nearestDesc(a,!0):null;this.target=h&&h.nodeDOM.nodeType==1?h.nodeDOM:null;let{selection:p}=t.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||p instanceof si&&p.from<=l&&p.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Yf&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),G0(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Zx(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fse(t))),this.updateAllowDefault(t),this.allowDefault||!n?G0(this.view,"pointer"):j1t(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||nu&&this.mightDrag&&!this.mightDrag.node.isAtom||cd&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ES(this.view,la.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):G0(this.view,"pointer")}move(t){this.updateAllowDefault(t),G0(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Du.touchstart=e=>{e.input.lastTouch=Date.now(),Zxe(e),G0(e,"pointer")};Du.touchmove=e=>{e.input.lastTouch=Date.now(),G0(e,"pointer")};Du.contextmenu=e=>Zxe(e);function kFe(e,t){return e.composing?!0:nu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const M1t=Lx?5e3:-1;Ru.compositionstart=Ru.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Ui&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||cd&&tFe&&T1t(e)))e.markCursor=e.state.storedMarks||n.marks(),Ite(e,!0),e.markCursor=null;else if(Ite(e,!t.selection.empty),Yf&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=e.domSelectionRange();for(let i=s.focusNode,o=s.focusOffset;i&&i.nodeType==1&&o!=0;){let l=o<0?i.lastChild:i.childNodes[o-1];if(!l)break;if(l.nodeType==3){let a=e.domSelection();a&&a.collapse(l,l.nodeValue.length);break}else i=l,o=-1}}e.input.composing=!0}NFe(e,M1t)};function T1t(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let s=t.childNodes[n];return s.nodeType==1&&s.contentEditable=="false"}Ru.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,NFe(e,20))};function NFe(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Ite(e),t))}function SFe(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=E1t());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function A1t(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=w0t(t.focusNode,t.focusOffset),s=j0t(t.focusNode,t.focusOffset);if(n&&s&&n!=s){let i=s.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||s==o)return o;if(!i||!i.isText(s.nodeValue))return s;if(e.input.compositionNode==s){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return s}}return n||s}function E1t(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Ite(e,t=!1){if(!(Lx&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),SFe(e),t||e.docView&&e.docView.dirty){let n=Vxe(e),s=e.state.selection;return n&&!n.eq(s)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function I1t(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),s.removeAllRanges(),s.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const lE=yh&&S1<15||vC&&C0t<604;Du.copy=Ru.cut=(e,t)=>{let n=t,s=e.state.selection,i=n.type=="cut";if(s.empty)return;let o=lE?null:n.clipboardData,l=s.content(),{dom:a,text:h}=Wxe(e,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",h)):I1t(e,a),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function P1t(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function L1t(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,s=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),s.parentNode&&s.parentNode.removeChild(s),n?cE(e,s.value,null,i,t):cE(e,s.textContent,s.innerHTML,i,t)},50)}function cE(e,t,n,s,i){let o=xFe(e,t,n,s,e.state.selection.$from);if(e.someProp("handlePaste",h=>h(e,i,o||fs.empty)))return!0;if(!o)return!1;let l=P1t(o),a=l?e.state.tr.replaceSelectionWith(l,s):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function CFe(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ru.paste=(e,t)=>{let n=t;if(e.composing&&!Lx)return;let s=lE?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;s&&cE(e,CFe(s),s.getData("text/html"),i,n)?n.preventDefault():L1t(e,n)};class MFe{constructor(t,n,s){this.slice=t,this.move=n,this.node=s}}const O1t=If?"altKey":"ctrlKey";function TFe(e,t){let n=e.someProp("dragCopies",s=>!s(t));return n??!t[O1t]}Du.dragstart=(e,t)=>{let n=t,s=e.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(Fse(n)),l;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof si?i.to-1:i.to))){if(s&&s.mightDrag)l=si.create(e.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let y=e.docView.nearestDesc(n.target,!0);y&&y.node.type.spec.draggable&&y!=e.docView&&(l=si.create(e.state.doc,y.posBefore))}}let a=(l||e.state.selection).content(),{dom:h,text:p,slice:x}=Wxe(e,a);(!n.dataTransfer.files.length||!cd||eFe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(lE?"Text":"text/html",h.innerHTML),n.dataTransfer.effectAllowed="copyMove",lE||n.dataTransfer.setData("text/plain",p),e.dragging=new MFe(x,TFe(e,n),l)};Du.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Ru.dragover=Ru.dragenter=(e,t)=>t.preventDefault();Ru.drop=(e,t)=>{try{D1t(e,t,e.dragging)}finally{e.dragging=null}};function D1t(e,t,n){if(!t.dataTransfer)return;let s=e.posAtCoords(Fse(t));if(!s)return;let i=e.state.doc.resolve(s.pos),o=n&&n.slice;o?e.someProp("transformPasted",j=>{o=j(o,e,!1)}):o=xFe(e,CFe(t.dataTransfer),lE?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&TFe(e,t));if(e.someProp("handleDrop",j=>j(e,t,o||fs.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?HRe(e.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let h=e.state.tr;if(l){let{node:j}=n;j?j.replace(h):h.deleteSelection()}let p=h.mapping.map(a),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=h.doc;if(x?h.replaceRangeWith(p,p,o.content.firstChild):h.replaceRange(p,p,o),h.doc.eq(y))return;let w=h.doc.resolve(p);if(x&&si.isSelectable(o.content.firstChild)&&w.nodeAfter&&w.nodeAfter.sameMarkup(o.content.firstChild))h.setSelection(new si(w));else{let j=h.mapping.map(a);h.mapping.maps[h.mapping.maps.length-1].forEach((S,C,A,E)=>j=E),h.setSelection(Hxe(e,w,h.doc.resolve(j)))}e.focus(),e.dispatch(h.setMeta("uiEvent","drop"))}Du.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Zx(e)},20))};Du.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Du.beforeinput=(e,t)=>{if(cd&&Lx&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:s}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=s||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,Ew(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in Ru)Du[e]=Ru[e];function dE(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Pte{constructor(t,n){this.toDOM=t,this.spec=n||wj,this.side=this.spec.side||0}map(t,n,s,i){let{pos:o,deleted:l}=t.mapResult(n.from+i,this.side<0?-1:1);return l?null:new Bf(o-s,o-s,this)}valid(){return!0}eq(t){return this==t||t instanceof Pte&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&dE(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class M1{constructor(t,n){this.attrs=t,this.spec=n||wj}map(t,n,s,i){let o=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-s,l=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-s;return o>=l?null:new Bf(o,l,this)}valid(t,n){return n.from=t&&(!o||o(a.spec))&&s.push(a.copy(a.from+i,a.to+i))}for(let l=0;lt){let a=this.children[l]+1;this.children[l+2].findInner(t-a,n-a,s,i+a,o)}}map(t,n,s){return this==Gd||t.maps.length==0?this:this.mapInner(t,n,0,0,s||wj)}mapInner(t,n,s,i,o){let l;for(let a=0;a{let p=h+s,x;if(x=EFe(n,a,p)){for(i||(i=this.children.slice());oa&&y.to=t){this.children[a]==t&&(s=this.children[a+2]);break}let o=t+1,l=o+n.content.size;for(let a=0;ao&&h.type instanceof M1){let p=Math.max(o,h.from)-o,x=Math.min(l,h.to)-o;pi.map(t,n,wj));return S0.from(s)}forChild(t,n){if(n.isLeaf)return Fc.empty;let s=[];for(let i=0;in instanceof Fc)?t:t.reduce((n,s)=>n.concat(s instanceof Fc?s:s.members),[]))}}forEachSet(t){for(let n=0;n{let A=C-S-(j-w);for(let E=0;ET+x-y)continue;let O=a[E]+x-y;j>=O?a[E+1]=w<=O?-2:-1:w>=x&&A&&(a[E]+=A,a[E+1]+=A)}y+=A}),x=n.maps[p].map(x,-1)}let h=!1;for(let p=0;p=s.content.size){h=!0;continue}let w=n.map(e[p+1]+o,-1),j=w-i,{index:S,offset:C}=s.content.findIndex(y),A=s.maybeChild(S);if(A&&C==y&&C+A.nodeSize==j){let E=a[p+2].mapInner(n,A,x+1,e[p]+o+1,l);E!=Gd?(a[p]=y,a[p+1]=j,a[p+2]=E):(a[p+1]=-2,h=!0)}else h=!0}if(h){let p=F1t(a,e,t,n,i,o,l),x=Lte(p,s,0,l);t=x.local;for(let y=0;yn&&l.to{let p=EFe(e,a,h+n);if(p){o=!0;let x=Lte(p,a,n+h+1,s);x!=Gd&&i.push(h,h+a.nodeSize,x)}});let l=AFe(o?IFe(e):e,-n).sort(jj);for(let a=0;a0;)t++;e.splice(t,0,n)}function xce(e){let t=[];return e.someProp("decorations",n=>{let s=n(e.state);s&&s!=Gd&&t.push(s)}),e.cursorWrapper&&t.push(Fc.create(e.state.doc,[e.cursorWrapper.deco])),S0.from(t)}const z1t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},B1t=yh&&S1<=11;class $1t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class U1t{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new $1t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),B1t&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,z1t)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(fNe(this.view)){if(this.suppressingSelectionUpdates)return Zx(this.view);if(yh&&S1<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&qj(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,s;for(let o=t.focusNode;o;o=yC(o))n.add(o);for(let o=t.anchorNode;o;o=yC(o))if(n.has(o)){s=o;break}let i=s&&this.view.docView.nearestDesc(s);if(i&&i.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let s=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&fNe(t)&&!this.ignoreSelectionChange(s),o=-1,l=-1,a=!1,h=[];if(t.editable)for(let x=0;xy.nodeName=="BR");if(x.length==2){let[y,w]=x;y.parentNode&&y.parentNode.parentNode==w.parentNode?w.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let w of x){let j=w.parentNode;j&&j.nodeName=="LI"&&(!y||H1t(t,y)!=j)&&w.remove()}}}else if((cd||nu)&&h.some(x=>x.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let x of h)if(x.nodeName=="BR"&&x.parentNode){let y=x.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&x.parentNode.removeChild(x)}}let p=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(o>-1&&(t.docView.markDirty(o,l),q1t(t)),this.handleDOMChange(o,l,a,h),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(s)||Zx(t),this.currentSelection.set(s))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let s=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(s==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!s||s.ignoreMutation(t))return null;if(t.type=="childList"){for(let x=0;xi;A--){let E=s.childNodes[A-1],T=E.pmViewDesc;if(E.nodeName=="BR"&&!T){o=A;break}if(!T||T.size)break}let y=e.state.doc,w=e.someProp("domParser")||cA.fromSchema(e.state.schema),j=y.resolve(l),S=null,C=w.parse(s,{topNode:j.parent,topMatch:j.parent.contentMatchAt(j.index()),topOpen:!0,from:i,to:o,preserveWhitespace:j.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:G1t,context:j});if(p&&p[0].pos!=null){let A=p[0].pos,E=p[1]&&p[1].pos;E==null&&(E=A),S={anchor:A+l,head:E+l}}return{doc:C,sel:S,from:l,to:a}}function G1t(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(nu&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||nu&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const K1t=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Z1t(e,t,n,s,i){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let H=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,K=Vxe(e,H);if(K&&!e.state.selection.eq(K)){if(cd&&Lx&&e.input.lastKeyCode===13&&Date.now()-100re(e,Ew(13,"Enter"))))return;let Z=e.state.tr.setSelection(K);H=="pointer"?Z.setMeta("pointer",!0):H=="key"&&Z.scrollIntoView(),o&&Z.setMeta("composition",o),e.dispatch(Z)}return}let l=e.state.doc.resolve(t),a=l.sharedDepth(n);t=l.before(a+1),n=e.state.doc.resolve(n).after(a+1);let h=e.state.selection,p=W1t(e,t,n),x=e.state.doc,y=x.slice(p.from,p.to),w,j;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Lx)&&i.some(H=>H.nodeType==1&&!K1t.test(H.nodeName))&&(!S||S.endA>=S.endB)&&e.someProp("handleKeyDown",H=>H(e,Ew(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!S)if(s&&h instanceof Ui&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))S={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let H=NNe(e,e.state.doc,p.sel);if(H&&!H.eq(e.state.selection)){let K=e.state.tr.setSelection(H);o&&K.setMeta("composition",o),e.dispatch(K)}}return}e.state.selection.frome.state.selection.from&&S.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?S.start=e.state.selection.from:S.endA=e.state.selection.to-2&&e.state.selection.to<=p.to&&(S.endB+=e.state.selection.to-S.endA,S.endA=e.state.selection.to)),yh&&S1<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>p.from&&p.doc.textBetween(S.start-p.from-1,S.start-p.from+1)=="  "&&(S.start--,S.endA--,S.endB--);let C=p.doc.resolveNoCache(S.start-p.from),A=p.doc.resolveNoCache(S.endB-p.from),E=x.resolve(S.start),T=C.sameParent(A)&&C.parent.inlineContent&&E.end()>=S.endA;if((vC&&e.input.lastIOSEnter>Date.now()-225&&(!T||i.some(H=>H.nodeName=="DIV"||H.nodeName=="P"))||!T&&C.posH(e,Ew(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>S.start&&X1t(x,S.start,S.endA,C,A)&&e.someProp("handleKeyDown",H=>H(e,Ew(8,"Backspace")))){Lx&&cd&&e.domObserver.suppressSelectionUpdates();return}cd&&S.endB==S.start&&(e.input.lastChromeDelete=Date.now()),Lx&&!T&&C.start()!=A.start()&&A.parentOffset==0&&C.depth==A.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==S.endA&&(S.endB-=2,A=p.doc.resolveNoCache(S.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(H){return H(e,Ew(13,"Enter"))})},20));let O=S.start,z=S.endA,F=H=>{let K=H||e.state.tr.replace(O,z,p.doc.slice(S.start-p.from,S.endB-p.from));if(p.sel){let Z=NNe(e,K.doc,p.sel);Z&&!(cd&&e.composing&&Z.empty&&(S.start!=S.endB||e.input.lastChromeDeleteZx(e),20));let H=F(e.state.tr.delete(O,z)),K=x.resolve(S.start).marksAcross(x.resolve(S.endA));K&&H.ensureMarks(K),e.dispatch(H)}else if(S.endA==S.endB&&(q=Y1t(C.parent.content.cut(C.parentOffset,A.parentOffset),E.parent.content.cut(E.parentOffset,S.endA-E.start())))){let H=F(e.state.tr);q.type=="add"?H.addMark(O,z,q.mark):H.removeMark(O,z,q.mark),e.dispatch(H)}else if(C.parent.child(C.index()).isText&&C.index()==A.index()-(A.textOffset?0:1)){let H=C.parent.textBetween(C.parentOffset,A.parentOffset),K=()=>F(e.state.tr.insertText(H,O,z));e.someProp("handleTextInput",Z=>Z(e,O,z,H,K))||e.dispatch(K())}else e.dispatch(F());else e.dispatch(F())}function NNe(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Hxe(e,t.resolve(n.anchor),t.resolve(n.head))}function Y1t(e,t){let n=e.firstChild.marks,s=t.firstChild.marks,i=n,o=s,l,a,h;for(let x=0;xx.mark(a.addToSet(x.marks));else if(i.length==0&&o.length==1)a=o[0],l="remove",h=x=>x.mark(a.removeFromSet(x.marks));else return null;let p=[];for(let x=0;xn||yce(l,!0,!1)0&&(t||e.indexAfter(s)==e.node(s).childCount);)s--,i++,t=!1;if(n){let o=e.node(s).maybeChild(e.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Q1t(e,t,n,s,i){let o=e.findDiffStart(t,n);if(o==null)return null;let{a:l,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(i=="end"){let h=Math.max(0,o-Math.min(l,a));s-=l+h-o}if(l=l?o-s:0;o-=h,o&&o=a?o-s:0;o-=h,o&&o=56320&&t<=57343&&n>=55296&&n<=56319}class PFe{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new m1t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ENe),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=TNe(this),MNe(this),this.nodeViews=ANe(this),this.docView=oNe(this.state.doc,CNe(this),xce(this),this.dom,this),this.domObserver=new U1t(this,(s,i,o,l)=>Z1t(this,s,i,o,l)),this.domObserver.start(),g1t(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Ghe(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(ENe),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let s in this._props)n[s]=this._props[s];n.state=this.state;for(let s in t)n[s]=t[s];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var s;let i=this.state,o=!1,l=!1;t.storedMarks&&this.composing&&(SFe(this),l=!0),this.state=t;let a=i.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let j=ANe(this);evt(j,this.nodeViews)&&(this.nodeViews=j,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ghe(this),this.editable=TNe(this),MNe(this);let h=xce(this),p=CNe(this),x=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",y=o||!this.docView.matchesNode(t.doc,p,h);(y||!t.selection.eq(i.selection))&&(l=!0);let w=x=="preserve"&&l&&this.dom.style.overflowAnchor==null&&A0t(this);if(l){this.domObserver.stop();let j=y&&(yh||cd)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&J1t(i.selection,t.selection);if(y){let S=cd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=A1t(this)),(o||!this.docView.update(t.doc,p,h,this))&&(this.docView.updateOuterDeco(p),this.docView.destroy(),this.docView=oNe(t.doc,p,h,this.dom,this)),S&&!this.trackWrites&&(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&e1t(this))?Zx(this,j):(pFe(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((s=this.dragging)===null||s===void 0)&&s.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),x=="reset"?this.dom.scrollTop=0:x=="to selection"?this.scrollToSelection():w&&E0t(w)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof si){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&tNe(this,n.getBoundingClientRect(),t)}else tNe(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==s.node&&(i=o)}this.dragging=new MFe(t.slice,t.move,i<0?void 0:si.create(this.state.doc,i))}someProp(t,n){let s=this._props&&this._props[t],i;if(s!=null&&(i=n?n(s):s))return i;for(let l=0;ln.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return R0t(this,t)}coordsAtPos(t,n=1){return aFe(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,s=-1){let i=this.docView.posFromDOM(t,n,s);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return U0t(this,n||this.state,t)}pasteHTML(t,n){return cE(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return cE(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Wxe(this,t)}destroy(){this.docView&&(x1t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],xce(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_0t())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return v1t(this,t)}domSelectionRange(){let t=this.domSelection();return t?nu&&this.root.nodeType===11&&N0t(this.dom.ownerDocument)==this.dom&&V1t(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}PFe.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function CNe(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let s in n)s=="class"?t.class+=" "+n[s]:s=="style"?t.style=(t.style?t.style+";":"")+n[s]:!t[s]&&s!="contenteditable"&&s!="nodeName"&&(t[s]=String(n[s]))}),t.translate||(t.translate="no"),[Bf.node(0,e.state.doc.content.size,t)]}function MNe(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Bf.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function TNe(e){return!e.someProp("editable",t=>t(e.state)===!1)}function J1t(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function ANe(e){let t=Object.create(null);function n(s){for(let i in s)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=s[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function evt(e,t){let n=0,s=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)s++;return n!=s}function ENe(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var G1={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ote={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tvt=typeof navigator<"u"&&/Mac/.test(navigator.platform),rvt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ed=0;Ed<10;Ed++)G1[48+Ed]=G1[96+Ed]=String(Ed);for(var Ed=1;Ed<=24;Ed++)G1[Ed+111]="F"+Ed;for(var Ed=65;Ed<=90;Ed++)G1[Ed]=String.fromCharCode(Ed+32),Ote[Ed]=String.fromCharCode(Ed);for(var vce in G1)Ote.hasOwnProperty(vce)||(Ote[vce]=G1[vce]);function nvt(e){var t=tvt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||rvt&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Ote:G1)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const svt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ivt=typeof navigator<"u"&&/Win/.test(navigator.platform);function avt(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let s,i,o,l;for(let a=0;ae.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function OFe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const DFe=(e,t,n)=>{let s=OFe(e,n);if(!s)return!1;let i=Jxe(s);if(!i){let l=s.blockRange(),a=l&&p3(l);return a==null?!1:(t&&t(e.tr.lift(l,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(HFe(e,i,t,-1))return!0;if(s.parent.content.size==0&&(_C(o,"end")||si.isSelectable(o)))for(let l=s.depth;;l--){let a=Lse(e.doc,s.before(l),s.after(l),fs.empty);if(a&&a.slice.size1)break}return o.isAtom&&i.depth==s.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},cvt=(e,t,n)=>{let s=OFe(e,n);if(!s)return!1;let i=Jxe(s);return i?RFe(e,i,t):!1},dvt=(e,t,n)=>{let s=zFe(e,n);if(!s)return!1;let i=eye(s);return i?RFe(e,i,t):!1};function RFe(e,t,n){let s=t.nodeBefore,i=s,o=t.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let x=i.lastChild;if(!x)return!1;i=x}let l=t.nodeAfter,a=l,h=t.pos+1;for(;!a.isTextblock;h++){if(a.type.spec.isolating)return!1;let x=a.firstChild;if(!x)return!1;a=x}let p=Lse(e.doc,o,h,fs.empty);if(!p||p.from!=o||p instanceof od&&p.slice.size>=h-o)return!1;if(n){let x=e.tr.step(p);x.setSelection(Ui.create(x.doc,o)),n(x.scrollIntoView())}return!0}function _C(e,t,n=!1){for(let s=e;s;s=t=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(n&&s.childCount!=1)return!1}return!1}const FFe=(e,t,n)=>{let{$head:s,empty:i}=e.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):s.parentOffset>0)return!1;o=Jxe(s)}let l=o&&o.nodeBefore;return!l||!si.isSelectable(l)?!1:(t&&t(e.tr.setSelection(si.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function Jxe(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function zFe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset{let s=zFe(e,n);if(!s)return!1;let i=eye(s);if(!i)return!1;let o=i.nodeAfter;if(HFe(e,i,t,1))return!0;if(s.parent.content.size==0&&(_C(o,"start")||si.isSelectable(o))){let l=Lse(e.doc,s.before(),s.after(),fs.empty);if(l&&l.slice.size{let{$head:s,empty:i}=e.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):s.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let n=e.selection,s=n instanceof si,i;if(s){if(n.node.isTextblock||!iv(e.doc,n.from))return!1;i=n.from}else if(i=Pse(e.doc,n.from,-1),i==null)return!1;if(t){let o=e.tr.join(i);s&&o.setSelection(si.create(o.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},hvt=(e,t)=>{let n=e.selection,s;if(n instanceof si){if(n.node.isTextblock||!iv(e.doc,n.to))return!1;s=n.to}else if(s=Pse(e.doc,n.to,1),s==null)return!1;return t&&t(e.tr.join(s).scrollIntoView()),!0},fvt=(e,t)=>{let{$from:n,$to:s}=e.selection,i=n.blockRange(s),o=i&&p3(i);return o==null?!1:(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)},UFe=(e,t)=>{let{$head:n,$anchor:s}=e.selection;return!n.parent.type.spec.code||!n.sameParent(s)?!1:(t&&t(e.tr.insertText(` `).scrollIntoView()),!0)};function tye(e){for(let t=0;t{let{$head:n,$anchor:s}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(s))return!1;let i=n.node(-1),o=n.indexAfter(-1),l=tye(i.contentMatchAt(o));if(!l||!i.canReplaceWith(o,o,l))return!1;if(t){let a=n.after(),h=e.tr.replaceWith(a,a,l.createAndFill());h.setSelection(la.near(h.doc.resolve(a),1)),t(h.scrollIntoView())}return!0},qFe=(e,t)=>{let n=e.selection,{$from:s,$to:i}=n;if(n instanceof ef||s.parent.inlineContent||i.parent.inlineContent)return!1;let o=tye(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let l=(!s.parentOffset&&i.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Kx(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),i=s&&p3(s);return i==null?!1:(t&&t(e.tr.lift(s,i).scrollIntoView()),!0)};function mvt(e){return(t,n)=>{let{$from:s,$to:i}=t.selection;if(t.selection instanceof si&&t.selection.node.isBlock)return!s.parentOffset||!Kx(t.doc,s.pos)?!1:(n&&n(t.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],l,a,h=!1,p=!1;for(let j=s.depth;;j--)if(s.node(j).isBlock){h=s.end(j)==s.pos+(s.depth-j),p=s.start(j)==s.pos-(s.depth-j),a=tye(s.node(j-1).contentMatchAt(s.indexAfter(j-1))),o.unshift(h&&a?{type:a}:null),l=j;break}else{if(j==1)return!1;o.unshift(null)}let x=t.tr;(t.selection instanceof Ui||t.selection instanceof ef)&&x.deleteSelection();let y=x.mapping.map(s.pos),w=Kx(x.doc,y,o.length,o);if(w||(o[0]=a?{type:a}:null,w=Kx(x.doc,y,o.length,o)),!w)return!1;if(x.split(y,o.length,o),!h&&p&&s.node(l).type!=a){let j=x.mapping.map(s.before(l)),S=x.doc.resolve(j);a&&s.node(l-1).canReplaceWith(S.index(),S.index()+1,a)&&x.setNodeMarkup(x.mapping.map(s.before(l)),a)}return n&&n(x.scrollIntoView()),!0}}const gvt=mvt(),xvt=(e,t)=>{let{$from:n,to:s}=e.selection,i,o=n.sharedDepth(s);return o==0?!1:(i=n.before(o),t&&t(e.tr.setSelection(si.create(e.doc,i))),!0)};function yvt(e,t,n){let s=t.nodeBefore,i=t.nodeAfter,o=t.index();return!s||!i||!s.type.compatibleContent(i.type)?!1:!s.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-s.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||iv(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function HFe(e,t,n,s){let i=t.nodeBefore,o=t.nodeAfter,l,a,h=i.type.spec.isolating||o.type.spec.isolating;if(!h&&yvt(e,t,n))return!0;let p=!h&&t.parent.canReplace(t.index(),t.index()+1);if(p&&(l=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(l[0]||o.type).validEnd){if(n){let j=t.pos+o.nodeSize,S=yn.empty;for(let E=l.length-1;E>=0;E--)S=yn.from(l[E].create(null,S));S=yn.from(i.copy(S));let C=e.tr.step(new fd(t.pos-1,j,t.pos,j,new fs(S,1,0),l.length,!0)),A=C.doc.resolve(j+2*l.length);A.nodeAfter&&A.nodeAfter.type==i.type&&iv(C.doc,A.pos)&&C.join(A.pos),n(C.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&h?null:la.findFrom(t,1),y=x&&x.$from.blockRange(x.$to),w=y&&p3(y);if(w!=null&&w>=t.depth)return n&&n(e.tr.lift(y,w).scrollIntoView()),!0;if(p&&_C(o,"start",!0)&&_C(i,"end")){let j=i,S=[];for(;S.push(j),!j.isTextblock;)j=j.lastChild;let C=o,A=1;for(;!C.isTextblock;C=C.firstChild)A++;if(j.canReplace(j.childCount,j.childCount,C.content)){if(n){let E=yn.empty;for(let O=S.length-1;O>=0;O--)E=yn.from(S[O].copy(E));let T=e.tr.step(new fd(t.pos-S.length,t.pos+o.nodeSize,t.pos+A,t.pos+o.nodeSize-A,new fs(E,S.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function WFe(e){return function(t,n){let s=t.selection,i=e<0?s.$from:s.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(t.tr.setSelection(Ui.create(t.doc,e<0?i.start(o):i.end(o)))),!0):!1}}const vvt=WFe(-1),_vt=WFe(1);function bvt(e,t=null){return function(n,s){let{$from:i,$to:o}=n.selection,l=i.blockRange(o),a=l&&$xe(l,e,t);return a?(s&&s(n.tr.wrap(l,a).scrollIntoView()),!0):!1}}function INe(e,t=null){return function(n,s){let i=!1;for(let o=0;o{if(i)return!1;if(!(!h.isTextblock||h.hasMarkup(e,t)))if(h.type==e)i=!0;else{let x=n.doc.resolve(p),y=x.index();i=x.parent.canReplaceWith(y,y+1,e)}})}if(!i)return!1;if(s){let o=n.tr;for(let l=0;l=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let h=l.resolve(t.start-2);o=new Mte(h,h,t.depth),t.endIndex=0;x--)o=yn.from(n[x].type.create(n[x].attrs,o));e.step(new fd(t.start-(s?2:0),t.end,t.start,t.end,new fs(o,0,0),n.length,!0));let l=0;for(let x=0;xl.childCount>0&&l.firstChild.type==e);return o?n?s.node(o.depth-1).type==e?Svt(t,n,e,o):Cvt(t,n,o):!0:!1}}function Svt(e,t,n,s){let i=e.tr,o=s.end,l=s.$to.end(s.depth);oC;S--)j-=i.child(S).nodeSize,s.delete(j-1,j+1);let o=s.doc.resolve(n.start),l=o.nodeAfter;if(s.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,h=n.endIndex==i.childCount,p=o.node(-1),x=o.index(-1);if(!p.canReplace(x+(a?0:1),x+1,l.content.append(h?yn.empty:yn.from(i))))return!1;let y=o.pos,w=y+l.nodeSize;return s.step(new fd(y-(a?1:0),w+(h?1:0),y+1,w-1,new fs((a?yn.empty:yn.from(i.copy(yn.empty))).append(h?yn.empty:yn.from(i.copy(yn.empty))),a?0:1,h?0:1),a?0:1)),t(s.scrollIntoView()),!0}function Mvt(e){return function(t,n){let{$from:s,$to:i}=t.selection,o=s.blockRange(i,p=>p.childCount>0&&p.firstChild.type==e);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let a=o.parent,h=a.child(l-1);if(h.type!=e)return!1;if(n){let p=h.lastChild&&h.lastChild.type==a.type,x=yn.from(p?e.create():null),y=new fs(yn.from(e.create(null,yn.from(a.type.create(null,x)))),p?3:1,0),w=o.start,j=o.end;n(t.tr.step(new fd(w-(p?3:1),j,w,j,y,1,!0)).scrollIntoView())}return!0}}function zse(e){const{state:t,transaction:n}=e;let{selection:s}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return s},get doc(){return i},get tr(){return s=n.selection,i=n.doc,o=n.storedMarks,n}}}class Bse{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:s}=this,{view:i}=n,{tr:o}=s,l=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([a,h])=>[a,(...x)=>{const y=h(...x)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),y}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:l}=i,a=[],h=!!t,p=t||o.tr,x=()=>(!h&&n&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(p),a.every(w=>w===!0)),y={...Object.fromEntries(Object.entries(s).map(([w,j])=>[w,(...C)=>{const A=this.buildProps(p,n),E=j(...C)(A);return a.push(E),y}])),run:x};return y}createCan(t){const{rawCommands:n,state:s}=this,i=!1,o=t||s.tr,l=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([h,p])=>[h,(...x)=>p(...x)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(t,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:l}=i,a={tr:t,editor:i,view:l,state:zse({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(s).map(([h,p])=>[h,(...x)=>p(...x)(a)]))}};return a}}let Tvt=class{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const s=this.callbacks[t];return s&&s.forEach(i=>i.apply(this,n)),this}off(t,n){const s=this.callbacks[t];return s&&(n?this.callbacks[t]=s.filter(i=>i!==n):delete this.callbacks[t]),this}once(t,n){const s=(...i)=>{this.off(t,s),n.apply(this,i)};return this.on(t,s)}removeAllListeners(){this.callbacks={}}};function Ns(e,t,n){return e.config[t]===void 0&&e.parent?Ns(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?Ns(e.parent,t,n):null}):e.config[t]}function $se(e){const t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),s=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:s}}function GFe(e){const t=[],{nodeExtensions:n,markExtensions:s}=$se(e),i=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage,extensions:i},h=Ns(l,"addGlobalAttributes",a);if(!h)return;h().forEach(x=>{x.types.forEach(y=>{Object.entries(x.attributes).forEach(([w,j])=>{t.push({type:y,name:w,attribute:{...o,...j}})})})})}),i.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage},h=Ns(l,"addAttributes",a);if(!h)return;const p=h();Object.entries(p).forEach(([x,y])=>{const w={...o,...y};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,t.push({type:l.name,name:x,attribute:w})})}),t}function md(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function gd(...e){return e.filter(t=>!!t).reduce((t,n)=>{const s={...t};return Object.entries(n).forEach(([i,o])=>{if(!s[i]){s[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],h=s[i]?s[i].split(" "):[],p=a.filter(x=>!h.includes(x));s[i]=[...h,...p].join(" ")}else if(i==="style"){const a=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],h=s[i]?s[i].split(";").map(x=>x.trim()).filter(Boolean):[],p=new Map;h.forEach(x=>{const[y,w]=x.split(":").map(j=>j.trim());p.set(y,w)}),a.forEach(x=>{const[y,w]=x.split(":").map(j=>j.trim());p.set(y,w)}),s[i]=Array.from(p.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else s[i]=o}),s},{})}function Khe(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,s)=>gd(n,s),{})}function KFe(e){return typeof e=="function"}function ua(e,t=void 0,...n){return KFe(e)?t?e.bind(t)(...n):e(...n):e}function Avt(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Evt(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function PNe(e,t){return"style"in e?e:{...e,getAttrs:n=>{const s=e.getAttrs?e.getAttrs(n):e.attrs;if(s===!1)return!1;const i=t.reduce((o,l)=>{const a=l.attribute.parseHTML?l.attribute.parseHTML(n):Evt(n.getAttribute(l.name));return a==null?o:{...o,[l.name]:a}},{});return{...s,...i}}}}function LNe(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&Avt(n)?!1:n!=null))}function Ivt(e,t){var n;const s=GFe(e),{nodeExtensions:i,markExtensions:o}=$se(e),l=(n=i.find(p=>Ns(p,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(p=>{const x=s.filter(E=>E.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:t},w=e.reduce((E,T)=>{const O=Ns(T,"extendNodeSchema",y);return{...E,...O?O(p):{}}},{}),j=LNe({...w,content:ua(Ns(p,"content",y)),marks:ua(Ns(p,"marks",y)),group:ua(Ns(p,"group",y)),inline:ua(Ns(p,"inline",y)),atom:ua(Ns(p,"atom",y)),selectable:ua(Ns(p,"selectable",y)),draggable:ua(Ns(p,"draggable",y)),code:ua(Ns(p,"code",y)),whitespace:ua(Ns(p,"whitespace",y)),linebreakReplacement:ua(Ns(p,"linebreakReplacement",y)),defining:ua(Ns(p,"defining",y)),isolating:ua(Ns(p,"isolating",y)),attrs:Object.fromEntries(x.map(E=>{var T;return[E.name,{default:(T=E==null?void 0:E.attribute)===null||T===void 0?void 0:T.default}]}))}),S=ua(Ns(p,"parseHTML",y));S&&(j.parseDOM=S.map(E=>PNe(E,x)));const C=Ns(p,"renderHTML",y);C&&(j.toDOM=E=>C({node:E,HTMLAttributes:Khe(E,x)}));const A=Ns(p,"renderText",y);return A&&(j.toText=A),[p.name,j]})),h=Object.fromEntries(o.map(p=>{const x=s.filter(A=>A.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:t},w=e.reduce((A,E)=>{const T=Ns(E,"extendMarkSchema",y);return{...A,...T?T(p):{}}},{}),j=LNe({...w,inclusive:ua(Ns(p,"inclusive",y)),excludes:ua(Ns(p,"excludes",y)),group:ua(Ns(p,"group",y)),spanning:ua(Ns(p,"spanning",y)),code:ua(Ns(p,"code",y)),attrs:Object.fromEntries(x.map(A=>{var E;return[A.name,{default:(E=A==null?void 0:A.attribute)===null||E===void 0?void 0:E.default}]}))}),S=ua(Ns(p,"parseHTML",y));S&&(j.parseDOM=S.map(A=>PNe(A,x)));const C=Ns(p,"renderHTML",y);return C&&(j.toDOM=A=>C({mark:A,HTMLAttributes:Khe(A,x)})),[p.name,j]}));return new LRe({topNode:l,nodes:a,marks:h})}function bce(e,t){return t.nodes[e]||t.marks[e]||null}function ONe(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function nye(e,t){const n=ik.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const Pvt=(e,t=500)=>{let n="";const s=e.parentOffset;return e.parent.nodesBetween(Math.max(0,s-t),s,(i,o,l,a)=>{var h,p;const x=((p=(h=i.type.spec).toText)===null||p===void 0?void 0:p.call(h,{node:i,pos:o,parent:l,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?x:x.slice(0,Math.max(0,s-o))}),n};function sye(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class Use{constructor(t){this.find=t.find,this.handler=t.handler}}const Lvt=(e,t)=>{if(sye(t))return t.exec(e);const n=t(e);if(!n)return null;const s=[n.text];return s.index=n.index,s.input=e,s.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),s.push(n.replaceWith)),s};function CL(e){var t;const{editor:n,from:s,to:i,text:o,rules:l,plugin:a}=e,{view:h}=n;if(h.composing)return!1;const p=h.state.doc.resolve(s);if(p.parent.type.spec.code||!((t=p.nodeBefore||p.nodeAfter)===null||t===void 0)&&t.marks.find(w=>w.type.spec.code))return!1;let x=!1;const y=Pvt(p)+o;return l.forEach(w=>{if(x)return;const j=Lvt(y,w.find);if(!j)return;const S=h.state.tr,C=zse({state:h.state,transaction:S}),A={from:s-(j[0].length-o.length),to:i},{commands:E,chain:T,can:O}=new Bse({editor:n,state:C});w.handler({state:C,range:A,match:j,commands:E,chain:T,can:O})===null||!S.steps.length||(S.setMeta(a,{transform:S,from:s,to:i,text:o}),h.dispatch(S),x=!0)}),x}function Ovt(e){const{editor:t,rules:n}=e,s=new zd({state:{init(){return null},apply(i,o,l){const a=i.getMeta(s);if(a)return a;const h=i.getMeta("applyInputRules");return!!h&&setTimeout(()=>{let{text:x}=h;typeof x=="string"?x=x:x=nye(yn.from(x),l.schema);const{from:y}=h,w=y+x.length;CL({editor:t,from:y,to:w,text:x,rules:n,plugin:s})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,l,a){return CL({editor:t,from:o,to:l,text:a,rules:n,plugin:s})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&CL({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:s})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?CL({editor:t,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function Dvt(e){return Object.prototype.toString.call(e).slice(8,-1)}function ML(e){return Dvt(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function qse(e,t){const n={...e};return ML(e)&&ML(t)&&Object.keys(t).forEach(s=>{ML(t[s])&&ML(e[s])?n[s]=qse(e[s],t[s]):n[s]=t[s]}),n}class Lg{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ua(Ns(this,"addOptions",{name:this.name}))),this.storage=ua(Ns(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Lg(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>qse(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Lg(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ua(Ns(n,"addOptions",{name:n.name})),n.storage=ua(Ns(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:s}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(p=>(p==null?void 0:p.type.name)===n.name))return!1;const h=l.find(p=>(p==null?void 0:p.type.name)===n.name);return h&&s.removeStoredMark(h),s.insertText(" ",i.pos),t.view.dispatch(s),!0}return!1}}function Rvt(e){return typeof e=="number"}class Fvt{constructor(t){this.find=t.find,this.handler=t.handler}}const zvt=(e,t,n)=>{if(sye(t))return[...e.matchAll(t)];const s=t(e,n);return s?s.map(i=>{const o=[i.text];return o.index=i.index,o.input=e,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Bvt(e){const{editor:t,state:n,from:s,to:i,rule:o,pasteEvent:l,dropEvent:a}=e,{commands:h,chain:p,can:x}=new Bse({editor:t,state:n}),y=[];return n.doc.nodesBetween(s,i,(j,S)=>{if(!j.isTextblock||j.type.spec.code)return;const C=Math.max(s,S),A=Math.min(i,S+j.content.size),E=j.textBetween(C-S,A-S,void 0,"");zvt(E,o.find,l).forEach(O=>{if(O.index===void 0)return;const z=C+O.index+1,F=z+O[0].length,q={from:n.tr.mapping.map(z),to:n.tr.mapping.map(F)},H=o.handler({state:n,range:q,match:O,commands:h,chain:p,can:x,pasteEvent:l,dropEvent:a});y.push(H)})}),y.every(j=>j!==null)}let TL=null;const $vt=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function Uvt(e){const{editor:t,rules:n}=e;let s=null,i=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const h=({state:x,from:y,to:w,rule:j,pasteEvt:S})=>{const C=x.tr,A=zse({state:x,transaction:C});if(!(!Bvt({editor:t,state:A,from:Math.max(y-1,0),to:w.b-1,rule:j,pasteEvent:S,dropEvent:a})||!C.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,C}};return n.map(x=>new zd({view(y){const w=S=>{var C;s=!((C=y.dom.parentElement)===null||C===void 0)&&C.contains(S.target)?y.dom.parentElement:null,s&&(TL=t)},j=()=>{TL&&(TL=null)};return window.addEventListener("dragstart",w),window.addEventListener("dragend",j),{destroy(){window.removeEventListener("dragstart",w),window.removeEventListener("dragend",j)}}},props:{handleDOMEvents:{drop:(y,w)=>{if(o=s===y.dom.parentElement,a=w,!o){const j=TL;j!=null&&j.isEditable&&setTimeout(()=>{const S=j.state.selection;S&&j.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(y,w)=>{var j;const S=(j=w.clipboardData)===null||j===void 0?void 0:j.getData("text/html");return l=w,i=!!(S!=null&&S.includes("data-pm-slice")),!1}}},appendTransaction:(y,w,j)=>{const S=y[0],C=S.getMeta("uiEvent")==="paste"&&!i,A=S.getMeta("uiEvent")==="drop"&&!o,E=S.getMeta("applyPasteRules"),T=!!E;if(!C&&!A&&!T)return;if(T){let{text:F}=E;typeof F=="string"?F=F:F=nye(yn.from(F),j.schema);const{from:q}=E,H=q+F.length,K=$vt(F);return h({rule:x,state:j,from:q,to:{b:H},pasteEvt:K})}const O=w.doc.content.findDiffStart(j.doc.content),z=w.doc.content.findDiffEnd(j.doc.content);if(!(!Rvt(O)||!z||O===z.b))return h({rule:x,state:j,from:O,to:z,pasteEvt:l})}}))}function qvt(e){const t=e.filter((n,s)=>e.indexOf(n)!==s);return Array.from(new Set(t))}class O4{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=O4.resolve(t),this.schema=Ivt(this.extensions,n),this.setupExtensions()}static resolve(t){const n=O4.sort(O4.flatten(t)),s=qvt(n.map(i=>i.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(t){return t.map(n=>{const s={name:n.name,options:n.options,storage:n.storage},i=Ns(n,"addExtensions",s);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(t){return t.sort((s,i)=>{const o=Ns(s,"priority")||100,l=Ns(i,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:bce(n.name,this.schema)},i=Ns(n,"addCommands",s);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this,n=O4.sort([...this.extensions].reverse()),s=[],i=[],o=n.map(l=>{const a={name:l.name,options:l.options,storage:l.storage,editor:t,type:bce(l.name,this.schema)},h=[],p=Ns(l,"addKeyboardShortcuts",a);let x={};if(l.type==="mark"&&Ns(l,"exitable",a)&&(x.ArrowRight=()=>Lg.handleExit({editor:t,mark:l})),p){const C=Object.fromEntries(Object.entries(p()).map(([A,E])=>[A,()=>E({editor:t})]));x={...x,...C}}const y=lvt(x);h.push(y);const w=Ns(l,"addInputRules",a);ONe(l,t.options.enableInputRules)&&w&&s.push(...w());const j=Ns(l,"addPasteRules",a);ONe(l,t.options.enablePasteRules)&&j&&i.push(...j());const S=Ns(l,"addProseMirrorPlugins",a);if(S){const C=S();h.push(...C)}return h}).flat();return[Ovt({editor:t,rules:s}),...Uvt({editor:t,rules:i}),...o]}get attributes(){return GFe(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=$se(this.extensions);return Object.fromEntries(n.filter(s=>!!Ns(s,"addNodeView")).map(s=>{const i=this.attributes.filter(h=>h.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:t,type:md(s.name,this.schema)},l=Ns(s,"addNodeView",o);if(!l)return[];const a=(h,p,x,y,w)=>{const j=Khe(h,i);return l()({node:h,view:p,getPos:x,decorations:y,innerDecorations:w,editor:t,extension:s,HTMLAttributes:j})};return[s.name,a]}))}setupExtensions(){this.extensions.forEach(t=>{var n;this.editor.extensionStorage[t.name]=t.storage;const s={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:bce(t.name,this.schema)};t.type==="mark"&&(!((n=ua(Ns(t,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const i=Ns(t,"onBeforeCreate",s),o=Ns(t,"onCreate",s),l=Ns(t,"onUpdate",s),a=Ns(t,"onSelectionUpdate",s),h=Ns(t,"onTransaction",s),p=Ns(t,"onFocus",s),x=Ns(t,"onBlur",s),y=Ns(t,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),h&&this.editor.on("transaction",h),p&&this.editor.on("focus",p),x&&this.editor.on("blur",x),y&&this.editor.on("destroy",y)})}}class Rd{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ua(Ns(this,"addOptions",{name:this.name}))),this.storage=ua(Ns(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Rd(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>qse(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Rd({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ua(Ns(n,"addOptions",{name:n.name})),n.storage=ua(Ns(n,"addStorage",{name:n.name,options:n.options})),n}}function ZFe(e,t,n){const{from:s,to:i}=t,{blockSeparator:o=` `,textSerializers:l={}}=n||{};let a="";return e.nodesBetween(s,i,(h,p,x,y)=>{var w;h.isBlock&&p>s&&(a+=o);const j=l==null?void 0:l[h.type.name];if(j)return x&&(a+=j({node:h,pos:p,parent:x,index:y,range:t})),!1;h.isText&&(a+=(w=h==null?void 0:h.text)===null||w===void 0?void 0:w.slice(Math.max(s,p)-p,i-p))}),a}function YFe(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const Vvt=Rd.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new zd({key:new cf("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:s,selection:i}=t,{ranges:o}=i,l=Math.min(...o.map(x=>x.$from.pos)),a=Math.max(...o.map(x=>x.$to.pos)),h=YFe(n);return ZFe(s,{from:l,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:h})}}})]}}),Hvt=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),Wvt=(e=!1)=>({commands:t})=>t.setContent("",e),Gvt=()=>({state:e,tr:t,dispatch:n})=>{const{selection:s}=t,{ranges:i}=s;return n&&i.forEach(({$from:o,$to:l})=>{e.doc.nodesBetween(o.pos,l.pos,(a,h)=>{if(a.type.isText)return;const{doc:p,mapping:x}=t,y=p.resolve(x.map(h)),w=p.resolve(x.map(h+a.nodeSize)),j=y.blockRange(w);if(!j)return;const S=p3(j);if(a.type.isTextblock){const{defaultType:C}=y.parent.contentMatchAt(y.index());t.setNodeMarkup(j.start,C)}(S||S===0)&&t.lift(j,S)})}),!0},Kvt=e=>t=>e(t),Zvt=()=>({state:e,dispatch:t})=>qFe(e,t),Yvt=(e,t)=>({editor:n,tr:s})=>{const{state:i}=n,o=i.doc.slice(e.from,e.to);s.deleteRange(e.from,e.to);const l=s.mapping.map(t);return s.insert(l,o.content),s.setSelection(new Ui(s.doc.resolve(Math.max(l-1,0)))),!0},Xvt=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,s=n.$anchor.node();if(s.content.size>0)return!1;const i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s.type){if(t){const a=i.before(o),h=i.after(o);e.delete(a,h).scrollIntoView()}return!0}return!1},Qvt=e=>({tr:t,state:n,dispatch:s})=>{const i=md(e,n.schema),o=t.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===i){if(s){const h=o.before(l),p=o.after(l);t.delete(h,p).scrollIntoView()}return!0}return!1},Jvt=e=>({tr:t,dispatch:n})=>{const{from:s,to:i}=e;return n&&t.delete(s,i),!0},e_t=()=>({state:e,dispatch:t})=>Qxe(e,t),t_t=()=>({commands:e})=>e.keyboardShortcut("Enter"),r_t=()=>({state:e,dispatch:t})=>pvt(e,t);function Dte(e,t,n={strict:!0}){const s=Object.keys(t);return s.length?s.every(i=>n.strict?t[i]===e[i]:sye(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function XFe(e,t,n={}){return e.find(s=>s.type===t&&Dte(Object.fromEntries(Object.keys(n).map(i=>[i,s.attrs[i]])),n))}function DNe(e,t,n={}){return!!XFe(e,t,n)}function iye(e,t,n){var s;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if((!i.node||!i.node.marks.some(x=>x.type===t))&&(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(x=>x.type===t)||(n=n||((s=i.node.marks[0])===null||s===void 0?void 0:s.attrs),!XFe([...i.node.marks],t,n)))return;let l=i.index,a=e.start()+i.offset,h=l+1,p=a+i.node.nodeSize;for(;l>0&&DNe([...e.parent.child(l-1).marks],t,n);)l-=1,a-=e.parent.child(l).nodeSize;for(;h({tr:n,state:s,dispatch:i})=>{const o=ov(e,s.schema),{doc:l,selection:a}=n,{$from:h,from:p,to:x}=a;if(i){const y=iye(h,o,t);if(y&&y.from<=p&&y.to>=x){const w=Ui.create(l,y.from,y.to);n.setSelection(w)}}return!0},s_t=e=>t=>{const n=typeof e=="function"?e(t):e;for(let s=0;s({editor:n,view:s,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};const l=()=>{(aye()||i_t())&&s.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(s.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(s.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!QFe(n.state.selection))return l(),!0;const a=JFe(i.doc,e)||n.state.selection,h=n.state.selection.eq(a);return o&&(h||i.setSelection(a),h&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},o_t=(e,t)=>n=>e.every((s,i)=>t(s,{...n,index:i})),l_t=(e,t)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),eze=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const s=t[n];s.nodeType===3&&s.nodeValue&&/^(\n\s\s|\n)$/.test(s.nodeValue)?e.removeChild(s):s.nodeType===1&&eze(s)}return e};function AL(e){const t=`${e}`,n=new window.DOMParser().parseFromString(t,"text/html").body;return eze(n)}function uE(e,t,n){if(e instanceof N1||e instanceof yn)return e;n={slice:!0,parseOptions:{},...n};const s=typeof e=="object"&&e!==null,i=typeof e=="string";if(s)try{if(Array.isArray(e)&&e.length>0)return yn.fromArray(e.map(a=>t.nodeFromJSON(a)));const l=t.nodeFromJSON(e);return n.errorOnInvalidContent&&l.check(),l}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),uE("",t,n)}if(i){if(n.errorOnInvalidContent){let l=!1,a="";const h=new LRe({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:p=>(l=!0,a=typeof p=="string"?p:p.outerHTML,null)}]}})});if(n.slice?cA.fromSchema(h).parseSlice(AL(e),n.parseOptions):cA.fromSchema(h).parse(AL(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=cA.fromSchema(t);return n.slice?o.parseSlice(AL(e),n.parseOptions).content:o.parse(AL(e),n.parseOptions)}return uE("",t,n)}function c_t(e,t,n){const s=e.steps.length-1;if(s{l===0&&(l=x)}),e.setSelection(la.near(e.doc.resolve(l),n))}const d_t=e=>!("type"in e),u_t=(e,t,n)=>({tr:s,dispatch:i,editor:o})=>{var l;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const h=A=>{o.emit("contentError",{editor:o,error:A,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{uE(t,o.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(A){h(A)}try{a=uE(t,o.schema,{parseOptions:p,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(A){return h(A),!1}let{from:x,to:y}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},w=!0,j=!0;if((d_t(a)?a:[a]).forEach(A=>{A.check(),w=w?A.isText&&A.marks.length===0:!1,j=j?A.isBlock:!1}),x===y&&j){const{parent:A}=s.doc.resolve(x);A.isTextblock&&!A.type.spec.code&&!A.childCount&&(x-=1,y+=1)}let C;if(w){if(Array.isArray(t))C=t.map(A=>A.text||"").join("");else if(t instanceof yn){let A="";t.forEach(E=>{E.text&&(A+=E.text)}),C=A}else typeof t=="object"&&t&&t.text?C=t.text:C=t;s.insertText(C,x,y)}else C=a,s.replaceWith(x,y,C);n.updateSelection&&c_t(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:x,text:C}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:x,text:C})}return!0},h_t=()=>({state:e,dispatch:t})=>uvt(e,t),f_t=()=>({state:e,dispatch:t})=>hvt(e,t),p_t=()=>({state:e,dispatch:t})=>DFe(e,t),m_t=()=>({state:e,dispatch:t})=>BFe(e,t),g_t=()=>({state:e,dispatch:t,tr:n})=>{try{const s=Pse(e.doc,e.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},x_t=()=>({state:e,dispatch:t,tr:n})=>{try{const s=Pse(e.doc,e.selection.$from.pos,1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},y_t=()=>({state:e,dispatch:t})=>cvt(e,t),v_t=()=>({state:e,dispatch:t})=>dvt(e,t);function tze(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function __t(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let s,i,o,l;for(let a=0;a({editor:t,view:n,tr:s,dispatch:i})=>{const o=__t(e).split(/-(?!$)/),l=o.find(p=>!["Alt","Ctrl","Meta","Shift"].includes(p)),a=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),h=t.captureTransaction(()=>{n.someProp("handleKeyDown",p=>p(n,a))});return h==null||h.steps.forEach(p=>{const x=p.map(s.mapping);x&&i&&s.maybeStep(x)}),!0};function hE(e,t,n={}){const{from:s,to:i,empty:o}=e.selection,l=t?md(t,e.schema):null,a=[];e.doc.nodesBetween(s,i,(y,w)=>{if(y.isText)return;const j=Math.max(s,w),S=Math.min(i,w+y.nodeSize);a.push({node:y,from:j,to:S})});const h=i-s,p=a.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>Dte(y.node.attrs,n,{strict:!1}));return o?!!p.length:p.reduce((y,w)=>y+w.to-w.from,0)>=h}const w_t=(e,t={})=>({state:n,dispatch:s})=>{const i=md(e,n.schema);return hE(n,i,t)?fvt(n,s):!1},j_t=()=>({state:e,dispatch:t})=>VFe(e,t),k_t=e=>({state:t,dispatch:n})=>{const s=md(e,t.schema);return Nvt(s)(t,n)},N_t=()=>({state:e,dispatch:t})=>UFe(e,t);function Vse(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function RNe(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((s,i)=>(n.includes(i)||(s[i]=e[i]),s),{})}const S_t=(e,t)=>({tr:n,state:s,dispatch:i})=>{let o=null,l=null;const a=Vse(typeof e=="string"?e:e.name,s.schema);return a?(a==="node"&&(o=md(e,s.schema)),a==="mark"&&(l=ov(e,s.schema)),i&&n.selection.ranges.forEach(h=>{s.doc.nodesBetween(h.$from.pos,h.$to.pos,(p,x)=>{o&&o===p.type&&n.setNodeMarkup(x,void 0,RNe(p.attrs,t)),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&n.addMark(x,x+p.nodeSize,l.create(RNe(y.attrs,t)))})})}),!0):!1},C_t=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),M_t=()=>({tr:e,dispatch:t})=>{if(t){const n=new ef(e.doc);e.setSelection(n)}return!0},T_t=()=>({state:e,dispatch:t})=>FFe(e,t),A_t=()=>({state:e,dispatch:t})=>$Fe(e,t),E_t=()=>({state:e,dispatch:t})=>xvt(e,t),I_t=()=>({state:e,dispatch:t})=>_vt(e,t),P_t=()=>({state:e,dispatch:t})=>vvt(e,t);function Zhe(e,t,n={},s={}){return uE(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const L_t=(e,t=!1,n={},s={})=>({editor:i,tr:o,dispatch:l,commands:a})=>{var h,p;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const y=Zhe(e,i.schema,n,{errorOnInvalidContent:(h=s.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck});return l&&o.replaceWith(0,x.content.size,y).setMeta("preventUpdate",!t),!0}return l&&o.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:x.content.size},e,{parseOptions:n,errorOnInvalidContent:(p=s.errorOnInvalidContent)!==null&&p!==void 0?p:i.options.enableContentCheck})};function rze(e,t){const n=ov(t,e.schema),{from:s,to:i,empty:o}=e.selection,l=[];o?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(s,i,h=>{l.push(...h.marks)});const a=l.find(h=>h.type.name===n.name);return a?{...a.attrs}:{}}function O_t(e,t){const n=new YRe(e);return t.forEach(s=>{s.steps.forEach(i=>{n.step(i)})}),n}function D_t(e){for(let t=0;t{n(i)&&s.push({node:i,pos:o})}),s}function F_t(e,t){for(let n=e.depth;n>0;n-=1){const s=e.node(n);if(t(s))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:s}}}function oye(e){return t=>F_t(t.$from,e)}function z_t(e,t){const n={from:0,to:e.content.size};return ZFe(e,n,t)}function B_t(e,t){const n=md(t,e.schema),{from:s,to:i}=e.selection,o=[];e.doc.nodesBetween(s,i,a=>{o.push(a)});const l=o.reverse().find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function nze(e,t){const n=Vse(typeof t=="string"?t:t.name,e.schema);return n==="node"?B_t(e,t):n==="mark"?rze(e,t):{}}function $_t(e,t=JSON.stringify){const n={};return e.filter(s=>{const i=t(s);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function U_t(e){const t=$_t(e);return t.length===1?t:t.filter((n,s)=>!t.filter((o,l)=>l!==s).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function q_t(e){const{mapping:t,steps:n}=e,s=[];return t.maps.forEach((i,o)=>{const l=[];if(i.ranges.length)i.forEach((a,h)=>{l.push({from:a,to:h})});else{const{from:a,to:h}=n[o];if(a===void 0||h===void 0)return;l.push({from:a,to:h})}l.forEach(({from:a,to:h})=>{const p=t.slice(o).map(a,-1),x=t.slice(o).map(h),y=t.invert().map(p,-1),w=t.invert().map(x);s.push({oldRange:{from:y,to:w},newRange:{from:p,to:x}})})}),U_t(s)}function lye(e,t,n){const s=[];return e===t?n.resolve(e).marks().forEach(i=>{const o=n.resolve(e),l=iye(o,i.type);l&&s.push({mark:i,...l})}):n.nodesBetween(e,t,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||s.push(...i.marks.map(l=>({from:o,to:o+i.nodeSize,mark:l})))}),s}function hee(e,t,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const i=e.find(o=>o.type===t&&o.name===s);return i?i.attribute.keepOnSplit:!1}))}function Yhe(e,t,n={}){const{empty:s,ranges:i}=e.selection,o=t?ov(t,e.schema):null;if(s)return!!(e.storedMarks||e.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>Dte(y.attrs,n,{strict:!1}));let l=0;const a=[];if(i.forEach(({$from:y,$to:w})=>{const j=y.pos,S=w.pos;e.doc.nodesBetween(j,S,(C,A)=>{if(!C.isText&&!C.marks.length)return;const E=Math.max(j,A),T=Math.min(S,A+C.nodeSize),O=T-E;l+=O,a.push(...C.marks.map(z=>({mark:z,from:E,to:T})))})}),l===0)return!1;const h=a.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>Dte(y.mark.attrs,n,{strict:!1})).reduce((y,w)=>y+w.to-w.from,0),p=a.filter(y=>o?y.mark.type!==o&&y.mark.type.excludes(o):!0).reduce((y,w)=>y+w.to-w.from,0);return(h>0?h+p:h)>=l}function V_t(e,t,n={}){if(!t)return hE(e,null,n)||Yhe(e,null,n);const s=Vse(t,e.schema);return s==="node"?hE(e,t,n):s==="mark"?Yhe(e,t,n):!1}function FNe(e,t){const{nodeExtensions:n}=$se(t),s=n.find(l=>l.name===e);if(!s)return!1;const i={name:s.name,options:s.options,storage:s.storage},o=ua(Ns(s,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function cye(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var s;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((s=e.text)!==null&&s!==void 0?s:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let i=!0;return e.content.forEach(o=>{i!==!1&&(cye(o,{ignoreWhitespace:n,checkChildren:t})||(i=!1))}),i}return!1}function H_t(e){return e instanceof si}function W_t(e,t,n){var s;const{selection:i}=t;let o=null;if(QFe(i)&&(o=i.$cursor),o){const a=(s=e.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(a)||!a.some(h=>h.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:a,$to:h})=>{let p=a.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(a.pos,h.pos,(x,y,w)=>{if(p)return!1;if(x.isInline){const j=!w||w.type.allowsMarkType(n),S=!!n.isInSet(x.marks)||!x.marks.some(C=>C.type.excludes(n));p=j&&S}return!p}),p})}const G_t=(e,t={})=>({tr:n,state:s,dispatch:i})=>{const{selection:o}=n,{empty:l,ranges:a}=o,h=ov(e,s.schema);if(i)if(l){const p=rze(s,h);n.addStoredMark(h.create({...p,...t}))}else a.forEach(p=>{const x=p.$from.pos,y=p.$to.pos;s.doc.nodesBetween(x,y,(w,j)=>{const S=Math.max(j,x),C=Math.min(j+w.nodeSize,y);w.marks.find(E=>E.type===h)?w.marks.forEach(E=>{h===E.type&&n.addMark(S,C,h.create({...E.attrs,...t}))}):n.addMark(S,C,h.create(t))})});return W_t(s,n,h)},K_t=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Z_t=(e,t={})=>({state:n,dispatch:s,chain:i})=>{const o=md(e,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>INe(o,{...l,...t})(n)?!0:a.clearNodes()).command(({state:a})=>INe(o,{...l,...t})(a,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Y_t=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,i=Uw(e,0,s.content.size),o=si.create(s,i);t.setSelection(o)}return!0},X_t=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,{from:i,to:o}=typeof e=="number"?{from:e,to:e}:e,l=Ui.atStart(s).from,a=Ui.atEnd(s).to,h=Uw(i,l,a),p=Uw(o,l,a),x=Ui.create(s,h,p);t.setSelection(x)}return!0},Q_t=e=>({state:t,dispatch:n})=>{const s=md(e,t.schema);return Mvt(s)(t,n)};function zNe(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const s=n.filter(i=>t==null?void 0:t.includes(i.type.name));e.tr.ensureMarks(s)}}const J_t=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:s,editor:i})=>{const{selection:o,doc:l}=t,{$from:a,$to:h}=o,p=i.extensionManager.attributes,x=hee(p,a.node().type.name,a.node().attrs);if(o instanceof si&&o.node.isBlock)return!a.parentOffset||!Kx(l,a.pos)?!1:(s&&(e&&zNe(n,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const y=h.parentOffset===h.parent.content.size,w=a.depth===0?void 0:D_t(a.node(-1).contentMatchAt(a.indexAfter(-1)));let j=y&&w?[{type:w,attrs:x}]:void 0,S=Kx(t.doc,t.mapping.map(a.pos),1,j);if(!j&&!S&&Kx(t.doc,t.mapping.map(a.pos),1,w?[{type:w}]:void 0)&&(S=!0,j=w?[{type:w,attrs:x}]:void 0),s){if(S&&(o instanceof Ui&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,j),w&&!y&&!a.parentOffset&&a.parent.type!==w)){const C=t.mapping.map(a.before()),A=t.doc.resolve(C);a.node(-1).canReplaceWith(A.index(),A.index()+1,w)&&t.setNodeMarkup(t.mapping.map(a.before()),w)}e&&zNe(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return S},e2t=(e,t={})=>({tr:n,state:s,dispatch:i,editor:o})=>{var l;const a=md(e,s.schema),{$from:h,$to:p}=s.selection,x=s.selection.node;if(x&&x.isBlock||h.depth<2||!h.sameParent(p))return!1;const y=h.node(-1);if(y.type!==a)return!1;const w=o.extensionManager.attributes;if(h.parent.content.size===0&&h.node(-1).childCount===h.indexAfter(-1)){if(h.depth===2||h.node(-3).type!==a||h.index(-2)!==h.node(-2).childCount-1)return!1;if(i){let E=yn.empty;const T=h.index(-1)?1:h.index(-2)?2:3;for(let K=h.depth-T;K>=h.depth-3;K-=1)E=yn.from(h.node(K).copy(E));const O=h.indexAfter(-1){if(H>-1)return!1;K.isTextblock&&K.content.size===0&&(H=Z+1)}),H>-1&&n.setSelection(Ui.near(n.doc.resolve(H))),n.scrollIntoView()}return!0}const j=p.pos===h.end()?y.contentMatchAt(0).defaultType:null,S={...hee(w,y.type.name,y.attrs),...t},C={...hee(w,h.node().type.name,h.node().attrs),...t};n.delete(h.pos,p.pos);const A=j?[{type:a,attrs:S},{type:j,attrs:C}]:[{type:a,attrs:S}];if(!Kx(n.doc,h.pos,2))return!1;if(i){const{selection:E,storedMarks:T}=s,{splittableMarks:O}=o.extensionManager,z=T||E.$to.parentOffset&&E.$from.marks();if(n.split(h.pos,2,A).scrollIntoView(),!z||!i)return!0;const F=z.filter(q=>O.includes(q.type.name));n.ensureMarks(F)}return!0},wce=(e,t)=>{const n=oye(l=>l.type===t)(e.selection);if(!n)return!0;const s=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(s===void 0)return!0;const i=e.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&iv(e.doc,n.pos)&&e.join(n.pos),!0},jce=(e,t)=>{const n=oye(l=>l.type===t)(e.selection);if(!n)return!0;const s=e.doc.resolve(n.start).after(n.depth);if(s===void 0)return!0;const i=e.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&iv(e.doc,s)&&e.join(s),!0},t2t=(e,t,n,s={})=>({editor:i,tr:o,state:l,dispatch:a,chain:h,commands:p,can:x})=>{const{extensions:y,splittableMarks:w}=i.extensionManager,j=md(e,l.schema),S=md(t,l.schema),{selection:C,storedMarks:A}=l,{$from:E,$to:T}=C,O=E.blockRange(T),z=A||C.$to.parentOffset&&C.$from.marks();if(!O)return!1;const F=oye(q=>FNe(q.type.name,y))(C);if(O.depth>=1&&F&&O.depth-F.depth<=1){if(F.node.type===j)return p.liftListItem(S);if(FNe(F.node.type.name,y)&&j.validContent(F.node.content)&&a)return h().command(()=>(o.setNodeMarkup(F.pos,j),!0)).command(()=>wce(o,j)).command(()=>jce(o,j)).run()}return!n||!z||!a?h().command(()=>x().wrapInList(j,s)?!0:p.clearNodes()).wrapInList(j,s).command(()=>wce(o,j)).command(()=>jce(o,j)).run():h().command(()=>{const q=x().wrapInList(j,s),H=z.filter(K=>w.includes(K.type.name));return o.ensureMarks(H),q?!0:p.clearNodes()}).wrapInList(j,s).command(()=>wce(o,j)).command(()=>jce(o,j)).run()},r2t=(e,t={},n={})=>({state:s,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,l=ov(e,s.schema);return Yhe(s,l,t)?i.unsetMark(l,{extendEmptyMarkRange:o}):i.setMark(l,t)},n2t=(e,t,n={})=>({state:s,commands:i})=>{const o=md(e,s.schema),l=md(t,s.schema),a=hE(s,o,n);let h;return s.selection.$anchor.sameParent(s.selection.$head)&&(h=s.selection.$anchor.parent.attrs),a?i.setNode(l,h):i.setNode(o,{...h,...n})},s2t=(e,t={})=>({state:n,commands:s})=>{const i=md(e,n.schema);return hE(n,i,t)?s.lift(i):s.wrapIn(i,t)},i2t=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let s=0;s=0;h-=1)l.step(a.steps[h].invert(a.docs[h]));if(o.text){const h=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,e.schema.text(o.text,h))}else l.delete(o.from,o.to)}return!0}}return!1},a2t=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:s,ranges:i}=n;return s||t&&i.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},o2t=(e,t={})=>({tr:n,state:s,dispatch:i})=>{var o;const{extendEmptyMarkRange:l=!1}=t,{selection:a}=n,h=ov(e,s.schema),{$from:p,empty:x,ranges:y}=a;if(!i)return!0;if(x&&l){let{from:w,to:j}=a;const S=(o=p.marks().find(A=>A.type===h))===null||o===void 0?void 0:o.attrs,C=iye(p,h,S);C&&(w=C.from,j=C.to),n.removeMark(w,j,h)}else y.forEach(w=>{n.removeMark(w.$from.pos,w.$to.pos,h)});return n.removeStoredMark(h),!0},l2t=(e,t={})=>({tr:n,state:s,dispatch:i})=>{let o=null,l=null;const a=Vse(typeof e=="string"?e:e.name,s.schema);return a?(a==="node"&&(o=md(e,s.schema)),a==="mark"&&(l=ov(e,s.schema)),i&&n.selection.ranges.forEach(h=>{const p=h.$from.pos,x=h.$to.pos;let y,w,j,S;n.selection.empty?s.doc.nodesBetween(p,x,(C,A)=>{o&&o===C.type&&(j=Math.max(A,p),S=Math.min(A+C.nodeSize,x),y=A,w=C)}):s.doc.nodesBetween(p,x,(C,A)=>{A=p&&A<=x&&(o&&o===C.type&&n.setNodeMarkup(A,void 0,{...C.attrs,...t}),l&&C.marks.length&&C.marks.forEach(E=>{if(l===E.type){const T=Math.max(A,p),O=Math.min(A+C.nodeSize,x);n.addMark(T,O,l.create({...E.attrs,...t}))}}))}),w&&(y!==void 0&&n.setNodeMarkup(y,void 0,{...w.attrs,...t}),l&&w.marks.length&&w.marks.forEach(C=>{l===C.type&&n.addMark(j,S,l.create({...C.attrs,...t}))}))}),!0):!1},c2t=(e,t={})=>({state:n,dispatch:s})=>{const i=md(e,n.schema);return bvt(i,t)(n,s)},d2t=(e,t={})=>({state:n,dispatch:s})=>{const i=md(e,n.schema);return wvt(i,t)(n,s)};var u2t=Object.freeze({__proto__:null,blur:Hvt,clearContent:Wvt,clearNodes:Gvt,command:Kvt,createParagraphNear:Zvt,cut:Yvt,deleteCurrentNode:Xvt,deleteNode:Qvt,deleteRange:Jvt,deleteSelection:e_t,enter:t_t,exitCode:r_t,extendMarkRange:n_t,first:s_t,focus:a_t,forEach:o_t,insertContent:l_t,insertContentAt:u_t,joinBackward:p_t,joinDown:f_t,joinForward:m_t,joinItemBackward:g_t,joinItemForward:x_t,joinTextblockBackward:y_t,joinTextblockForward:v_t,joinUp:h_t,keyboardShortcut:b_t,lift:w_t,liftEmptyBlock:j_t,liftListItem:k_t,newlineInCode:N_t,resetAttributes:S_t,scrollIntoView:C_t,selectAll:M_t,selectNodeBackward:T_t,selectNodeForward:A_t,selectParentNode:E_t,selectTextblockEnd:I_t,selectTextblockStart:P_t,setContent:L_t,setMark:G_t,setMeta:K_t,setNode:Z_t,setNodeSelection:Y_t,setTextSelection:X_t,sinkListItem:Q_t,splitBlock:J_t,splitListItem:e2t,toggleList:t2t,toggleMark:r2t,toggleNode:n2t,toggleWrap:s2t,undoInputRule:i2t,unsetAllMarks:a2t,unsetMark:o2t,updateAttributes:l2t,wrapIn:c2t,wrapInList:d2t});const h2t=Rd.create({name:"commands",addCommands(){return{...u2t}}}),f2t=Rd.create({name:"drop",addProseMirrorPlugins(){return[new zd({key:new cf("tiptapDrop"),props:{handleDrop:(e,t,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:s})}}})]}}),p2t=Rd.create({name:"editable",addProseMirrorPlugins(){return[new zd({key:new cf("editable"),props:{editable:()=>this.editor.options.editable}})]}}),m2t=new cf("focusEvents"),g2t=Rd.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new zd({key:m2t,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const s=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(s),!1},blur:(t,n)=>{e.isFocused=!1;const s=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(s),!1}}}})]}}),x2t=Rd.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:a})=>{const{selection:h,doc:p}=a,{empty:x,$anchor:y}=h,{pos:w,parent:j}=y,S=y.parent.isTextblock&&w>0?a.doc.resolve(w-1):y,C=S.parent.type.spec.isolating,A=y.pos-y.parentOffset,E=C&&S.parent.childCount===1?A===y.pos:la.atStart(p).from===w;return!x||!j.type.isTextblock||j.textContent.length||!E||E&&y.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...s},o={...s,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return aye()||tze()?o:i},addProseMirrorPlugins(){return[new zd({key:new cf("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(C=>C.getMeta("composition")))return;const s=e.some(C=>C.docChanged)&&!t.doc.eq(n.doc),i=e.some(C=>C.getMeta("preventClearDocument"));if(!s||i)return;const{empty:o,from:l,to:a}=t.selection,h=la.atStart(t.doc).from,p=la.atEnd(t.doc).to;if(o||!(l===h&&a===p)||!cye(n.doc))return;const w=n.tr,j=zse({state:n,transaction:w}),{commands:S}=new Bse({editor:this.editor,state:j});if(S.clearNodes(),!!w.steps.length)return w}})]}}),y2t=Rd.create({name:"paste",addProseMirrorPlugins(){return[new zd({key:new cf("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),v2t=Rd.create({name:"tabindex",addProseMirrorPlugins(){return[new zd({key:new cf("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Iw{get name(){return this.node.type.name}constructor(t,n,s=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=t,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,s=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,s=this.to-1}this.editor.commands.insertContentAt({from:n,to:s},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Iw(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Iw(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Iw(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,s)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,l=this.pos+s+(o?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!i&&a.depth<=this.depth)return;const h=new Iw(a,this.editor,i,i?n:null);i&&(h.actualDepth=this.depth+1),t.push(new Iw(a,this.editor,i,i?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let s=null,i=this.parent;for(;i&&!s;){if(i.node.type.name===t)if(Object.keys(n).length>0){const o=i.node.attrs,l=Object.keys(n);for(let a=0;a{s&&i.length>0||(l.node.type.name===t&&o.every(h=>n[h]===l.node.attrs[h])&&i.push(l),!(s&&i.length>0)&&(i=i.concat(l.querySelectorAll(t,n,s))))}),i}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}}const _2t=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`;function b2t(e,t,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style",""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}class w2t extends Tvt{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:s,moved:i})=>this.options.onDrop(n,s,i)),this.on("paste",({event:n,slice:s})=>this.options.onPaste(n,s)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=b2t(_2t,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,n){const s=KFe(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}unregisterPlugin(t){if(this.isDestroyed)return;const n=this.state.plugins;let s=n;if([].concat(t).forEach(o=>{const l=typeof o=="string"?`${o}$`:o.key;s=s.filter(a=>!a.key.startsWith(l))}),n.length===s.length)return;const i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}createExtensionManager(){var t,n;const i=[...this.options.enableCoreExtensions?[p2t,Vvt.configure({blockSeparator:(n=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),h2t,g2t,x2t,v2t,f2t,y2t].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new O4(i,this)}createCommandManager(){this.commandManager=new Bse({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let n;try{n=Zhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(l){if(!(l instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(l.message))throw l;this.emit("contentError",{editor:this,error:l,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=Zhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=JFe(n,this.options.autofocus);this.view=new PFe(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:L4.create({doc:n,selection:s||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(l=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(l)});return}const n=this.state.apply(t),s=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),s&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=t.getMeta("focus"),o=t.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return nze(this.state,t)}isActive(t,n){const s=typeof t=="string"?t:null,i=typeof t=="string"?n:t;return V_t(this.state,s,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return nye(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=` `,textSerializers:s={}}=t||{};return z_t(this.state.doc,{blockSeparator:n,textSerializers:{...YFe(this.schema),...s}})}get isEmpty(){return cye(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelector(t,n))||null}$nodes(t,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelectorAll(t,n))||null}$pos(t){const n=this.state.doc.resolve(t);return new Iw(n,this)}get $doc(){return this.$pos(0)}}function bC(e){return new Use({find:e.find,handler:({state:t,range:n,match:s})=>{const i=ua(e.getAttributes,void 0,s);if(i===!1||i===null)return null;const{tr:o}=t,l=s[s.length-1],a=s[0];if(l){const h=a.search(/\S/),p=n.from+a.indexOf(l),x=p+l.length;if(lye(n.from,n.to,t.doc).filter(j=>j.mark.type.excluded.find(C=>C===e.type&&C!==j.mark.type)).filter(j=>j.to>p).length)return null;xn.from&&o.delete(n.from+h,p);const w=n.from+h+l.length;o.addMark(n.from+h,w,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function j2t(e){return new Use({find:e.find,handler:({state:t,range:n,match:s})=>{const i=ua(e.getAttributes,void 0,s)||{},{tr:o}=t,l=n.from;let a=n.to;const h=e.type.create(i);if(s[1]){const p=s[0].lastIndexOf(s[1]);let x=l+p;x>a?x=a:a=x+s[1].length;const y=s[0][s[0].length-1];o.insertText(y,l+s[0].length-1),o.replaceWith(x,a,h)}else if(s[0]){const p=e.type.isInline?l:l-1;o.insert(p,e.type.create(i)).delete(o.mapping.map(l),o.mapping.map(a))}o.scrollIntoView()}})}function Xhe(e){return new Use({find:e.find,handler:({state:t,range:n,match:s})=>{const i=t.doc.resolve(n.from),o=ua(e.getAttributes,void 0,s)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function fE(e){return new Use({find:e.find,handler:({state:t,range:n,match:s,chain:i})=>{const o=ua(e.getAttributes,void 0,s)||{},l=t.tr.delete(n.from,n.to),h=l.doc.resolve(n.from).blockRange(),p=h&&$xe(h,e.type,o);if(!p)return null;if(l.wrap(h,p),e.keepMarks&&e.editor){const{selection:y,storedMarks:w}=t,{splittableMarks:j}=e.editor.extensionManager,S=w||y.$to.parentOffset&&y.$from.marks();if(S){const C=S.filter(A=>j.includes(A.type.name));l.ensureMarks(C)}}if(e.keepAttributes){const y=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(y,o).run()}const x=l.doc.resolve(n.from-1).nodeBefore;x&&x.type===e.type&&iv(l.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(s,x))&&l.join(n.from-1)}})}let Mm=class Qhe{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ua(Ns(this,"addOptions",{name:this.name}))),this.storage=ua(Ns(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Qhe(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>qse(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Qhe(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ua(Ns(n,"addOptions",{name:n.name})),n.storage=ua(Ns(n,"addStorage",{name:n.name,options:n.options})),n}};function Hj(e){return new Fvt({find:e.find,handler:({state:t,range:n,match:s,pasteEvent:i})=>{const o=ua(e.getAttributes,void 0,s,i);if(o===!1||o===null)return null;const{tr:l}=t,a=s[s.length-1],h=s[0];let p=n.to;if(a){const x=h.search(/\S/),y=n.from+h.indexOf(a),w=y+a.length;if(lye(n.from,n.to,t.doc).filter(S=>S.mark.type.excluded.find(A=>A===e.type&&A!==S.mark.type)).filter(S=>S.to>y).length)return null;wn.from&&l.delete(n.from+x,y),p=n.from+x+a.length,l.addMark(n.from+x,p,e.type.create(o||{})),l.removeStoredMark(e.type)}}})}function k2t(e,t){const{selection:n}=e,{$from:s}=n;if(n instanceof si){const o=s.index();return s.parent.canReplaceWith(o,o+1,t)}let i=s.depth;for(;i>=0;){const o=s.index(i);if(s.node(i).contentMatchAt(o).matchType(t))return!0;i-=1}return!1}function N2t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sze={exports:{}},kce={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var BNe;function S2t(){if(BNe)return kce;BNe=1;var e=rt;function t(y,w){return y===w&&(y!==0||1/y===1/w)||y!==y&&w!==w}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function a(y,w){var j=w(),S=s({inst:{value:j,getSnapshot:w}}),C=S[0].inst,A=S[1];return o(function(){C.value=j,C.getSnapshot=w,h(C)&&A({inst:C})},[y,j,w]),i(function(){return h(C)&&A({inst:C}),y(function(){h(C)&&A({inst:C})})},[y]),l(j),j}function h(y){var w=y.getSnapshot;y=y.value;try{var j=w();return!n(y,j)}catch{return!0}}function p(y,w){return w()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:a;return kce.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,kce}sze.exports=S2t();var dye=sze.exports;const C2t=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},M2t=({contentComponent:e})=>{const t=dye.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return rt.createElement(rt.Fragment,null,Object.values(t))};function T2t(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,s){t={...t,[n]:Bme.createPortal(s.reactElement,s.element,n)},e.forEach(i=>i())},removeRenderer(n){const s={...t};delete s[n],t=s,e.forEach(i=>i())}}}class A2t extends rt.Component{constructor(t){var n;super(t),this.editorContentRef=rt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=t.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=T2t(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const t=this.props.editor;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,innerRef:n,...s}=this.props;return rt.createElement(rt.Fragment,null,rt.createElement("div",{ref:C2t(n,this.editorContentRef),...s}),(t==null?void 0:t.contentComponent)&&rt.createElement(M2t,{contentComponent:t.contentComponent}))}}const E2t=P.forwardRef((e,t)=>{const n=rt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return rt.createElement(A2t,{key:n,innerRef:t,...e})}),ize=rt.memo(E2t);var I2t=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var s,i,o;if(Array.isArray(t)){if(s=t.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(s=t.length,s!=n.length)return!1;for(i=s;i--!==0;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),s=o.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=s;i--!==0;){var l=o[i];if(!(l==="_owner"&&t.$$typeof)&&!e(t[l],n[l]))return!1}return!0}return t!==t&&n!==n},P2t=N2t(I2t),aze={exports:{}},Nce={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var $Ne;function L2t(){if($Ne)return Nce;$Ne=1;var e=rt,t=dye;function n(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,a=e.useMemo,h=e.useDebugValue;return Nce.useSyncExternalStoreWithSelector=function(p,x,y,w,j){var S=o(null);if(S.current===null){var C={hasValue:!1,value:null};S.current=C}else C=S.current;S=a(function(){function E(q){if(!T){if(T=!0,O=q,q=w(q),j!==void 0&&C.hasValue){var H=C.value;if(j(H,q))return z=H}return z=q}if(H=z,s(O,q))return H;var K=w(q);return j!==void 0&&j(H,K)?H:(O=q,z=K)}var T=!1,O,z,F=y===void 0?null:y;return[function(){return E(x())},F===null?void 0:function(){return E(F())}]},[x,y,w,j]);var A=i(p,S[0],S[1]);return l(function(){C.hasValue=!0,C.value=A},[A]),h(A),A},Nce}aze.exports=L2t();var O2t=aze.exports;const D2t=typeof window<"u"?P.useLayoutEffect:P.useEffect;class R2t{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},s=this.editor;return s.on("transaction",n),()=>{s.off("transaction",n)}}}}function F2t(e){var t;const[n]=P.useState(()=>new R2t(e.editor)),s=O2t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:P2t);return D2t(()=>n.watch(e.editor),[e.editor,n]),P.useDebugValue(s),s}const z2t=!1,Jhe=typeof window>"u",B2t=Jhe||!!(typeof window<"u"&&window.next);class uye{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Jhe||B2t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...s)},onBlur:(...s)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...s)},onCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...s)},onDestroy:(...s)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...s)},onFocus:(...s)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...s)},onSelectionUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...s)},onTransaction:(...s)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...s)},onUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...s)},onContentError:(...s)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...s)},onDrop:(...s)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...s)},onPaste:(...s)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...s)}};return new w2t(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((i,o)=>{var l;return i===((l=n.extensions)===null||l===void 0?void 0:l[o])}):t[s]===n[s])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?uye.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((s,i)=>s===t[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}}function oze(e={},t=[]){const n=P.useRef(e);n.current=e;const[s]=P.useState(()=>new uye(n)),i=dye.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return P.useDebugValue(i),P.useEffect(s.onRender(t)),F2t({editor:i,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),i}const $2t=P.createContext({editor:null});$2t.Consumer;const U2t=P.createContext({onDragStart:void 0}),q2t=()=>P.useContext(U2t);rt.forwardRef((e,t)=>{const{onDragStart:n}=q2t(),s=e.as||"div";return rt.createElement(s,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});const V2t=/^\s*>\s$/,H2t=Mm.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[fE({find:V2t,type:this.type})]}}),W2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,G2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,K2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Z2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Y2t=Lg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bC({find:W2t,type:this.type}),bC({find:K2t,type:this.type})]},addPasteRules(){return[Hj({find:G2t,type:this.type}),Hj({find:Z2t,type:this.type})]}}),X2t="listItem",UNe="textStyle",qNe=/^\s*([-+*])\s$/,Q2t=Mm.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(X2t,this.editor.getAttributes(UNe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=fE({find:qNe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=fE({find:qNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(UNe),editor:this.editor})),[e]}}),J2t=/(^|[^`])`([^`]+)`(?!`)/,ebt=/(^|[^`])`([^`]+)`(?!`)/g,tbt=Lg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bC({find:J2t,type:this.type})]},addPasteRules(){return[Hj({find:ebt,type:this.type})]}}),rbt=/^```([a-z]+)?[\s\n]$/,nbt=/^~~~([a-z]+)?[\s\n]$/,sbt=Mm.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",gd(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type)return!1;const o=s.parentOffset===s.parent.nodeSize-2,l=s.parent.textContent.endsWith(` `);return!o||!l?!1:e.chain().command(({tr:a})=>(a.delete(s.pos-2,s.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:s}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:s.nodeAt(a)?e.commands.command(({tr:p})=>(p.setSelection(la.near(s.resolve(a))),!0)):e.commands.exitCode()}}},addInputRules(){return[Xhe({find:rbt,type:this.type,getAttributes:e=>({language:e[1]})}),Xhe({find:nbt,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new zd({key:new cf("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),s=t.clipboardData.getData("vscode-editor-data"),i=s?JSON.parse(s):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:l,schema:a}=e.state,h=a.text(n.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},h)),l.selection.$from.parent.type!==this.type&&l.setSelection(Ui.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),e.dispatch(l),!0}}})]}}),ibt=Mm.create({name:"doc",topNode:!0,content:"block+"});function abt(e={}){return new zd({view(t){return new obt(t,e)}})}class obt{constructor(t,n){var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=l=>{this[i](l)};return t.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,s,i=this.editorView.dom,o=i.getBoundingClientRect(),l=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let y=t.nodeBefore,w=t.nodeAfter;if(y||w){let j=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(j){let S=j.getBoundingClientRect(),C=y?S.bottom:S.top;y&&w&&(C=(C+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let A=this.width/2*a;s={left:S.left,right:S.right,top:C-A,bottom:C+A}}}}if(!s){let y=this.editorView.coordsAtPos(this.cursorPos),w=this.width/2*l;s={left:y.left-w,right:y.left+w,top:y.top,bottom:y.bottom}}let h=this.editorView.dom.offsetParent;this.element||(this.element=h.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let p,x;if(!h||h==document.body&&getComputedStyle(h).position=="static")p=-pageXOffset,x=-pageYOffset;else{let y=h.getBoundingClientRect(),w=y.width/h.offsetWidth,j=y.height/h.offsetHeight;p=y.left-h.scrollLeft*w,x=y.top-h.scrollTop*j}this.element.style.left=(s.left-p)/l+"px",this.element.style.top=(s.top-x)/a+"px",this.element.style.width=(s.right-s.left)/l+"px",this.element.style.height=(s.bottom-s.top)/a+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=s&&s.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,t):i;if(n&&!o){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=HRe(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const lbt=Rd.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[abt(this.options)]}});class Wl extends la{constructor(t){super(t,t)}map(t,n){let s=t.resolve(n.map(this.head));return Wl.valid(s)?new Wl(s):la.near(s)}content(){return fs.empty}eq(t){return t instanceof Wl&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Wl(t.resolve(n.pos))}getBookmark(){return new hye(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!cbt(t)||!dbt(t))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let i=n.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,n,s=!1){e:for(;;){if(!s&&Wl.valid(t))return t;let i=t.pos,o=null;for(let l=t.depth;;l--){let a=t.node(l);if(n>0?t.indexAfter(l)0){o=a.child(n>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;i+=n;let h=t.doc.resolve(i);if(Wl.valid(h))return h}for(;;){let l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!si.isSelectable(o)){t=t.doc.resolve(i+o.nodeSize*n),s=!1;continue e}break}o=l,i+=n;let a=t.doc.resolve(i);if(Wl.valid(a))return a}return null}}}Wl.prototype.visible=!1;Wl.findFrom=Wl.findGapCursorFrom;la.jsonID("gapcursor",Wl);class hye{constructor(t){this.pos=t}map(t){return new hye(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Wl.valid(n)?new Wl(n):la.near(n)}}function lze(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function cbt(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),s=e.node(t);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||lze(i.type))return!0;if(i.inlineContent)return!1}}return!0}function dbt(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),s=e.node(t);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||lze(i.type))return!0;if(i.inlineContent)return!1}}return!0}function ubt(){return new zd({props:{decorations:mbt,createSelectionBetween(e,t,n){return t.pos==n.pos&&Wl.valid(n)?new Wl(n):null},handleClick:fbt,handleKeyDown:hbt,handleDOMEvents:{beforeinput:pbt}}})}const hbt=LFe({ArrowLeft:EL("horiz",-1),ArrowRight:EL("horiz",1),ArrowUp:EL("vert",-1),ArrowDown:EL("vert",1)});function EL(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(s,i,o){let l=s.selection,a=t>0?l.$to:l.$from,h=l.empty;if(l instanceof Ui){if(!o.endOfTextblock(n)||a.depth==0)return!1;h=!1,a=s.doc.resolve(t>0?a.after():a.before())}let p=Wl.findGapCursorFrom(a,t,h);return p?(i&&i(s.tr.setSelection(new Wl(p))),!0):!1}}function fbt(e,t,n){if(!e||!e.editable)return!1;let s=e.state.doc.resolve(t);if(!Wl.valid(s))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&si.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Wl(s))),!0)}function pbt(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Wl))return!1;let{$from:n}=e.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!s)return!1;let i=yn.empty;for(let l=s.length-1;l>=0;l--)i=yn.from(s[l].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new fs(i,0,0));return o.setSelection(Ui.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function mbt(e){if(!(e.selection instanceof Wl))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Fc.create(e.doc,[Bf.widget(e.selection.head,t,{key:"gapcursor"})])}const gbt=Rd.create({name:"gapCursor",addProseMirrorPlugins(){return[ubt()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=ua(Ns(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),xbt=Mm.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",gd(this.options.HTMLAttributes,e)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:s})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:a}=s.extensionManager,h=o||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:p,dispatch:x})=>{if(x&&h&&l){const y=h.filter(w=>a.includes(w.type.name));p.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ybt=Mm.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,gd(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Xhe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var Rte=200,pd=function(){};pd.prototype.append=function(t){return t.length?(t=pd.from(t),!this.length&&t||t.length=n?pd.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};pd.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};pd.prototype.forEach=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(t,n,s,0):this.forEachInvertedInner(t,n,s,0)};pd.prototype.map=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var i=[];return this.forEach(function(o,l){return i.push(t(o,l))},n,s),i};pd.from=function(t){return t instanceof pd?t:t&&t.length?new cze(t):pd.empty};var cze=function(e){function t(s){e.call(this),this.values=s}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new t(this.values.slice(i,o))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,o,l,a){for(var h=o;h=l;h--)if(i(this.values[h],a+h)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=Rte)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=Rte)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(pd);pd.empty=new cze([]);var vbt=function(e){function t(n,s){e.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(s){return sa&&this.right.forEachInner(s,Math.max(i-a,0),Math.min(this.length,o)-a,l+a)===!1)return!1},t.prototype.forEachInvertedInner=function(s,i,o,l){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(s,i-a,Math.max(o,a)-a,l+a)===!1||o=o?this.right.slice(s-o,i-o):this.left.slice(s,o).append(this.right.slice(0,i-o))},t.prototype.leafAppend=function(s){var i=this.right.leafAppend(s);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(s){var i=this.left.leafPrepend(s);if(i)return new t(i,this.right)},t.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new t(this.left,new t(this.right,s)):new t(this,s)},t}(pd);const _bt=500;class nm{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let i,o;n&&(i=this.remapping(s,this.items.length),o=i.maps.length);let l=t.tr,a,h,p=[],x=[];return this.items.forEach((y,w)=>{if(!y.step){i||(i=this.remapping(s,w+1),o=i.maps.length),o--,x.push(y);return}if(i){x.push(new tg(y.map));let j=y.step.map(i.slice(o)),S;j&&l.maybeStep(j).doc&&(S=l.mapping.maps[l.mapping.maps.length-1],p.push(new tg(S,void 0,void 0,p.length+x.length))),o--,S&&i.appendMap(S,o)}else l.maybeStep(y.step);if(y.selection)return a=i?y.selection.map(i.slice(o)):y.selection,h=new nm(this.items.slice(0,s).append(x.reverse().concat(p)),this.eventCount-1),!1},this.items.length,0),{remaining:h,transform:l,selection:a}}addTransform(t,n,s,i){let o=[],l=this.eventCount,a=this.items,h=!i&&a.length?a.get(a.length-1):null;for(let x=0;xwbt&&(a=bbt(a,p),l-=p),new nm(a.append(o),l)}remapping(t,n){let s=new aE;return this.items.forEach((i,o)=>{let l=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?s.maps.length-i.mirrorOffset:void 0;s.appendMap(i.map,l)},t,n),s}addMaps(t){return this.eventCount==0?this:new nm(this.items.append(t.map(n=>new tg(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let s=[],i=Math.max(0,this.items.length-n),o=t.mapping,l=t.steps.length,a=this.eventCount;this.items.forEach(w=>{w.selection&&a--},i);let h=n;this.items.forEach(w=>{let j=o.getMirror(--h);if(j==null)return;l=Math.min(l,j);let S=o.maps[j];if(w.step){let C=t.steps[j].invert(t.docs[j]),A=w.selection&&w.selection.map(o.slice(h+1,j));A&&a++,s.push(new tg(S,C,A))}else s.push(new tg(S))},i);let p=[];for(let w=n;w_bt&&(y=y.compress(this.items.length-s.length)),y}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),s=n.maps.length,i=[],o=0;return this.items.forEach((l,a)=>{if(a>=t)i.push(l),l.selection&&o++;else if(l.step){let h=l.step.map(n.slice(s)),p=h&&h.getMap();if(s--,p&&n.appendMap(p,s),h){let x=l.selection&&l.selection.map(n.slice(s));x&&o++;let y=new tg(p.invert(),h,x),w,j=i.length-1;(w=i.length&&i[j].merge(y))?i[j]=w:i.push(y)}}else l.map&&s--},this.items.length,0),new nm(pd.from(i.reverse()),o)}}nm.empty=new nm(pd.empty,0);function bbt(e,t){let n;return e.forEach((s,i)=>{if(s.selection&&t--==0)return n=i,!1}),e.slice(n)}class tg{constructor(t,n,s,i){this.map=t,this.step=n,this.selection=s,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new tg(n.getMap().invert(),n,this.selection)}}}class v0{constructor(t,n,s,i,o){this.done=t,this.undone=n,this.prevRanges=s,this.prevTime=i,this.prevComposition=o}}const wbt=20;function jbt(e,t,n,s){let i=n.getMeta(kj),o;if(i)return i.historyState;n.getMeta(Sbt)&&(e=new v0(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(l&&l.getMeta(kj))return l.getMeta(kj).redo?new v0(e.done.addTransform(n,void 0,s,fee(t)),e.undone,VNe(n.mapping.maps),e.prevTime,e.prevComposition):new v0(e.done,e.undone.addTransform(n,void 0,s,fee(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),h=e.prevTime==0||!l&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-s.newGroupDelay||!kbt(n,e.prevRanges)),p=l?Sce(e.prevRanges,n.mapping):VNe(n.mapping.maps);return new v0(e.done.addTransform(n,h?t.selection.getBookmark():void 0,s,fee(t)),nm.empty,p,n.time,a??e.prevComposition)}else return(o=n.getMeta("rebased"))?new v0(e.done.rebased(n,o),e.undone.rebased(n,o),Sce(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new v0(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Sce(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function kbt(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((s,i)=>{for(let o=0;o=t[o]&&(n=!0)}),n}function VNe(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((s,i,o,l)=>t.push(o,l));return t}function Sce(e,t){if(!e)return null;let n=[];for(let s=0;s{let i=kj.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(s){let o=Nbt(i,n,e);o&&s(t?o.scrollIntoView():o)}return!0}}const uze=dze(!1,!0),hze=dze(!0,!0),Mbt=Rd.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>uze(e,t),redo:()=>({state:e,dispatch:t})=>hze(e,t)}},addProseMirrorPlugins(){return[Cbt(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Tbt=Mm.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",gd(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!k2t(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$from:s,$to:i}=n,o=e();return s.parentOffset===0?o.insertContentAt({from:Math.max(s.pos-1,0),to:i.pos},{type:this.name}):H_t(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:a})=>{var h;if(a){const{$to:p}=l.selection,x=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(Ui.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(si.create(l.doc,p.pos)):l.setSelection(Ui.create(l.doc,p.pos));else{const y=(h=p.parent.type.contentMatch.defaultType)===null||h===void 0?void 0:h.create();y&&(l.insert(x,y),l.setSelection(Ui.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[j2t({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Abt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ebt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Ibt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Pbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Lbt=Lg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bC({find:Abt,type:this.type}),bC({find:Ibt,type:this.type})]},addPasteRules(){return[Hj({find:Ebt,type:this.type}),Hj({find:Pbt,type:this.type})]}}),Obt=Mm.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",gd(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Dbt="listItem",WNe="textStyle",GNe=/^(\d+)\.\s$/,Rbt=Mm.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",gd(this.options.HTMLAttributes,n),0]:["ol",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Dbt,this.editor.getAttributes(WNe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=fE({find:GNe,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=fE({find:GNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(WNe)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Fbt=Mm.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),zbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Bbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,$bt=Lg.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bC({find:zbt,type:this.type})]},addPasteRules(){return[Hj({find:Bbt,type:this.type})]}}),Ubt=Mm.create({name:"text",group:"inline"}),fze=Rd.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(Y2t.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(H2t.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(Q2t.configure(this.options.bulletList)),this.options.code!==!1&&e.push(tbt.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(sbt.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(ibt.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(lbt.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(gbt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(xbt.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(ybt.configure(this.options.heading)),this.options.history!==!1&&e.push(Mbt.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(Tbt.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Lbt.configure(this.options.italic)),this.options.listItem!==!1&&e.push(Obt.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(Rbt.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Fbt.configure(this.options.paragraph)),this.options.strike!==!1&&e.push($bt.configure(this.options.strike)),this.options.text!==!1&&e.push(Ubt.configure(this.options.text)),e}}),qbt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Vbt="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",efe="numeric",tfe="ascii",rfe="alpha",fA="asciinumeric",pT="alphanumeric",nfe="domain",pze="emoji",Hbt="scheme",Wbt="slashscheme",Mce="whitespace";function Gbt(e,t){return e in t||(t[e]=[]),t[e]}function qw(e,t,n){t[efe]&&(t[fA]=!0,t[pT]=!0),t[tfe]&&(t[fA]=!0,t[rfe]=!0),t[fA]&&(t[pT]=!0),t[rfe]&&(t[pT]=!0),t[pT]&&(t[nfe]=!0),t[pze]&&(t[nfe]=!0);for(const s in t){const i=Gbt(s,n);i.indexOf(e)<0&&i.push(e)}}function Kbt(e,t){const n={};for(const s in t)t[s].indexOf(e)>=0&&(n[s]=!0);return n}function lh(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}lh.groups={};lh.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let s=0;se.ta(t,n,s,i),zl=(e,t,n,s,i)=>e.tr(t,n,s,i),KNe=(e,t,n,s,i)=>e.ts(t,n,s,i),Cn=(e,t,n,s,i)=>e.tt(t,n,s,i),vx="WORD",sfe="UWORD",mze="ASCIINUMERICAL",gze="ALPHANUMERICAL",pE="LOCALHOST",ife="TLD",afe="UTLD",pee="SCHEME",b4="SLASH_SCHEME",fye="NUM",ofe="WS",pye="NL",pA="OPENBRACE",mA="CLOSEBRACE",Fte="OPENBRACKET",zte="CLOSEBRACKET",Bte="OPENPAREN",$te="CLOSEPAREN",Ute="OPENANGLEBRACKET",qte="CLOSEANGLEBRACKET",Vte="FULLWIDTHLEFTPAREN",Hte="FULLWIDTHRIGHTPAREN",Wte="LEFTCORNERBRACKET",Gte="RIGHTCORNERBRACKET",Kte="LEFTWHITECORNERBRACKET",Zte="RIGHTWHITECORNERBRACKET",Yte="FULLWIDTHLESSTHAN",Xte="FULLWIDTHGREATERTHAN",Qte="AMPERSAND",Jte="APOSTROPHE",ere="ASTERISK",_0="AT",tre="BACKSLASH",rre="BACKTICK",nre="CARET",C0="COLON",mye="COMMA",sre="DOLLAR",rg="DOT",ire="EQUALS",gye="EXCLAMATION",Mf="HYPHEN",gA="PERCENT",are="PIPE",ore="PLUS",lre="POUND",xA="QUERY",xye="QUOTE",xze="FULLWIDTHMIDDLEDOT",yye="SEMI",ng="SLASH",yA="TILDE",cre="UNDERSCORE",yze="EMOJI",dre="SYM";var vze=Object.freeze({__proto__:null,ALPHANUMERICAL:gze,AMPERSAND:Qte,APOSTROPHE:Jte,ASCIINUMERICAL:mze,ASTERISK:ere,AT:_0,BACKSLASH:tre,BACKTICK:rre,CARET:nre,CLOSEANGLEBRACKET:qte,CLOSEBRACE:mA,CLOSEBRACKET:zte,CLOSEPAREN:$te,COLON:C0,COMMA:mye,DOLLAR:sre,DOT:rg,EMOJI:yze,EQUALS:ire,EXCLAMATION:gye,FULLWIDTHGREATERTHAN:Xte,FULLWIDTHLEFTPAREN:Vte,FULLWIDTHLESSTHAN:Yte,FULLWIDTHMIDDLEDOT:xze,FULLWIDTHRIGHTPAREN:Hte,HYPHEN:Mf,LEFTCORNERBRACKET:Wte,LEFTWHITECORNERBRACKET:Kte,LOCALHOST:pE,NL:pye,NUM:fye,OPENANGLEBRACKET:Ute,OPENBRACE:pA,OPENBRACKET:Fte,OPENPAREN:Bte,PERCENT:gA,PIPE:are,PLUS:ore,POUND:lre,QUERY:xA,QUOTE:xye,RIGHTCORNERBRACKET:Gte,RIGHTWHITECORNERBRACKET:Zte,SCHEME:pee,SEMI:yye,SLASH:ng,SLASH_SCHEME:b4,SYM:dre,TILDE:yA,TLD:ife,UNDERSCORE:cre,UTLD:afe,UWORD:sfe,WORD:vx,WS:ofe});const mx=/[a-z]/,UM=new RegExp("\\p{L}","u"),Tce=new RegExp("\\p{Emoji}","u"),gx=/\d/,Ace=/\s/,ZNe="\r",Ece=` `,Zbt="️",Ybt="‍",Ice="";let IL=null,PL=null;function Xbt(e=[]){const t={};lh.groups=t;const n=new lh;IL==null&&(IL=YNe(qbt)),PL==null&&(PL=YNe(Vbt)),Cn(n,"'",Jte),Cn(n,"{",pA),Cn(n,"}",mA),Cn(n,"[",Fte),Cn(n,"]",zte),Cn(n,"(",Bte),Cn(n,")",$te),Cn(n,"<",Ute),Cn(n,">",qte),Cn(n,"(",Vte),Cn(n,")",Hte),Cn(n,"「",Wte),Cn(n,"」",Gte),Cn(n,"『",Kte),Cn(n,"』",Zte),Cn(n,"<",Yte),Cn(n,">",Xte),Cn(n,"&",Qte),Cn(n,"*",ere),Cn(n,"@",_0),Cn(n,"`",rre),Cn(n,"^",nre),Cn(n,":",C0),Cn(n,",",mye),Cn(n,"$",sre),Cn(n,".",rg),Cn(n,"=",ire),Cn(n,"!",gye),Cn(n,"-",Mf),Cn(n,"%",gA),Cn(n,"|",are),Cn(n,"+",ore),Cn(n,"#",lre),Cn(n,"?",xA),Cn(n,'"',xye),Cn(n,"/",ng),Cn(n,";",yye),Cn(n,"~",yA),Cn(n,"_",cre),Cn(n,"\\",tre),Cn(n,"・",xze);const s=zl(n,gx,fye,{[efe]:!0});zl(s,gx,s);const i=zl(s,mx,mze,{[fA]:!0}),o=zl(s,UM,gze,{[pT]:!0}),l=zl(n,mx,vx,{[tfe]:!0});zl(l,gx,i),zl(l,mx,l),zl(i,gx,i),zl(i,mx,i);const a=zl(n,UM,sfe,{[rfe]:!0});zl(a,mx),zl(a,gx,o),zl(a,UM,a),zl(o,gx,o),zl(o,mx),zl(o,UM,o);const h=Cn(n,Ece,pye,{[Mce]:!0}),p=Cn(n,ZNe,ofe,{[Mce]:!0}),x=zl(n,Ace,ofe,{[Mce]:!0});Cn(n,Ice,x),Cn(p,Ece,h),Cn(p,Ice,x),zl(p,Ace,x),Cn(x,ZNe),Cn(x,Ece),zl(x,Ace,x),Cn(x,Ice,x);const y=zl(n,Tce,yze,{[pze]:!0});Cn(y,"#"),zl(y,Tce,y),Cn(y,Zbt,y);const w=Cn(y,Ybt);Cn(w,"#"),zl(w,Tce,y);const j=[[mx,l],[gx,i]],S=[[mx,null],[UM,a],[gx,o]];for(let C=0;CC[0]>A[0]?1:-1);for(let C=0;C=0?T[nfe]=!0:mx.test(A)?gx.test(A)?T[fA]=!0:T[tfe]=!0:T[efe]=!0,KNe(n,A,A,T)}return KNe(n,"localhost",pE,{ascii:!0}),n.jd=new lh(dre),{start:n,tokens:Object.assign({groups:t},vze)}}function _ze(e,t){const n=Qbt(t.replace(/[A-Z]/g,a=>a.toLowerCase())),s=n.length,i=[];let o=0,l=0;for(;l=0&&(y+=n[l].length,w++),p+=n[l].length,o+=n[l].length,l++;o-=y,l-=w,p-=y,i.push({t:x.t,v:t.slice(o-p,o),s:o-p,e:o})}return i}function Qbt(e){const t=[],n=e.length;let s=0;for(;s56319||s+1===n||(o=e.charCodeAt(s+1))<56320||o>57343?e[s]:e.slice(s,s+2);t.push(l),s+=l.length}return t}function i0(e,t,n,s,i){let o;const l=t.length;for(let a=0;a=0;)o++;if(o>0){t.push(n.join(""));for(let l=parseInt(e.substring(s,s+o),10);l>0;l--)n.pop();s+=o}else n.push(e[s]),s++}return t}const mE={defaultProtocol:"http",events:null,format:XNe,formatHref:XNe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function vye(e,t=null){let n=Object.assign({},mE);e&&(n=Object.assign(n,e instanceof vye?e.o:e));const s=n.ignoreTags,i=[];for(let o=0;on?s.substring(0,n)+"…":s},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=mE.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),s=e.get("formatHref",n,this),i=e.get("tagName",n,t),o=this.toFormattedString(e),l={},a=e.get("className",n,t),h=e.get("target",n,t),p=e.get("rel",n,t),x=e.getObj("attributes",n,t),y=e.getObj("events",n,t);return l.href=s,a&&(l.class=a),h&&(l.target=h),p&&(l.rel=p),x&&Object.assign(l,x),{tagName:i,attributes:l,content:o,eventListeners:y}}};function Hse(e,t){class n extends bze{constructor(i,o){super(i,o),this.t=e}}for(const s in t)n.prototype[s]=t[s];return n.t=e,n}const QNe=Hse("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),JNe=Hse("text"),Jbt=Hse("nl"),LL=Hse("url",{isLink:!0,toHref(e=mE.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==pE&&e[1].t===C0}}),kf=e=>new lh(e);function ewt({groups:e}){const t=e.domain.concat([Qte,ere,_0,tre,rre,nre,sre,ire,Mf,fye,gA,are,ore,lre,ng,dre,yA,cre]),n=[Jte,C0,mye,rg,gye,gA,xA,xye,yye,Ute,qte,pA,mA,zte,Fte,Bte,$te,Vte,Hte,Wte,Gte,Kte,Zte,Yte,Xte],s=[Qte,Jte,ere,tre,rre,nre,sre,ire,Mf,pA,mA,gA,are,ore,lre,xA,ng,dre,yA,cre],i=kf(),o=Cn(i,yA);aa(o,s,o),aa(o,e.domain,o);const l=kf(),a=kf(),h=kf();aa(i,e.domain,l),aa(i,e.scheme,a),aa(i,e.slashscheme,h),aa(l,s,o),aa(l,e.domain,l);const p=Cn(l,_0);Cn(o,_0,p),Cn(a,_0,p),Cn(h,_0,p);const x=Cn(o,rg);aa(x,s,o),aa(x,e.domain,o);const y=kf();aa(p,e.domain,y),aa(y,e.domain,y);const w=Cn(y,rg);aa(w,e.domain,y);const j=kf(QNe);aa(w,e.tld,j),aa(w,e.utld,j),Cn(p,pE,j);const S=Cn(y,Mf);Cn(S,Mf,S),aa(S,e.domain,y),aa(j,e.domain,y),Cn(j,rg,w),Cn(j,Mf,S);const C=Cn(j,C0);aa(C,e.numeric,QNe);const A=Cn(l,Mf),E=Cn(l,rg);Cn(A,Mf,A),aa(A,e.domain,l),aa(E,s,o),aa(E,e.domain,l);const T=kf(LL);aa(E,e.tld,T),aa(E,e.utld,T),aa(T,e.domain,l),aa(T,s,o),Cn(T,rg,E),Cn(T,Mf,A),Cn(T,_0,p);const O=Cn(T,C0),z=kf(LL);aa(O,e.numeric,z);const F=kf(LL),q=kf();aa(F,t,F),aa(F,n,q),aa(q,t,F),aa(q,n,q),Cn(T,ng,F),Cn(z,ng,F);const H=Cn(a,C0),K=Cn(h,C0),Z=Cn(K,ng),re=Cn(Z,ng);aa(a,e.domain,l),Cn(a,rg,E),Cn(a,Mf,A),aa(h,e.domain,l),Cn(h,rg,E),Cn(h,Mf,A),aa(H,e.domain,F),Cn(H,ng,F),Cn(H,xA,F),aa(re,e.domain,F),aa(re,t,F),Cn(re,ng,F);const ue=[[pA,mA],[Fte,zte],[Bte,$te],[Ute,qte],[Vte,Hte],[Wte,Gte],[Kte,Zte],[Yte,Xte]];for(let he=0;he=0&&w++,i++,x++;if(w<0)i-=x,i0&&(o.push(Pce(JNe,t,l)),l=[]),i-=w,x-=w;const j=y.t,S=n.slice(i-x,i);o.push(Pce(j,t,S))}}return l.length>0&&o.push(Pce(JNe,t,l)),o}function Pce(e,t,n){const s=n[0].s,i=n[n.length-1].e,o=t.slice(s,i);return new e(o,n)}const rwt=typeof console<"u"&&console&&console.warn||(()=>{}),nwt="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ul={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function swt(){return lh.groups={},ul.scanner=null,ul.parser=null,ul.tokenQueue=[],ul.pluginQueue=[],ul.customSchemes=[],ul.initialized=!1,ul}function e4e(e,t=!1){if(ul.initialized&&rwt(`linkifyjs: already initialized - will not register custom scheme "${e}" ${nwt}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);ul.customSchemes.push([e,t])}function iwt(){ul.scanner=Xbt(ul.customSchemes);for(let e=0;e{const i=t.some(p=>p.docChanged)&&!n.doc.eq(s.doc),o=t.some(p=>p.getMeta("preventAutolink"));if(!i||o)return;const{tr:l}=s,a=O_t(n.doc,[...t]);if(q_t(a).forEach(({newRange:p})=>{const x=R_t(s.doc,p,j=>j.isTextblock);let y,w;if(x.length>1)y=x[0],w=s.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(x.length){const j=s.doc.textBetween(p.from,p.to," "," ");if(!owt.test(j))return;y=x[0],w=s.doc.textBetween(y.pos,p.to,void 0," ")}if(y&&w){const j=w.split(awt).filter(Boolean);if(j.length<=0)return!1;const S=j[j.length-1],C=y.pos+w.lastIndexOf(S);if(!S)return!1;const A=_ye(S).map(E=>E.toObject(e.defaultProtocol));if(!cwt(A))return!1;A.filter(E=>E.isLink).map(E=>({...E,from:C+E.start+1,to:C+E.end+1})).filter(E=>s.schema.marks.code?!s.doc.rangeHasMark(E.from,E.to,s.schema.marks.code):!0).filter(E=>e.validate(E.value)).filter(E=>e.shouldAutoLink(E.value)).forEach(E=>{lye(E.from,E.to,s.doc).some(T=>T.mark.type===e.type)||l.addMark(E.from,E.to,e.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function uwt(e){return new zd({key:new cf("handleClickLink"),props:{handleClick:(t,n,s)=>{var i,o;if(s.button!==0||!t.editable)return!1;let l=s.target;const a=[];for(;l.nodeName!=="DIV";)a.push(l),l=l.parentNode;if(!a.find(w=>w.nodeName==="A"))return!1;const h=nze(t.state,e.type.name),p=s.target,x=(i=p==null?void 0:p.href)!==null&&i!==void 0?i:h.href,y=(o=p==null?void 0:p.target)!==null&&o!==void 0?o:h.target;return p&&x?(window.open(x,y),!0):!1}}})}function hwt(e){return new zd({key:new cf("handlePasteLink"),props:{handlePaste:(t,n,s)=>{const{state:i}=t,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";s.content.forEach(p=>{a+=p.textContent});const h=wze(a,{defaultProtocol:e.defaultProtocol}).find(p=>p.isLink&&p.value===a);return!a||!h?!1:e.editor.commands.setMark(e.type,{href:h.href})}}})}function i_(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(s=>{const i=typeof s=="string"?s:s.scheme;i&&n.push(i)}),!e||e.replace(lwt,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const jze=Lg.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){e4e(e);return}e4e(e.scheme,e.optionalSlashes)})},onDestroy(){swt()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!i_(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!i_(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!i_(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",gd(this.options.HTMLAttributes,e),0]:["a",gd(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!i_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!i_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Hj({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:s}=this.options,i=wze(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!i_(l,n),protocols:n,defaultProtocol:s}));i.length&&i.forEach(o=>t.push({text:o.value,data:{href:o.href},index:o.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(dwt({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:i=>!!i_(i,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(uwt({type:this.type})),this.options.linkOnPaste&&e.push(hwt({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),kze=Rd.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).every(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).every(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),fwt=e=>{if(!e.children.length)return;const t=e.querySelectorAll("span");t&&t.forEach(n=>{var s,i;const o=n.getAttribute("style"),l=(i=(s=n.parentElement)===null||s===void 0?void 0:s.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");n.setAttribute("style",`${l};${o}`)})},Nze=Lg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&fwt(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",gd(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(n,s)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||e.removeMark(s,s+n.nodeSize,this.type)}),!0}}}});function py({content:e,onChange:t,placeholder:n="Enter content...",minHeight:s="150px"}){const[i,o]=P.useState(!1),[l,a]=P.useState(""),[h,p]=P.useState(!0),x=oze({extensions:[fze,jze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),kze.configure({types:["heading","paragraph"]}),Nze],content:e,onUpdate:({editor:S})=>{t(S.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n}}});P.useEffect(()=>{x&&e!==x.getHTML()&&x.commands.setContent(e)},[e,x]);const y=()=>{if(!x)return;const S=x.getAttributes("link").href||"",C=x.getAttributes("link").target;a(S),p(C==="_blank"),o(!0)},w=()=>{x&&(l===""?x.chain().focus().extendMarkRange("link").unsetLink().run():x.chain().focus().extendMarkRange("link").setLink({href:l,target:h?"_blank":null,rel:h?"noopener noreferrer nofollow":null}).run(),o(!1),a(""))},j=()=>{x&&x.chain().focus().extendMarkRange("link").unsetLink().run()};return x?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),className:x.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(ET,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),className:x.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(IT,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBold().run(),className:x.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleItalic().run(),className:x.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(nS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBulletList().run(),className:x.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(Hf,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleOrderedList().run(),className:x.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(oS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("left").run(),className:x.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(Z4,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("center").run(),className:x.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(K4,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("right").run(),className:x.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(Y4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:y,className:x.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(So,{className:"h-4 w-4"})}),x.isActive("link")&&r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:j,title:"Remove Link",children:r.jsx(So,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().undo().run(),disabled:!x.can().undo(),title:"Undo",children:r.jsx(mS,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().redo().run(),disabled:!x.can().redo(),title:"Redo",children:r.jsx(fS,{className:"h-4 w-4"})})]}),r.jsx(ize,{editor:x,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none",style:{minHeight:s}})]}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"link-url",children:"URL"}),r.jsx(ct,{id:"link-url",value:l,onChange:S=>a(S.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx($s,{id:"link-new-tab",checked:h,onCheckedChange:p}),r.jsx(Ve,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(ri,{children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(J,{type:"button",onClick:w,children:l?"Apply Link":"Remove Link"})]})]})})]}):null}const Wse=async e=>{try{const{data:t,error:n}=await ee.from("push_notification_settings").select("is_enabled").eq("setting_key",e).maybeSingle();return n?(console.error("Error checking notification setting:",n),!0):(t==null?void 0:t.is_enabled)??!0}catch(t){return console.error("Error checking notification setting:",t),!0}},LI=async e=>{try{const{data:t,error:n}=await ee.functions.invoke("send-push-notification",{body:e});return n?(console.error("Error sending notification:",n),{success:!1,error:n}):(console.log("Notification sent:",t),{success:!0,data:t})}catch(t){return console.error("Error sending notification:",t),{success:!1,error:t}}},pwt=async(e,t)=>await Wse("new_templates")?LI({title:"New Template Available",body:`Check out the new template: ${e}`,url:`/templates/${t}`}):(console.log("New template notifications are disabled"),{success:!1,skipped:!0}),mwt=async(e,t)=>LI({title:"New Academy Video",body:`New video added: ${e}`,url:`/academy/${t}`}),gwt=async(e,t)=>await Wse("new_events")?LI({title:"New Event",body:`New event: ${e}`,url:`/events/${t}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),xwt=async(e,t)=>await Wse("new_toolbox")?LI({title:"New Resource Kit",body:`New resource kit available: ${e}`,url:`/toolbox/${t}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),lfe=async(e,t)=>await Wse("new_social_swag")?LI({title:"New Social Swag",body:`New social swag available: ${e}`,url:`/social-swag/${t}`}):(console.log("New social swag notifications are disabled"),{success:!1,skipped:!0}),OL={title:"",description:"",image_url:"",video_url:"",event_date:void 0,event_time:"12:00",zoom_link:"",zoom_meeting_id:"",capacity:"",is_published:!1};function ywt(){const e=ns(),t=Wr(),[n,s]=P.useState(!1),[i,o]=P.useState(null),[l,a]=P.useState(OL),[h,p]=P.useState(null),[x,y]=P.useState(null),[w,j]=P.useState(!1),S=P.useRef(null),[C,A]=P.useState(!1),[E,T]=P.useState(null),[O,z]=P.useState(!1),[F,q]=P.useState(null),[H,K]=P.useState(null),[Z,re]=P.useState(!0),[ue,he]=P.useState(""),{data:be,isLoading:ne}=Jt({queryKey:["admin-events"],queryFn:async()=>{const{data:Ae,error:pt}=await ee.from("events").select("*").order("event_date",{ascending:!0});if(pt)throw pt;return Ae}}),{data:ye}=Jt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:Ae,error:pt}=await ee.from("event_registrations").select("event_id");if(pt)throw pt;const Be={};return Ae.forEach(Qe=>{Be[Qe.event_id]=(Be[Qe.event_id]||0)+1}),Be}}),{data:ie,isLoading:fe}=Jt({queryKey:["event-registrations-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Ae,error:pt}=await ee.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",E.id).order("registered_at",{ascending:!1});if(pt)throw pt;if(!Ae||Ae.length===0)return[];const Be=Ae.map(ht=>ht.user_id).filter(Boolean);let Qe=[];if(Be.length>0){const{data:ht,error:wt}=await ee.from("profiles").select("id, name, email").in("id",Be);if(wt)throw wt;Qe=ht||[]}const tt=new Map((Qe==null?void 0:Qe.map(ht=>[ht.id,ht]))||[]);return Ae.map(ht=>({...ht,profiles:ht.user_id&&tt.get(ht.user_id)||null}))},enabled:!!E}),{data:de,isLoading:_e}=Jt({queryKey:["event-attendees-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Ae,error:pt}=await ee.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",E.id).order("created_at",{ascending:!1});if(pt)throw pt;if(!Ae||Ae.length===0)return[];const Be=Ae.map(Ct=>Ct.user_id).filter(Boolean);let Qe=[];if(Be.length>0){const{data:Ct,error:It}=await ee.from("profiles").select("id, name, email").in("id",Be);if(It)throw It;Qe=Ct||[]}const{data:tt}=await ee.from("agent_points").select("user_id").eq("event_id",E.id),ht=new Set((tt==null?void 0:tt.map(Ct=>Ct.user_id))||[]),wt=new Map((Qe==null?void 0:Qe.map(Ct=>[Ct.id,Ct]))||[]);return Ae.map(Ct=>({...Ct,profiles:Ct.user_id&&wt.get(Ct.user_id)||null,points_awarded:Ct.user_id?ht.has(Ct.user_id):!1}))},enabled:!!E}),Ee=Ae=>{T(Ae),A(!0)},ke=cr({mutationFn:async Ae=>{const{data:{session:pt}}=await ee.auth.getSession();if(!pt)throw new Error("Not authenticated");const Be=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${pt.access_token}`},body:JSON.stringify({event_id:Ae})}),Qe=await Be.json();if(!Be.ok)throw new Error(Qe.error||"Failed to sync");return Qe},onSuccess:Ae=>{t.invalidateQueries({queryKey:["event-registrations-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-registrations-count"]}),ze.success(Ae.message)},onError:Ae=>{ze.error("Failed to sync: "+Ae.message)}}),pe=cr({mutationFn:async Ae=>{const{data:{session:pt}}=await ee.auth.getSession();if(!pt)throw new Error("Not authenticated");const Be=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${pt.access_token}`},body:JSON.stringify({event_id:Ae})}),Qe=await Be.json();if(!Be.ok)throw new Error(Qe.error||"Failed to sync attendees");return Qe},onSuccess:Ae=>{t.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]}),Ae!=null&&Ae.message?ze.success(Ae.message):ze.success(`Synced ${Ae.synced||0} attendees. ${Ae.points_awarded||0} points awarded!`)},onError:Ae=>{ze.error("Failed to sync attendees: "+Ae.message)}}),ae=cr({mutationFn:async({eventId:Ae,testMode:pt})=>{const{data:{session:Be}}=await ee.auth.getSession();if(!Be)throw new Error("Not authenticated");const Qe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Be.access_token}`},body:JSON.stringify({event_id:Ae,test_mode:pt})}),tt=await Qe.json();if(!Qe.ok)throw new Error(tt.error||"Failed to send reminders");return tt},onSuccess:Ae=>{Ae.test?ze.success(Ae.message||"Test email sent!"):ze.success(Ae.message||`Reminder emails sent to ${Ae.sent} registrants!`)},onError:Ae=>{ze.error("Failed to send reminders: "+Ae.message)}}),{data:ge}=Jt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let Ae=[],pt=0;const Be=1e3;for(;;){const{data:Qe,error:tt}=await ee.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(pt,pt+Be-1);if(tt)throw tt;if(!Qe||Qe.length===0||(Ae=[...Ae,...Qe],Qe.length{const{error:tt}=await ee.from("event_attendees").update({user_id:pt}).eq("id",Ae);if(tt)throw tt;if(Qe&&Be){const{error:wt}=await ee.from("zoom_email_aliases").upsert({user_id:pt,zoom_email:Be.toLowerCase()},{onConflict:"zoom_email"});wt&&console.error("Failed to save alias:",wt)}const ht=E==null?void 0:E.id;if(ht){const{data:wt}=await ee.from("user_roles").select("id").eq("user_id",pt).eq("role","admin").single();if(!wt){const{data:Ct}=await ee.from("agent_points").select("id").eq("user_id",pt).eq("event_id",ht).single();Ct||(await ee.rpc("award_attendance_points",{p_user_id:pt,p_event_id:ht,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await ee.rpc("check_and_award_badges",{p_user_id:pt}))}}return{userId:pt,zoomEmail:Be,shouldSaveAlias:Qe}},onSuccess:Ae=>{t.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]});let pt="Attendee linked and points awarded!";Ae.shouldSaveAlias&&Ae.zoomEmail&&(pt+=` Email "${Ae.zoomEmail}" will be auto-matched in the future.`),ze.success(pt),z(!1),q(null),K(null),he("")},onError:Ae=>{ze.error("Failed to link attendee: "+Ae.message)}}),Ue=Ae=>{q(Ae),K(null),re(!0),he(""),z(!0)},Ie=()=>{!F||!H||Me.mutate({attendeeId:F.id,userId:H,zoomEmail:F.zoom_email,shouldSaveAlias:Z})},Ke=(ge==null?void 0:ge.filter(Ae=>{var Be,Qe;if(!ue)return!0;const pt=ue.toLowerCase();return((Be=Ae.name)==null?void 0:Be.toLowerCase().includes(pt))||((Qe=Ae.email)==null?void 0:Qe.toLowerCase().includes(pt))}))||[],Re=async Ae=>{const pt=Ae.name.split(".").pop(),Qe=`${`${crypto.randomUUID()}.${pt}`}`,{error:tt}=await ee.storage.from("event-images").upload(Qe,Ae);if(tt)throw tt;const{data:{publicUrl:ht}}=ee.storage.from("event-images").getPublicUrl(Qe);return ht},Ce=Ae=>{var Be;const pt=(Be=Ae.target.files)==null?void 0:Be[0];if(pt){if(pt.size>5*1024*1024){ze.error("Image must be less than 5MB");return}p(pt),y(URL.createObjectURL(pt))}},Je=()=>{p(null),y(null),a({...l,image_url:""}),S.current&&(S.current.value="")},Te=cr({mutationFn:async Ae=>{j(!0);let pt=Ae.image_url;h&&(pt=await Re(h)||"");const Be=new Date(Ae.event_date),[Qe,tt]=Ae.event_time.split(":");Be.setHours(parseInt(Qe),parseInt(tt));const{data:ht,error:wt}=await ee.from("events").insert({title:Ae.title,description:Ae.description||null,image_url:pt||null,video_url:Ae.video_url||null,event_date:Be.toISOString(),zoom_link:Ae.zoom_link,zoom_meeting_id:Ae.zoom_meeting_id||null,capacity:Ae.capacity?parseInt(Ae.capacity):null,is_published:Ae.is_published}).select().single();if(wt)throw wt;ht&&gwt(Ae.title,ht.id)},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event created successfully"),s(!1),a(OL),p(null),y(null),j(!1)},onError:Ae=>{ze.error("Failed to create event: "+Ae.message),j(!1)}}),Ye=cr({mutationFn:async({id:Ae,data:pt})=>{j(!0);let Be=pt.image_url;h&&(Be=await Re(h)||"");const Qe=new Date(pt.event_date),[tt,ht]=pt.event_time.split(":");Qe.setHours(parseInt(tt),parseInt(ht));const{error:wt}=await ee.from("events").update({title:pt.title,description:pt.description||null,image_url:Be||null,video_url:pt.video_url||null,event_date:Qe.toISOString(),zoom_link:pt.zoom_link,zoom_meeting_id:pt.zoom_meeting_id||null,capacity:pt.capacity?parseInt(pt.capacity):null,is_published:pt.is_published}).eq("id",Ae);if(wt)throw wt},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event updated successfully"),s(!1),o(null),a(OL),p(null),y(null),j(!1)},onError:Ae=>{ze.error("Failed to update event: "+Ae.message),j(!1)}}),xe=cr({mutationFn:async Ae=>{const{error:pt}=await ee.from("events").delete().eq("id",Ae);if(pt)throw pt},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event deleted successfully")},onError:Ae=>{ze.error("Failed to delete event: "+Ae.message)}}),mt=Ae=>{var Be;const pt=new Date(Ae.event_date);o(Ae),a({title:Ae.title,description:Ae.description||"",image_url:Ae.image_url||"",video_url:Ae.video_url||"",event_date:pt,event_time:fn(pt,"HH:mm"),zoom_link:Ae.zoom_link,zoom_meeting_id:Ae.zoom_meeting_id||"",capacity:((Be=Ae.capacity)==null?void 0:Be.toString())||"",is_published:Ae.is_published}),y(Ae.image_url||null),p(null),s(!0)},et=Ae=>{if(Ae.preventDefault(),!l.event_date){ze.error("Please select a date");return}i?Ye.mutate({id:i.id,data:l}):Te.mutate(l)},nt=()=>{s(!1),o(null),a(OL),p(null),y(null)};return r.jsx("div",{className:"min-h-screen bg-background p-6",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>e("/dashboard"),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Event Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage upcoming events"})]})]}),r.jsxs(We,{className:"mb-6",children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"All Events"}),r.jsxs(Br,{open:n,onOpenChange:Ae=>!Ae&&nt(),children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:i?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:et,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title *"}),r.jsx(ct,{id:"title",value:l.title,onChange:Ae=>a({...l,title:Ae.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:l.description,onChange:Ae=>a({...l,description:Ae}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Event Image"}),r.jsx("input",{type:"file",ref:S,accept:"image/*",onChange:Ce,className:"hidden"}),x?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:x,alt:"Event preview",className:"w-full h-32 object-cover rounded-lg border"}),r.jsx(J,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:Je,children:r.jsx(Ts,{className:"h-4 w-4"})})]}):r.jsxs(J,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var Ae;return(Ae=S.current)==null?void 0:Ae.click()},children:[r.jsx(go,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm",children:"Click to upload image"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Date *"}),r.jsxs(_h,{children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(Ys,{className:"mr-2 h-4 w-4"}),l.event_date?fn(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(Ou,{className:"w-auto p-0",align:"start",children:r.jsx(Bj,{mode:"single",selected:l.event_date,onSelect:Ae=>a({...l,event_date:Ae}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"time",children:"Time *"}),r.jsx(ct,{id:"time",type:"time",value:l.event_time,onChange:Ae=>a({...l,event_time:Ae.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(ct,{id:"zoom_link",value:l.zoom_link,onChange:Ae=>a({...l,zoom_link:Ae.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(ct,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:Ae=>a({...l,zoom_meeting_id:Ae.target.value}),placeholder:"e.g., 1234567890 (find in Zoom dashboard)"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional: Enter the numeric meeting ID for automatic Zoom registration"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(ct,{id:"video_url",value:l.video_url,onChange:Ae=>a({...l,video_url:Ae.target.value}),placeholder:"YouTube, Vimeo, or Bunny.net embed URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a preview/promo video for this event"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(ct,{id:"capacity",type:"number",value:l.capacity,onChange:Ae=>a({...l,capacity:Ae.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{htmlFor:"is_published",children:"Published"}),r.jsx($s,{id:"is_published",checked:l.is_published,onCheckedChange:Ae=>a({...l,is_published:Ae})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:nt,className:"flex-1",children:"Cancel"}),r.jsx(J,{type:"submit",className:"flex-1",disabled:Te.isPending||Ye.isPending||w,children:w?"Uploading...":i?"Update Event":"Create Event"})]})]})]})]})]}),r.jsx(Xe,{children:ne?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(be==null?void 0:be.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Date & Time"}),r.jsx(Et,{children:"Registrations"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:be==null?void 0:be.map(Ae=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:Ae.title}),r.jsx(vt,{children:fn(new Date(Ae.event_date),"PPP p")}),r.jsx(vt,{children:r.jsxs(J,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ee(Ae),children:[r.jsx(Kn,{className:"h-4 w-4"}),(ye==null?void 0:ye[Ae.id])||0,Ae.capacity&&` / ${Ae.capacity}`]})}),r.jsx(vt,{children:r.jsx("span",{className:$t("px-2 py-1 rounded-full text-xs font-medium",Ae.is_published?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"),children:Ae.is_published?"Published":"Draft"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>window.open(Ae.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Ls,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>mt(Ae),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&xe.mutate(Ae.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},Ae.id))})]})})]}),r.jsx(Br,{open:C,onOpenChange:A,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5"}),E==null?void 0:E.title]}),r.jsx(es,{children:"View registrations and attendees for this event"})]}),r.jsxs("div",{className:"flex items-center justify-end mb-4 gap-2 flex-wrap",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>ae.mutate({eventId:E.id,testMode:!0}),disabled:ae.isPending,children:[r.jsx(Zs,{className:$t("h-4 w-4 mr-2",ae.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>ae.mutate({eventId:E.id}),disabled:ae.isPending||!(ie!=null&&ie.length),children:[r.jsx(Zs,{className:$t("h-4 w-4 mr-2",ae.isPending&&"animate-spin")}),ae.isPending?"Sending...":"Send Reminder to All"]}),(E==null?void 0:E.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>ke.mutate(E.id),disabled:ke.isPending,children:[r.jsx(ql,{className:$t("h-4 w-4 mr-2",ke.isPending&&"animate-spin")}),ke.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(J,{variant:"default",size:"sm",onClick:()=>pe.mutate(E.id),disabled:pe.isPending,children:[r.jsx(Ha,{className:$t("h-4 w-4 mr-2",pe.isPending&&"animate-spin")}),pe.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(ba,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsxs(ln,{value:"registrations",className:"gap-2",children:[r.jsx(Kn,{className:"h-4 w-4"}),"Registrations (",(ie==null?void 0:ie.length)||0,")"]}),r.jsxs(ln,{value:"attendees",className:"gap-2",children:[r.jsx(Za,{className:"h-4 w-4"}),"Attendees (",(de==null?void 0:de.length)||0,")"]})]}),r.jsx(An,{value:"registrations",className:"mt-4",children:fe?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(ie==null?void 0:ie.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Email"}),r.jsx(Et,{children:"Registered"}),r.jsx(Et,{children:"Status"})]})}),r.jsx(Hs,{children:ie==null?void 0:ie.map(Ae=>{var tt,ht;const pt=((tt=Ae.profiles)==null?void 0:tt.name)||Ae.zoom_name||"Unknown",Be=((ht=Ae.profiles)==null?void 0:ht.email)||Ae.zoom_email||null,Qe=!Ae.user_id;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[pt,Qe&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(vt,{children:Be?r.jsxs("a",{href:`mailto:${Be}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Zs,{className:"h-3 w-3"}),Be]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(vt,{className:"text-muted-foreground text-sm",children:fn(new Date(Ae.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(vt,{children:Ae.zoom_join_url?r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Registered"}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Ae.id)})})]})}),r.jsx(An,{value:"attendees",className:"mt-4",children:_e?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(de==null?void 0:de.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):r.jsxs(r.Fragment,{children:[(de==null?void 0:de.filter(Ae=>!Ae.user_id).length)>0&&r.jsxs("div",{className:"mb-6 p-4 border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(El,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),r.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",de==null?void 0:de.filter(Ae=>!Ae.user_id).length,")"]})]}),r.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 mb-3",children:"These attendees couldn't be matched to a profile. Link them to award points."}),r.jsx("div",{className:"space-y-2",children:de==null?void 0:de.filter(Ae=>!Ae.user_id).map(Ae=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium text-sm",children:Ae.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Ae.zoom_email||"No email"})]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>Ue(Ae),className:"gap-1",children:[r.jsx(Yh,{className:"h-3 w-3"}),"Link to Profile"]})]},Ae.id))})]}),r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Email"}),r.jsx(Et,{children:"Duration"}),r.jsx(Et,{children:"Points"})]})}),r.jsx(Hs,{children:de==null?void 0:de.filter(Ae=>Ae.user_id).map(Ae=>{var Qe,tt;const pt=((Qe=Ae.profiles)==null?void 0:Qe.name)||Ae.zoom_name||"Unknown",Be=((tt=Ae.profiles)==null?void 0:tt.email)||Ae.zoom_email||null;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[pt,Ae.manually_added&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:"Manual"})]})}),r.jsx(vt,{children:Be?r.jsxs("a",{href:`mailto:${Be}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Zs,{className:"h-3 w-3"}),Be]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(vt,{children:Ae.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Ki,{className:"h-3 w-3"}),Ae.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(vt,{children:Ae.points_awarded?r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:[r.jsx(Ha,{className:"h-3 w-3"}),"+10 pts"]}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Ae.id)})})]})]})})]})]})}),r.jsx(Br,{open:O,onOpenChange:z,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Yh,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(es,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),F&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm font-medium",children:F.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:F.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name or email...",value:ue,onChange:Ae=>he(Ae.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Ke.length===0?r.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No profiles found"}):r.jsx("div",{className:"divide-y",children:Ke.slice(0,20).map(Ae=>r.jsxs("button",{type:"button",onClick:()=>K(Ae.id),className:$t("w-full p-3 text-left hover:bg-muted/50 transition-colors",H===Ae.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:Ae.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Ae.email})]},Ae.id))})}),F.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(cc,{id:"save-alias",checked:Z,onCheckedChange:Ae=>re(Ae)}),r.jsx("label",{htmlFor:"save-alias",className:"text-sm text-muted-foreground cursor-pointer",children:"Remember this email for future auto-matching"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(J,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),r.jsx(J,{onClick:Ie,disabled:!H||Me.isPending,children:Me.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const vwt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=Fd(),[o,l]=P.useState(!1),[a,h]=P.useState(null),[p,x]=P.useState({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),[y,w]=P.useState(null),[j,S]=P.useState(0),[C,A]=P.useState(!1),[E,T]=P.useState(null),[O,z]=P.useState(""),[F,q]=P.useState(""),[H,K]=P.useState(""),[Z,re]=P.useState(!1),[ue,he]=P.useState(!1),{data:be=[]}=Jt({queryKey:["template-categories"],queryFn:async()=>{const{data:Ye,error:xe}=await ee.from("template_categories").select("*").order("name");if(xe)throw xe;return Ye}}),{data:ne=[]}=Jt({queryKey:["template-types"],queryFn:async()=>{const{data:Ye,error:xe}=await ee.from("template_types").select("*").order("name");if(xe)throw xe;return Ye}}),{data:ye=[],isLoading:ie}=Jt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:Ye,error:xe}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(xe)throw xe;const{data:mt,error:et}=await ee.from("template_links").select("*").order("sort_order");if(et)throw et;const{data:nt,error:Ae}=await ee.from("template_guides").select("*").order("sort_order");if(Ae)throw Ae;return Ye.map(Be=>({...Be,links:(mt==null?void 0:mt.filter(Qe=>Qe.template_id===Be.id))||[],guides:(nt==null?void 0:nt.filter(Qe=>Qe.template_id===Be.id))||[]}))}});P.useEffect(()=>{const Ye=s.get("edit");if(Ye&&ye.length>0){const xe=ye.find(mt=>mt.id===Ye);xe&&(pe(xe),i({},{replace:!0}))}},[ye,s]);const fe=cr({mutationFn:async Ye=>{const{data:xe,error:mt}=await ee.from("template_categories").insert({name:Ye}).select().single();if(mt)throw mt;return xe},onSuccess:Ye=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...p,category_id:Ye.id}),q(""),re(!1),t({title:"Category added"})},onError:Ye=>{t({title:"Error adding category",description:Ye.message,variant:"destructive"})}}),de=cr({mutationFn:async Ye=>{const{data:xe,error:mt}=await ee.from("template_types").insert({name:Ye}).select().single();if(mt)throw mt;return xe},onSuccess:Ye=>{n.invalidateQueries({queryKey:["template-types"]}),x({...p,type_id:Ye.id}),K(""),he(!1),t({title:"Type added"})},onError:Ye=>{t({title:"Error adding type",description:Ye.message,variant:"destructive"})}}),_e=cr({mutationFn:async Ye=>{var Ae;let xe=Ye.existingImageUrl;if(Ye.image){const pt=Ye.image.name.split(".").pop(),Be=`${Date.now()}-${Math.random().toString(36).substring(7)}.${pt}`,{error:Qe}=await ee.storage.from("template-previews").upload(Be,Ye.image);if(Qe)throw Qe;const{data:tt}=ee.storage.from("template-previews").getPublicUrl(Be);xe=tt.publicUrl}const mt={name:Ye.template.name,description:Ye.template.description||null,category_id:Ye.template.category_id||null,type_id:Ye.template.type_id||null,preview_image_url:xe,video_url:Ye.videoUrl||null,publish_date:Ye.template.publish_date?new Date(Ye.template.publish_date).toISOString():new Date().toISOString(),created_by:e==null?void 0:e.id};let et=Ye.templateId;if(et){const{error:pt}=await ee.from("canva_templates").update(mt).eq("id",et);if(pt)throw pt;const{error:Be}=await ee.from("template_links").delete().eq("template_id",et);if(Be)throw Be;const Qe=((Ae=Ye.existingGuides)==null?void 0:Ae.map(wt=>wt.id).filter(Boolean))||[],tt=Ye.template.guides.map(wt=>wt.id).filter(Boolean),ht=Qe.filter(wt=>!tt.includes(wt));ht.length>0&&await ee.from("template_guides").delete().in("id",ht)}else{const{data:pt,error:Be}=await ee.from("canva_templates").insert(mt).select().single();if(Be)throw Be;et=pt.id,pwt(Ye.template.name,pt.id)}const nt=Ye.template.links.filter(pt=>pt.title.trim()&&pt.canva_share_link.trim());if(nt.length>0){const pt=nt.map((Qe,tt)=>({template_id:et,title:Qe.title.trim(),canva_share_link:Qe.canva_share_link.trim(),sort_order:tt})),{error:Be}=await ee.from("template_links").insert(pt);if(Be)throw Be}for(let pt=0;pt{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),ke(),l(!1),t({title:a?"Template updated":"Template created"})},onError:Ye=>{t({title:"Error saving template",description:Ye.message,variant:"destructive"})}}),Ee=cr({mutationFn:async Ye=>{const{error:xe}=await ee.from("canva_templates").delete().eq("id",Ye);if(xe)throw xe},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),t({title:"Template deleted"})},onError:Ye=>{t({title:"Error deleting template",description:Ye.message,variant:"destructive"})}}),ke=()=>{x({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),T(null),z(""),h(null),re(!1),he(!1),q(""),K(""),w(null),S(0),A(!1)},pe=Ye=>{var xe;h(Ye),x({name:Ye.name,description:Ye.description||"",category_id:Ye.category_id||"",type_id:Ye.type_id||"",publish_date:Ye.publish_date?new Date(Ye.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:Ye.links&&Ye.links.length>0?Ye.links.map(mt=>({id:mt.id,title:mt.title,canva_share_link:mt.canva_share_link,sort_order:mt.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((xe=Ye.guides)==null?void 0:xe.map(mt=>({id:mt.id,name:mt.name,file_url:mt.file_url,file_type:mt.file_type,file_size:mt.file_size,sort_order:mt.sort_order})))||[],video_url:Ye.video_url||""}),z(Ye.preview_image_url||""),w(null),l(!0)},ae=Ye=>{var mt;const xe=(mt=Ye.target.files)==null?void 0:mt[0];xe&&(T(xe),z(URL.createObjectURL(xe)))},ge=()=>{x({...p,links:[...p.links,{title:"",canva_share_link:"",sort_order:p.links.length}]})},Me=Ye=>{if(p.links.length<=1)return;const xe=p.links.filter((mt,et)=>et!==Ye);x({...p,links:xe})},Ue=(Ye,xe,mt)=>{const et=[...p.links];et[Ye]={...et[Ye],[xe]:mt},x({...p,links:et})},Ie=Ye=>{const xe=Ye.target.files;if(!xe)return;const mt=Array.from(xe).map((et,nt)=>({name:et.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:et.type,file_size:et.size,sort_order:p.guides.length+nt,file:et}));x({...p,guides:[...p.guides,...mt]}),Ye.target.value=""},Ke=Ye=>{const xe=p.guides.filter((mt,et)=>et!==Ye);x({...p,guides:xe})},Re=(Ye,xe)=>{const mt=[...p.guides];mt[Ye]={...mt[Ye],name:xe},x({...p,guides:mt})},Ce=async()=>{if(!y)return null;A(!0),S(0);try{const{data:Ye,error:xe}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:p.name||y.name}});if(xe)throw new Error(xe.message);const{videoId:mt,libraryId:et}=Ye,{data:nt,error:Ae}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:mt}});if(Ae)throw new Error(Ae.message);const pt=new XMLHttpRequest;return await new Promise((Qe,tt)=>{pt.upload.addEventListener("progress",ht=>{if(ht.lengthComputable){const wt=Math.round(ht.loaded/ht.total*100);S(wt)}}),pt.addEventListener("load",()=>{pt.status>=200&&pt.status<300?Qe():tt(new Error(`Upload failed with status ${pt.status}`))}),pt.addEventListener("error",()=>tt(new Error("Upload failed"))),pt.open("PUT",nt.uploadUrl),pt.setRequestHeader("AccessKey",nt.apiKey),pt.send(y)}),`https://player.mediadelivery.net/embed/${et}/${mt}`}catch(Ye){return console.error("Bunny upload error:",Ye),t({title:"Video upload failed",description:Ye instanceof Error?Ye.message:"Unknown error",variant:"destructive"}),null}finally{A(!1)}},Je=Ye=>{var mt;const xe=(mt=Ye.target.files)==null?void 0:mt[0];xe&&w(xe),Ye.target.value=""},Te=async Ye=>{if(Ye.preventDefault(),!p.name.trim()){t({title:"Please enter a template name",variant:"destructive"});return}if(p.links.filter(et=>et.title.trim()&&et.canva_share_link.trim()).length===0){t({title:"Please add at least one Canva link",variant:"destructive"});return}let mt=p.video_url;if(y){const et=await Ce();if(!et)return;mt=et}_e.mutate({template:p,image:E,existingImageUrl:(a==null?void 0:a.preview_image_url)||null,templateId:a==null?void 0:a.id,existingGuides:a==null?void 0:a.guides,videoUrl:mt})};return r.jsx(Or,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Manage Templates",description:"Create and manage Canva templates"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ye.length})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:be.length})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ne.length})})]})]}),r.jsxs(Br,{open:o,onOpenChange:Ye=>{l(Ye),Ye||ke()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:a?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Te,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Name *"}),r.jsx(ct,{id:"name",value:p.name,onChange:Ye=>x({...p,name:Ye.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:p.description,onChange:Ye=>x({...p,description:Ye}),placeholder:"Brief description of the template",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{children:"Canva Links *"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:ge,className:"gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:p.links.map((Ye,xe)=>r.jsxs("div",{className:"flex gap-2 items-start p-3 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(ct,{value:Ye.title,onChange:mt=>Ue(xe,"title",mt.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(ct,{value:Ye.canva_share_link,onChange:mt=>Ue(xe,"canva_share_link",mt.target.value),placeholder:"https://www.canva.com/design/..."})]}),p.links.length>1&&r.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Me(xe),children:r.jsx(Ts,{className:"h-4 w-4"})})]},xe))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Category"}),Z?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:F,onChange:Ye=>q(Ye.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(J,{type:"button",size:"sm",onClick:()=>F.trim()&&fe.mutate(F.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>{re(!1),q("")},children:r.jsx(Ts,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(bn,{value:p.category_id,onValueChange:Ye=>x({...p,category_id:Ye}),children:[r.jsx(vn,{className:"flex-1",children:r.jsx(wn,{placeholder:"Select category"})}),r.jsx(_n,{children:be.map(Ye=>r.jsx(Kt,{value:Ye.id,children:Ye.name},Ye.id))})]}),r.jsx(J,{type:"button",variant:"outline",size:"icon",onClick:()=>re(!0),children:r.jsx(jn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Template Type"}),ue?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:H,onChange:Ye=>K(Ye.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(J,{type:"button",size:"sm",onClick:()=>H.trim()&&de.mutate(H.trim()),disabled:de.isPending,children:"Add"}),r.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>{he(!1),K("")},children:r.jsx(Ts,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(bn,{value:p.type_id,onValueChange:Ye=>x({...p,type_id:Ye}),children:[r.jsx(vn,{className:"flex-1",children:r.jsx(wn,{placeholder:"Select type"})}),r.jsx(_n,{children:ne.map(Ye=>r.jsx(Kt,{value:Ye.id,children:Ye.name},Ye.id))})]}),r.jsx(J,{type:"button",variant:"outline",size:"icon",onClick:()=>he(!0),children:r.jsx(jn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ct,{id:"publish_date",type:"date",value:p.publish_date,onChange:Ye=>x({...p,publish_date:Ye.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates are sorted by publish date (newest first) on the member page"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[O?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:O,alt:"Preview",className:"w-full h-full object-cover"}),r.jsx(J,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{T(null),z("")},children:r.jsx(Ts,{className:"h-3 w-3"})})]}):r.jsx("div",{className:"w-32 h-24 rounded-lg border-2 border-dashed border-muted-foreground/25 flex items-center justify-center",children:r.jsx(Zo,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(ct,{type:"file",accept:"image/*",onChange:ae,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Upload a preview image for this template"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{children:"Video (Optional)"}),p.video_url&&!y?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Fi,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>x({...p,video_url:""}),className:"text-destructive hover:text-destructive",children:"Remove"})]}),r.jsx("div",{className:"aspect-video max-w-md rounded-lg overflow-hidden border",children:r.jsx("iframe",{src:p.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):C?r.jsxs("div",{className:"space-y-2 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",j,"%"]})]}),r.jsx(Hc,{value:j,className:"h-2"})]}):y?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Fi,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:y.name}),r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(y.size/1024/1024).toFixed(1)," MB"]}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>w(null),children:r.jsx(Ts,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(ct,{type:"file",accept:"video/*",onChange:Je,className:"hidden"}),r.jsxs("div",{className:"flex items-center justify-center gap-2 p-6 border-2 border-dashed rounded-lg hover:border-primary/50 transition-colors",children:[r.jsx(Fi,{className:"h-8 w-8 text-muted-foreground/50"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to upload a video"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a video to embed on the template page (Bunny.net)"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(ct,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Ie,className:"hidden"}),r.jsx(J,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(go,{className:"h-3 w-3"}),"Add Files"]})})]})]}),p.guides.length>0?r.jsx("div",{className:"space-y-2",children:p.guides.map((Ye,xe)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(Ai,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(ct,{value:Ye.name,onChange:mt=>Re(xe,mt.target.value),placeholder:"Guide name",className:"flex-1"}),Ye.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(Ye.file_size/1024).toFixed(0)," KB"]}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Ke(xe),children:r.jsx(Ts,{className:"h-4 w-4"})})]},Ye.id||xe))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>{l(!1),ke()},children:"Cancel"}),r.jsx(J,{type:"submit",disabled:_e.isPending,children:_e.isPending?"Saving...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:ie?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):ye.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Preview"}),r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Links"}),r.jsx(Et,{children:"Category"}),r.jsx(Et,{children:"Type"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:ye.map(Ye=>{var xe,mt,et,nt,Ae;return r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:Ye.preview_image_url?r.jsx("img",{src:Ye.preview_image_url,alt:Ye.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Zo,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(vt,{className:"font-medium",children:Ye.name}),r.jsx(vt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Ft,{variant:"secondary",children:[((xe=Ye.links)==null?void 0:xe.length)||0," link",(((mt=Ye.links)==null?void 0:mt.length)||0)!==1?"s":""]}),(((et=Ye.guides)==null?void 0:et.length)||0)>0&&r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(Ai,{className:"h-3 w-3"}),(nt=Ye.guides)==null?void 0:nt.length," guide",(((Ae=Ye.guides)==null?void 0:Ae.length)||0)!==1?"s":""]})]})}),r.jsx(vt,{children:Ye.category?r.jsx(Ft,{variant:"secondary",children:Ye.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(vt,{children:Ye.type?r.jsx(Ft,{variant:"outline",children:Ye.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(vt,{className:"text-muted-foreground",children:new Date(Ye.publish_date).toLocaleDateString()}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{size:"icon",variant:"ghost",onClick:()=>pe(Ye),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Ee.mutate(Ye.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Ye.id)})})]})})})]})})},_wt=[{value:"bunny_stream",label:"Bunny.net Stream (Upload)"},{value:"youtube",label:"YouTube"},{value:"vimeo",label:"Vimeo"},{value:"google_drive",label:"Google Drive"},{value:"amazon_s3",label:"Amazon S3"},{value:"loom",label:"Loom"},{value:"other",label:"Other"}],bwt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=P.useState(!1),[o,l]=P.useState(null),[a,h]=P.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=P.useState(null),[y,w]=P.useState(""),[j,S]=P.useState([]),[C,A]=P.useState([]),[E,T]=P.useState([]),[O,z]=P.useState(""),[F,q]=P.useState(!1),[H,K]=P.useState(null),[Z,re]=P.useState(0),[ue,he]=P.useState(!1),[be,ne]=P.useState(null),{data:ye=[]}=Jt({queryKey:["academy-categories"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(Je)throw Je;return Ce}}),{data:ie=[],isLoading:fe}=Jt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(Je)throw Je;const{data:Te,error:Ye}=await ee.from("academy_resources").select("*").order("sort_order");if(Ye)throw Ye;return Ce.map(mt=>({...mt,resources:(Te==null?void 0:Te.filter(et=>et.video_id===mt.id))||[]}))}}),de=cr({mutationFn:async Ce=>{const{data:Je,error:Te}=await ee.from("academy_categories").insert({name:Ce,sort_order:ye.length}).select().single();if(Te)throw Te;return Je},onSuccess:Ce=>{n.invalidateQueries({queryKey:["academy-categories"]}),h({...a,category_id:Ce.id}),z(""),q(!1),t({title:"Category added"})},onError:Ce=>{t({title:"Error adding category",description:Ce.message,variant:"destructive"})}}),_e=cr({mutationFn:async Ce=>{let Je=Ce.existingThumbnailUrl;if(Ce.thumbnail){const xe=Ce.thumbnail.name.split(".").pop(),mt=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${xe}`,{error:et}=await ee.storage.from("academy-resources").upload(mt,Ce.thumbnail);if(et)throw et;const{data:nt}=ee.storage.from("academy-resources").getPublicUrl(mt);Je=nt.publicUrl}const Te={title:Ce.video.title,description:Ce.video.description||null,video_url:Ce.video.video_url,video_type:Ce.video.video_type,duration:Ce.video.duration||null,thumbnail_url:Je,category_id:Ce.video.category_id||null,publish_date:Ce.video.publish_date?new Date(Ce.video.publish_date).toISOString():new Date().toISOString(),is_published:Ce.video.is_published,created_by:e==null?void 0:e.id};let Ye=Ce.videoId;if(Ye){const{error:xe}=await ee.from("academy_videos").update(Te).eq("id",Ye);if(xe)throw xe}else{const{data:xe,error:mt}=await ee.from("academy_videos").insert(Te).select().single();if(mt)throw mt;Ye=xe.id,mwt(Ce.video.title,xe.id)}if(Ce.resourcesToDelete.length>0){const{error:xe}=await ee.from("academy_resources").delete().in("id",Ce.resourcesToDelete);if(xe)throw xe}for(let xe=0;xe{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),pe(),i(!1),t({title:o?"Video updated":"Video created"})},onError:Ce=>{t({title:"Error saving video",description:Ce.message,variant:"destructive"})}}),Ee=cr({mutationFn:async Ce=>{const{error:Je}=await ee.from("academy_videos").delete().eq("id",Ce);if(Je)throw Je},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),t({title:"Video deleted"})},onError:Ce=>{t({title:"Error deleting video",description:Ce.message,variant:"destructive"})}}),ke=cr({mutationFn:async({id:Ce,is_published:Je})=>{const{error:Te}=await ee.from("academy_videos").update({is_published:Je}).eq("id",Ce);if(Te)throw Te},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]})},onError:Ce=>{t({title:"Error updating video",description:Ce.message,variant:"destructive"})}}),pe=()=>{h({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),w(""),S([]),A([]),T([]),l(null),q(!1),z(""),K(null),re(0),he(!1),ne(null)},ae=Ce=>{l(Ce),h({title:Ce.title,description:Ce.description||"",video_url:Ce.video_url,video_type:Ce.video_type,duration:Ce.duration||"",category_id:Ce.category_id||"",publish_date:Ce.publish_date?new Date(Ce.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:Ce.is_published}),w(Ce.thumbnail_url||""),A(Ce.resources||[]),S([]),T([]),i(!0)},ge=Ce=>{var Te;const Je=(Te=Ce.target.files)==null?void 0:Te[0];Je&&(x(Je),w(URL.createObjectURL(Je)))},Me=Ce=>{const Je=Ce.target.files;if(Je){const Te=Array.from(Je).map(Ye=>({file:Ye,title:Ye.name.replace(/\.[^/.]+$/,"")}));S([...j,...Te])}Ce.target.value=""},Ue=Ce=>{S(j.filter((Je,Te)=>Te!==Ce))},Ie=Ce=>{T([...E,Ce]),A(C.filter(Je=>Je.id!==Ce))},Ke=async()=>{if(!H)return null;he(!0),re(0);try{const{data:Ce,error:Je}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:a.title||H.name}});if(Je)throw new Error(Je.message);const{videoId:Te,libraryId:Ye}=Ce;ne(Te);const{data:xe,error:mt}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Te}});if(mt)throw new Error(mt.message);const et=new XMLHttpRequest;return await new Promise((Ae,pt)=>{et.upload.addEventListener("progress",Be=>{if(Be.lengthComputable){const Qe=Math.round(Be.loaded/Be.total*100);re(Qe)}}),et.addEventListener("load",()=>{et.status>=200&&et.status<300?Ae():pt(new Error(`Upload failed with status ${et.status}`))}),et.addEventListener("error",()=>pt(new Error("Upload failed"))),et.open("PUT",xe.uploadUrl),et.setRequestHeader("AccessKey",xe.apiKey),et.send(H)}),`https://player.mediadelivery.net/embed/${Ye}/${Te}`}catch(Ce){return console.error("Bunny upload error:",Ce),t({title:"Video upload failed",description:Ce instanceof Error?Ce.message:"Unknown error",variant:"destructive"}),null}finally{he(!1)}},Re=async Ce=>{if(Ce.preventDefault(),!a.title.trim()){t({title:"Please enter a video title",variant:"destructive"});return}let Je=a.video_url;if(a.video_type==="bunny_stream"&&H&&!o){const Te=await Ke();if(!Te)return;Je=Te}else if(!a.video_url.trim()&&a.video_type!=="bunny_stream"){t({title:"Please enter a video URL",variant:"destructive"});return}else if(a.video_type==="bunny_stream"&&!H&&!a.video_url&&!o){t({title:"Please select a video file to upload",variant:"destructive"});return}_e.mutate({video:{...a,video_url:Je},thumbnail:p,existingThumbnailUrl:(o==null?void 0:o.thumbnail_url)||null,videoId:o==null?void 0:o.id,newResources:j,resourcesToDelete:E})};return r.jsx(Or,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Manage Academy",description:"Create and manage training videos and resources"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.length})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.filter(Ce=>Ce.is_published).length})})]})]}),r.jsxs(Br,{open:s,onOpenChange:Ce=>{i(Ce),Ce||pe()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:Re,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title *"}),r.jsx(ct,{id:"title",value:a.title,onChange:Ce=>h({...a,title:Ce.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:a.description,onChange:Ce=>h({...a,description:Ce}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Video Type"}),r.jsxs(bn,{value:a.video_type,onValueChange:Ce=>{h({...a,video_type:Ce,video_url:""}),K(null)},disabled:ue,children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:_wt.map(Ce=>r.jsx(Kt,{value:Ce.value,children:Ce.label},Ce.value))})]})]}),a.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ve,{children:["Upload Video File ",!o&&"*"]}),o&&a.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsx(ct,{type:"file",accept:"video/*",onChange:Ce=>{var Te;const Je=(Te=Ce.target.files)==null?void 0:Te[0];Je&&K(Je)},disabled:ue}),H&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Fi,{className:"h-4 w-4"}),H.name," (",(H.size/(1024*1024)).toFixed(1)," MB)"]}),ue&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Hc,{value:Z,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[Z,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(ct,{id:"video_url",value:a.video_url,onChange:Ce=>h({...a,video_url:Ce.target.value}),placeholder:"https://...",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"duration",children:"Duration"}),r.jsx(ct,{id:"duration",value:a.duration,onChange:Ce=>h({...a,duration:Ce.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ct,{id:"publish_date",type:"date",value:a.publish_date,onChange:Ce=>h({...a,publish_date:Ce.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Category"}),F?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:O,onChange:Ce=>z(Ce.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(J,{type:"button",size:"sm",onClick:()=>O.trim()&&de.mutate(O.trim()),disabled:de.isPending,children:"Add"}),r.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),z("")},children:r.jsx(Ts,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(bn,{value:a.category_id,onValueChange:Ce=>h({...a,category_id:Ce}),children:[r.jsx(vn,{className:"flex-1",children:r.jsx(wn,{placeholder:"Select category"})}),r.jsx(_n,{children:ye.map(Ce=>r.jsx(Kt,{value:Ce.id,children:Ce.name},Ce.id))})]}),r.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!0),children:r.jsx(jn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[y&&r.jsx("img",{src:y,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(ct,{type:"file",accept:"image/*",onChange:ge,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Recommended: 16:9 aspect ratio"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{children:"Resource Files"}),r.jsx(J,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(go,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:Me,className:"hidden"})]})})]}),(C.length>0||j.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[C.map(Ce=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:Ce.title}),r.jsx(Ft,{variant:"outline",className:"text-xs",children:Ce.file_type}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ie(Ce.id),className:"text-destructive hover:text-destructive",children:r.jsx(Ts,{className:"h-4 w-4"})})]},Ce.id)),j.map((Ce,Je)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ct,{value:Ce.title,onChange:Te=>{const Ye=[...j];Ye[Je].title=Te.target.value,S(Ye)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ue(Je),className:"text-destructive hover:text-destructive",children:r.jsx(Ts,{className:"h-4 w-4"})})]},Je))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"is_published",checked:a.is_published,onCheckedChange:Ce=>h({...a,is_published:Ce})}),r.jsx(Ve,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(ri,{children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:ue,children:"Cancel"}),r.jsx(J,{type:"submit",disabled:_e.isPending||ue,children:ue?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):_e.isPending?"Saving...":o?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:fe?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):ie.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No videos yet"}),r.jsx("p",{className:"text-sm",children:"Add your first academy video"})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Category"}),r.jsx(Et,{children:"Duration"}),r.jsx(Et,{children:"Resources"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(Hs,{children:ie.map(Ce=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ce.thumbnail_url?r.jsx("img",{src:Ce.thumbnail_url,alt:"",className:"w-16 h-10 object-cover rounded"}):r.jsx("div",{className:"w-16 h-10 bg-muted rounded flex items-center justify-center",children:r.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:Ce.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:Ce.video_type.replace("_"," ")})]})]})}),r.jsx(vt,{children:Ce.category?r.jsx(Ft,{variant:"outline",children:Ce.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(vt,{children:Ce.duration||"-"}),r.jsx(vt,{children:Ce.resources&&Ce.resources.length>0?r.jsxs(Ft,{variant:"secondary",children:[Ce.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(vt,{children:new Date(Ce.publish_date).toLocaleDateString()}),r.jsx(vt,{children:r.jsx($s,{checked:Ce.is_published,onCheckedChange:Je=>ke.mutate({id:Ce.id,is_published:Je})})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>ae(Ce),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Ee.mutate(Ce.id),className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Ce.id))})]})})})]})})};function wwt(){var ke,pe,ae;const e=Wr(),[t,n]=Fd(),[s,i]=P.useState(!1),[o,l]=P.useState(null),[a,h]=P.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=P.useState(null),[y,w]=P.useState(""),[j,S]=P.useState([]),[C,A]=P.useState([]),[E,T]=P.useState(null),{data:O,isLoading:z}=Jt({queryKey:["resource-kits"],queryFn:async()=>{const{data:ge,error:Me}=await ee.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Me)throw Me;return ge}}),{data:F}=Jt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:ge,error:Me}=await ee.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Me)throw Me;return ge}}),{data:q}=Jt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:ge,error:Me}=await ee.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Me)throw Me;return ge}});P.useEffect(()=>{const ge=t.get("edit");if(ge&&O&&O.length>0&&F&&q){const Me=O.find(Ue=>Ue.id===ge);Me&&(K(Me),n({},{replace:!0}))}},[O,F,q,t]);const H=()=>{h({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),w(""),S([]),A([]),l(null)},K=ge=>{l(ge),h({name:ge.name,description:ge.description||"",publish_date:ge.publish_date.split("T")[0],is_published:ge.is_published}),w(ge.featured_image_url||"");const Me=(F==null?void 0:F.filter(Ie=>Ie.kit_id===ge.id))||[];S(Me.map(Ie=>({id:Ie.id,name:Ie.name,file_url:Ie.file_url,file_type:Ie.file_type,file_size:Ie.file_size,sort_order:Ie.sort_order})));const Ue=(q==null?void 0:q.filter(Ie=>Ie.kit_id===ge.id))||[];A(Ue.map(Ie=>({id:Ie.id,title:Ie.title,canva_share_link:Ie.canva_share_link,sort_order:Ie.sort_order}))),i(!0)},Z=ge=>{var Ue;const Me=(Ue=ge.target.files)==null?void 0:Ue[0];Me&&(x(Me),w(URL.createObjectURL(Me)))},re=()=>{S([...j,{name:"",file_url:"",sort_order:j.length}])},ue=ge=>{S(j.filter((Me,Ue)=>Ue!==ge))},he=(ge,Me,Ue)=>{const Ie=[...j];Ie[ge]={...Ie[ge],[Me]:Ue},S(Ie)},be=()=>{A([...C,{title:"",canva_share_link:"",sort_order:C.length}])},ne=ge=>{A(C.filter((Me,Ue)=>Ue!==ge))},ye=(ge,Me,Ue)=>{const Ie=[...C];Ie[ge]={...Ie[ge],[Me]:Ue},A(Ie)},ie=(ge,Me)=>{var Ie;const Ue=(Ie=Me.target.files)==null?void 0:Ie[0];if(Ue){const Ke=[...j],Re=Ue.name.replace(/\.[^/.]+$/,"");Ke[ge]={...Ke[ge],file:Ue,file_type:Ue.type,file_size:Ue.size,name:Ke[ge].name||Re},S(Ke)}},fe=cr({mutationFn:async()=>{let ge=(o==null?void 0:o.featured_image_url)||null;if(p){const Re=p.name.split(".").pop(),Ce=`${Date.now()}.${Re}`,{error:Je}=await ee.storage.from("resource-kits").upload(`featured/${Ce}`,p);if(Je)throw Je;const{data:Te}=ee.storage.from("resource-kits").getPublicUrl(`featured/${Ce}`);ge=Te.publicUrl}const Me={name:a.name,description:a.description||null,featured_image_url:ge,publish_date:a.publish_date,is_published:a.is_published};let Ue;const Ie=!o,Ke=(o==null?void 0:o.is_published)||!1;if(o){const{error:Re}=await ee.from("resource_kits").update(Me).eq("id",o.id);if(Re)throw Re;Ue=o.id;const Ce=(F==null?void 0:F.filter(et=>et.kit_id===o.id).map(et=>et.id))||[],Je=j.filter(et=>et.id).map(et=>et.id),Te=Ce.filter(et=>!Je.includes(et));Te.length>0&&await ee.from("resource_kit_files").delete().in("id",Te);const Ye=(q==null?void 0:q.filter(et=>et.kit_id===o.id).map(et=>et.id))||[],xe=C.filter(et=>et.id).map(et=>et.id),mt=Ye.filter(et=>!xe.includes(et));mt.length>0&&await ee.from("resource_kit_links").delete().in("id",mt)}else{const{data:Re,error:Ce}=await ee.from("resource_kits").insert(Me).select().single();if(Ce)throw Ce;Ue=Re.id}for(let Re=0;Re{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),e.invalidateQueries({queryKey:["resource-kit-links"]}),ze.success(o?"Resource kit updated":"Resource kit created"),ge.isPublished&&(ge.isNewKit||!ge.wasPublished)&&xwt(ge.kitName,ge.kitId),i(!1),H()},onError:ge=>{ze.error("Failed to save resource kit: "+ge.message)}}),de=cr({mutationFn:async ge=>{const{error:Me}=await ee.from("resource_kits").delete().eq("id",ge);if(Me)throw Me},onSuccess:()=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),ze.success("Resource kit deleted")},onError:ge=>{ze.error("Failed to delete: "+ge.message)}}),_e=ge=>{if(ge.preventDefault(),!a.name){ze.error("Please enter a name");return}fe.mutate()},Ee=ge=>(F==null?void 0:F.filter(Me=>Me.kit_id===ge).length)||0;return r.jsx(Or,{title:"Toolbox Management",description:"Create and manage resource kits for agents",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(O==null?void 0:O.length)||0})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(O==null?void 0:O.filter(ge=>ge.is_published).length)||0})})]})]}),r.jsxs(J,{onClick:()=>{H(),i(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Files"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:z?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(O==null?void 0:O.length)===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):O==null?void 0:O.map(ge=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[ge.featured_image_url?r.jsx("img",{src:ge.featured_image_url,alt:ge.name,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Ol,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:ge.name}),ge.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:ge.description})]})]})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),Ee(ge.id)]})}),r.jsx(vt,{children:fn(new Date(ge.publish_date),"MMM d, yyyy")}),r.jsx(vt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${ge.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:ge.is_published?"Published":"Draft"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{const Me=(F==null?void 0:F.filter(Ie=>Ie.kit_id===ge.id))||[],Ue=(q==null?void 0:q.filter(Ie=>Ie.kit_id===ge.id))||[];T({...ge,files:Me,links:Ue})},children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>K(ge),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&de.mutate(ge.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},ge.id))})]})})}),r.jsx(Br,{open:s,onOpenChange:i,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Featured Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[y?r.jsx("img",{src:y,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(Ol,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(ct,{type:"file",accept:"image/*",onChange:Z})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Name *"}),r.jsx(ct,{id:"name",value:a.name,onChange:ge=>h({...a,name:ge.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:a.description,onChange:ge=>h({...a,description:ge}),placeholder:"Brief description of this resource kit",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ct,{id:"publish_date",type:"date",value:a.publish_date,onChange:ge=>h({...a,publish_date:ge.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx($s,{checked:a.is_published,onCheckedChange:ge=>h({...a,is_published:ge})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:a.is_published?"Visible to agents":"Hidden from agents"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ve,{children:"Resource Files"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:re,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),j.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No files added yet. Click "Add File" to include resources.'}):r.jsx("div",{className:"space-y-3",children:j.map((ge,Me)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["File ",Me+1]}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ue(Me),children:r.jsx(Ts,{className:"h-4 w-4"})})]}),r.jsx(ct,{placeholder:"File name (e.g., Getting Started Guide)",value:ge.name,onChange:Ue=>he(Me,"name",Ue.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ct,{type:"file",onChange:Ue=>ie(Me,Ue),className:"flex-1"}),ge.file_url&&!ge.file&&r.jsx("a",{href:ge.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),ge.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Me))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ve,{children:"Canva Links"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:be,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),C.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No Canva links added yet. Click "Add Canva Link" to include templates.'}):r.jsx("div",{className:"space-y-3",children:C.map((ge,Me)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["Canva Link ",Me+1]}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ne(Me),children:r.jsx(Ts,{className:"h-4 w-4"})})]}),r.jsx(ct,{placeholder:"Link title (e.g., Social Media Post Template)",value:ge.title,onChange:Ue=>ye(Me,"title",Ue.target.value)}),r.jsx(ct,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:ge.canva_share_link,onChange:Ue=>ye(Me,"canva_share_link",Ue.target.value)})]},Me))})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(J,{type:"submit",disabled:fe.isPending,children:fe.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Br,{open:!!E,onOpenChange:()=>T(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:E==null?void 0:E.name})}),r.jsxs("div",{className:"space-y-4",children:[(E==null?void 0:E.featured_image_url)&&r.jsx("img",{src:E.featured_image_url,alt:E.name,className:"w-full h-48 object-cover rounded-lg"}),(E==null?void 0:E.description)&&r.jsx("p",{className:"text-muted-foreground",children:E.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((ke=E==null?void 0:E.files)==null?void 0:ke.length)||0,")"]}),((pe=E==null?void 0:E.files)==null?void 0:pe.length)===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No files in this kit"}):r.jsx("div",{className:"space-y-2",children:(ae=E==null?void 0:E.files)==null?void 0:ae.map(ge=>r.jsxs("a",{href:ge.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(Ai,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:ge.name})]},ge.id))})]}),(E==null?void 0:E.links)&&E.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",E.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:E.links.map(ge=>r.jsxs("a",{href:ge.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(So,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:ge.title})]},ge.id))})]})]})]})})]})})}const jwt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=P.useState(!1),[o,l]=P.useState(null),[a,h]=P.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[p,x]=P.useState(null),[y,w]=P.useState(""),{data:j=[],isLoading:S}=Jt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("social_swag").select("*").order("publish_date",{ascending:!1});if(Z)throw Z;const{data:re,error:ue}=await ee.from("social_swag_links").select("*").order("sort_order");if(ue)throw ue;return K.map(be=>({...be,links:(re==null?void 0:re.filter(ne=>ne.swag_id===be.id))||[]}))}}),C=cr({mutationFn:async K=>{let Z=K.existingImageUrl;if(K.image){const ye=K.image.name.split(".").pop(),ie=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ye}`,{error:fe}=await ee.storage.from("template-previews").upload(ie,K.image);if(fe)throw fe;const{data:de}=ee.storage.from("template-previews").getPublicUrl(ie);Z=de.publicUrl}const re={title:K.item.title,description:K.item.description||null,preview_image_url:Z,publish_date:K.item.publish_date?new Date(K.item.publish_date).toISOString():new Date().toISOString(),is_published:K.item.is_published,created_by:e==null?void 0:e.id};let ue=K.itemId;const he=!ue,be=(o==null?void 0:o.is_published)||!1;if(ue){const{error:ye}=await ee.from("social_swag").update(re).eq("id",ue);if(ye)throw ye;await ee.from("social_swag_links").delete().eq("swag_id",ue)}else{const{data:ye,error:ie}=await ee.from("social_swag").insert(re).select().single();if(ie)throw ie;ue=ye.id}const ne=K.item.links.filter(ye=>ye.title.trim()&&ye.canva_share_link.trim());if(ne.length>0){const ye=ne.map((fe,de)=>({swag_id:ue,title:fe.title.trim(),canva_share_link:fe.canva_share_link.trim(),sort_order:de})),{error:ie}=await ee.from("social_swag_links").insert(ye);if(ie)throw ie}return{itemId:ue,itemTitle:K.item.title,isNewItem:he,wasPublished:be,isPublished:K.item.is_published}},onSuccess:K=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:o?"Item updated":"Item created"}),K.isPublished&&(K.isNewItem||!K.wasPublished)&&lfe(K.itemTitle,K.itemId),i(!1),E()},onError:K=>{t({title:"Error saving item",description:K.message,variant:"destructive"})}}),A=cr({mutationFn:async K=>{const{error:Z}=await ee.from("social_swag").delete().eq("id",K);if(Z)throw Z},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:"Item deleted"})},onError:K=>{t({title:"Error deleting item",description:K.message,variant:"destructive"})}}),E=()=>{h({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),x(null),w(""),l(null)},T=K=>{l(K),h({title:K.title,description:K.description||"",publish_date:K.publish_date?new Date(K.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:K.is_published,links:K.links&&K.links.length>0?K.links.map(Z=>({id:Z.id,title:Z.title,canva_share_link:Z.canva_share_link,sort_order:Z.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),w(K.preview_image_url||""),i(!0)},O=K=>{var re;const Z=(re=K.target.files)==null?void 0:re[0];Z&&(x(Z),w(URL.createObjectURL(Z)))},z=()=>{h({...a,links:[...a.links,{title:"",canva_share_link:"",sort_order:a.links.length}]})},F=K=>{if(a.links.length<=1)return;const Z=a.links.filter((re,ue)=>ue!==K);h({...a,links:Z})},q=(K,Z,re)=>{const ue=[...a.links];ue[K]={...ue[K],[Z]:re},h({...a,links:ue})},H=K=>{if(K.preventDefault(),!a.title.trim()){t({title:"Title is required",variant:"destructive"});return}C.mutate({item:a,image:p,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Or,{title:"Manage Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Manage Social Swag",description:"Create and manage social media content"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(K=>K.is_published).length})})]})]}),r.jsxs(Br,{open:s,onOpenChange:K=>{i(K),K||E()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:H,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title *"}),r.jsx(ct,{id:"title",value:a.title,onChange:K=>h({...a,title:K.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:a.description,onChange:K=>h({...a,description:K}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ct,{id:"publish_date",type:"date",value:a.publish_date,onChange:K=>h({...a,publish_date:K.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx($s,{id:"is_published",checked:a.is_published,onCheckedChange:K=>h({...a,is_published:K})}),r.jsx(Ve,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(J,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),w("")},children:r.jsx(Ts,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Zo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(ct,{type:"file",accept:"image/*",onChange:O,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{children:"Canva Links"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:z,children:[r.jsx(jn,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),a.links.map((K,Z)=>r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4 pb-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",Z+1]}),a.links.length>1&&r.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>F(Z),children:r.jsx(Ts,{className:"h-3 w-3"})})]}),r.jsx(ct,{placeholder:"Link title (e.g., Instagram Post)",value:K.title,onChange:re=>q(Z,"title",re.target.value)}),r.jsx(ct,{placeholder:"Canva share link",value:K.canva_share_link,onChange:re=>q(Z,"canva_share_link",re.target.value)})]})},Z))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(J,{type:"submit",disabled:C.isPending,children:C.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:S?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):j.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No items yet. Click "Add Item" to create your first one.'}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-16",children:"Preview"}),r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Links"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:j.map(K=>{var Z;return r.jsxs(Ir,{children:[r.jsx(vt,{children:K.preview_image_url?r.jsx("img",{src:K.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Zo,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(vt,{className:"font-medium",children:K.title}),r.jsxs(vt,{children:[((Z=K.links)==null?void 0:Z.length)||0," links"]}),r.jsx(vt,{children:new Date(K.publish_date).toLocaleDateString()}),r.jsx(vt,{children:r.jsx(Ft,{variant:K.is_published?"default":"secondary",children:K.is_published?"Published":"Draft"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${K.id}`,"_blank"),children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>T(K),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&A.mutate(K.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},K.id)})})]})})})]})})},kwt=()=>{const e=Wr(),[t,n]=P.useState("all"),[s,i]=P.useState(!1),[o,l]=P.useState(fn(new Date,"yyyy-MM")),[a,h]=P.useState([]),[p,x]=P.useState(!1),[y,w]=P.useState(null),[j,S]=P.useState(!1),[C,A]=P.useState(fn(new Date,"yyyy-MM")),[E,T]=P.useState(null),[O,z]=P.useState(""),[F,q]=P.useState(""),[H,K]=P.useState(""),[Z,re]=P.useState(!1),{data:ue=[],isLoading:he}=Jt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Je)throw Je;return Ce}}),{data:be=[]}=Jt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Je)throw Je;return Ce}}),{data:ne=[]}=Jt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Je)throw Je;return Ce}}),ye=[...new Set(ue.map(Ce=>Ce.month))].sort((Ce,Je)=>Je.localeCompare(Ce)),ie=t==="all"?ue:ue.filter(Ce=>Ce.month===t),fe=Ce=>{const Je=uxe(Ce,"yyyy-MM",new Date);return fn(Je,"MMMM yyyy")},de=Ce=>{const Te=Array.from(Ce.target.files||[]).slice(0,16-a.length).map(Ye=>({file:Ye,preview:URL.createObjectURL(Ye),caption:""}));h(Ye=>[...Ye,...Te].slice(0,16))},_e=Ce=>{h(Je=>{const Te=[...Je];return URL.revokeObjectURL(Te[Ce].preview),Te.splice(Ce,1),Te})},Ee=(Ce,Je)=>{h(Te=>{const Ye=[...Te];return Ye[Ce]={...Ye[Ce],caption:Je},Ye})},ke=async()=>{if(a.length===0){ze.error("Please add at least one image");return}if(a.filter(Je=>!Je.caption.trim()).length>0){ze.error("Please add captions to all images");return}x(!0);try{for(let Je=0;Je{const Je=Ce.image_url.split("/social-swag-2/");Je[1]&&await ee.storage.from("social-swag-2").remove([Je[1]]);const{error:Te}=await ee.from("social_swag_2").delete().eq("id",Ce.id);if(Te)throw Te},onSuccess:()=>{ze.success("Image deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>{ze.error("Failed to delete image")}}),ae=cr({mutationFn:async({month:Ce,link:Je})=>{const{error:Te}=await ee.from("social_swag_2_months").upsert({month:Ce,canva_link:Je||null},{onConflict:"month"});if(Te)throw Te},onSuccess:()=>{ze.success("Canva link updated"),w(null),e.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>{ze.error("Failed to update Canva link")}}),ge=Ce=>{var Je;return((Je=be.find(Te=>Te.month===Ce))==null?void 0:Je.canva_link)||""},Me=Ce=>ne.find(Je=>Je.month===Ce)||null,Ue=Ce=>{var Te;const Je=(Te=Ce.target.files)==null?void 0:Te[0];Je&&(T(Je),z(URL.createObjectURL(Je)))},Ie=()=>{O&&URL.revokeObjectURL(O),T(null),z(""),q(""),K("")},Ke=async()=>{if(!E){ze.error("Please select an image");return}re(!0);try{const Ce=E.name.split(".").pop(),Je=`reels/${C}-${Date.now()}.${Ce}`,{error:Te}=await ee.storage.from("social-swag-2").upload(Je,E);if(Te)throw Te;const{data:{publicUrl:Ye}}=ee.storage.from("social-swag-2").getPublicUrl(Je),{error:xe}=await ee.from("social_swag_2_reels").upsert({month:C,image_url:Ye,canva_link:H||null,caption:F||null},{onConflict:"month"});if(xe)throw xe;ze.success("Reel uploaded successfully!"),lfe(`${fe(C)} Reel`,"social-swag-2"),Ie(),S(!1),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Ce){console.error("Reel upload error:",Ce),ze.error("Failed to upload reel")}finally{re(!1)}},Re=cr({mutationFn:async Ce=>{const Je=Ce.image_url.split("/social-swag-2/");Je[1]&&await ee.storage.from("social-swag-2").remove([Je[1]]);const{error:Te}=await ee.from("social_swag_2_reels").delete().eq("id",Ce.id);if(Te)throw Te},onSuccess:()=>{ze.success("Reel deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>{ze.error("Failed to delete reel")}});return r.jsx(Or,{title:"Admin - Social Swag 2.0",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Social Swag 2.0"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage monthly social media images and captions"})]}),r.jsxs(Br,{open:s,onOpenChange:i,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Fr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Month"}),r.jsx(ct,{type:"month",value:o,onChange:Ce=>l(Ce.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{children:["Images (",a.length,"/16)"]}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:de,className:"hidden",id:"swag-upload",disabled:a.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(go,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select images (max 16)"})]})]})]}),a.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map((Ce,Je)=>r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"relative aspect-[4/5] rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:Ce.preview,alt:`Upload ${Je+1}`,className:"w-full h-full object-cover"}),r.jsx(J,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>_e(Je),children:r.jsx(Ts,{className:"h-3 w-3"})})]}),r.jsx(ms,{placeholder:"Caption...",value:Ce.caption,onChange:Te=>Ee(Je,Te.target.value),className:"text-xs h-20"})]},Je))}),r.jsx(J,{onClick:ke,disabled:p||a.length===0,className:"w-full gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(go,{className:"h-4 w-4"}),"Upload ",a.length," Images"]})})]})]})]}),r.jsxs(Br,{open:j,onOpenChange:Ce=>{S(Ce),Ce||Ie()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:"gap-2",children:[r.jsx(Md,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Fr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Month"}),r.jsx(ct,{type:"month",value:C,onChange:Ce=>A(Ce.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Reel Preview Image"}),O?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:O,alt:"Reel preview",className:"w-full h-full object-cover"}),r.jsx(J,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(O),T(null),z("")},children:r.jsx(Ts,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:Ue,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(Md,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Canva Download Link"}),r.jsx(ct,{value:H,onChange:Ce=>K(Ce.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Caption"}),r.jsx(ms,{value:F,onChange:Ce=>q(Ce.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(J,{onClick:Ke,disabled:Z||!E,className:"w-full gap-2",children:Z?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(go,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ue.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ye.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(ba,{value:t,onValueChange:n,children:r.jsxs(fa,{children:[r.jsx(ln,{value:"all",children:"All"}),ye.map(Ce=>r.jsx(ln,{value:Ce,children:fe(Ce)},Ce))]})}),t!=="all"&&r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(So,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Ve,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",fe(t)]}),(y==null?void 0:y.month)===t?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(ct,{value:y.link,onChange:Ce=>w({...y,link:Ce.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(J,{size:"sm",onClick:()=>ae.mutate(y),children:"Save"}),r.jsx(J,{size:"sm",variant:"outline",onClick:()=>w(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:ge(t)||"No link set"}),r.jsx(J,{size:"sm",variant:"outline",onClick:()=>w({month:t,link:ge(t)}),children:"Edit"})]})]})]})})}),t!=="all"&&r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(Md,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Ve,{className:"text-sm text-muted-foreground",children:["Reel for ",fe(t)]}),(()=>{const Ce=Me(t);return Ce?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:Ce.image_url,alt:"Reel preview",className:"w-16 h-28 object-cover rounded"}),r.jsxs("div",{className:"flex-1 text-sm",children:[r.jsx("p",{className:"line-clamp-2",children:Ce.caption||"No caption"}),Ce.canva_link&&r.jsx("a",{href:Ce.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(J,{variant:"destructive",size:"sm",onClick:()=>Re.mutate(Ce),children:r.jsx(Zn,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),he?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):ie.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Zo,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images yet. Upload some!"})]}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:ie.map(Ce=>r.jsxs(We,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative aspect-[4/5]",children:[r.jsx("img",{src:Ce.image_url,alt:"Social swag",className:"w-full h-full object-cover"}),r.jsx(J,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:()=>pe.mutate(Ce),children:r.jsx(Zn,{className:"h-4 w-4"})})]}),r.jsx(Xe,{className:"p-3",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:Ce.caption})})]},Ce.id))})]})})},Nwt=()=>{const{toast:e}=pa(),t=Wr(),[n,s]=P.useState("categories"),[i,o]=P.useState(!1),[l,a]=P.useState(null),[h,p]=P.useState({name:"",description:"",icon:""}),[x,y]=P.useState(!1),[w,j]=P.useState(null),[S,C]=P.useState({name:"",description:"",icon:""}),[A,E]=P.useState(!1),[T,O]=P.useState(null),[z,F]=P.useState(""),{data:q=[],isLoading:H}=Jt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Re,error:Ce}=await ee.from("community_categories").select("*").order("sort_order");if(Ce)throw Ce;return Re}}),{data:K=[],isLoading:Z}=Jt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Re,error:Ce}=await ee.from("community_private_groups").select("*").order("sort_order");if(Ce)throw Ce;return Re}}),{data:re=[]}=Jt({queryKey:["admin-group-members",T==null?void 0:T.id],queryFn:async()=>{if(!T)return[];const{data:Re,error:Ce}=await ee.from("community_private_group_members").select("*").eq("group_id",T.id);if(Ce)throw Ce;return Re},enabled:!!T}),{data:ue=[]}=Jt({queryKey:["admin-all-profiles"],queryFn:async()=>{let Ce=[],Je=0,Te=!0;for(;Te;){const{data:Ye,error:xe}=await ee.from("profiles").select("id, name, email, brokerage_id").order("name").range(Je,Je+1e3-1);if(xe)throw xe;Ye&&Ye.length>0?(Ce=[...Ce,...Ye],Je+=1e3,Te=Ye.length===1e3):Te=!1}return Ce}}),{data:he=[]}=Jt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Re,error:Ce}=await ee.from("brokerages").select("*").order("name");if(Ce)throw Ce;return Re}}),be=cr({mutationFn:async Re=>{if(Re.id){const{error:Ce}=await ee.from("community_categories").update({name:Re.name,description:Re.description||null,icon:Re.icon||null}).eq("id",Re.id);if(Ce)throw Ce}else{const Ce=Math.max(...q.map(Te=>Te.sort_order),0),{error:Je}=await ee.from("community_categories").insert({name:Re.name,description:Re.description||null,icon:Re.icon||null,sort_order:Ce+1});if(Je)throw Je}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),a(null),p({name:"",description:"",icon:""}),e({title:l?"Category updated!":"Category created!"})},onError:Re=>{e({title:"Error",description:Re.message,variant:"destructive"})}}),ne=cr({mutationFn:async Re=>{const{error:Ce}=await ee.from("community_categories").delete().eq("id",Re);if(Ce)throw Ce},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),e({title:"Category deleted"})}}),ye=cr({mutationFn:async({id:Re,direction:Ce})=>{const Je=q.findIndex(Te=>Te.id===Re);if(Ce==="up"&&Je>0){const Te=q[Je-1],Ye=q[Je];await ee.from("community_categories").update({sort_order:Ye.sort_order}).eq("id",Te.id),await ee.from("community_categories").update({sort_order:Te.sort_order}).eq("id",Ye.id)}else if(Ce==="down"&&Jet.invalidateQueries({queryKey:["admin-community-categories"]})}),ie=cr({mutationFn:async Re=>{if(Re.id){const{error:Ce}=await ee.from("community_private_groups").update({name:Re.name,description:Re.description||null,icon:Re.icon||null}).eq("id",Re.id);if(Ce)throw Ce}else{const Ce=Math.max(...K.map(Te=>Te.sort_order),0),{error:Je}=await ee.from("community_private_groups").insert({name:Re.name,description:Re.description||null,icon:Re.icon||null,sort_order:Ce+1});if(Je)throw Je}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),j(null),C({name:"",description:"",icon:""}),e({title:w?"Private group updated!":"Private group created!"})},onError:Re=>{e({title:"Error",description:Re.message,variant:"destructive"})}}),fe=cr({mutationFn:async Re=>{const{error:Ce}=await ee.from("community_private_groups").delete().eq("id",Re);if(Ce)throw Ce},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),e({title:"Private group deleted"})}}),de=cr({mutationFn:async({id:Re,direction:Ce})=>{const Je=K.findIndex(Te=>Te.id===Re);if(Ce==="up"&&Je>0){const Te=K[Je-1],Ye=K[Je];await ee.from("community_private_groups").update({sort_order:Ye.sort_order}).eq("id",Te.id),await ee.from("community_private_groups").update({sort_order:Te.sort_order}).eq("id",Ye.id)}else if(Ce==="down"&&Jet.invalidateQueries({queryKey:["admin-private-groups"]})}),_e=cr({mutationFn:async({groupId:Re,userId:Ce,isMember:Je})=>{if(Je){const{error:Te}=await ee.from("community_private_group_members").delete().eq("group_id",Re).eq("user_id",Ce);if(Te)throw Te}else{const{error:Te}=await ee.from("community_private_group_members").insert({group_id:Re,user_id:Ce});if(Te)throw Te}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ee=cr({mutationFn:async({groupId:Re,brokerageId:Ce,isMember:Je})=>{if(Je){const{error:Te}=await ee.from("community_private_group_members").delete().eq("group_id",Re).eq("brokerage_id",Ce);if(Te)throw Te}else{const{error:Te}=await ee.from("community_private_group_members").insert({group_id:Re,brokerage_id:Ce});if(Te)throw Te}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),ke=Re=>{a(Re),p({name:Re.name,description:Re.description||"",icon:Re.icon||""}),o(!0)},pe=()=>{a(null),p({name:"",description:"",icon:""}),o(!0)},ae=Re=>{j(Re),C({name:Re.name,description:Re.description||"",icon:Re.icon||""}),y(!0)},ge=()=>{j(null),C({name:"",description:"",icon:""}),y(!0)},Me=Re=>{O(Re),F(""),E(!0)},Ue=Re=>re.some(Ce=>Ce.user_id===Re),Ie=Re=>re.some(Ce=>Ce.brokerage_id===Re),Ke=ue.filter(Re=>Re.name.toLowerCase().includes(z.toLowerCase())||Re.email.toLowerCase().includes(z.toLowerCase()));return r.jsx(Or,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(ba,{value:n,onValueChange:s,children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"categories",children:"Public Categories"}),r.jsxs(ln,{value:"private-groups",children:[r.jsx(Wf,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(An,{value:"categories",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Categories visible to all community members"}),r.jsxs(J,{onClick:pe,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-[50px]",children:"Order"}),r.jsx(Et,{className:"w-[80px]",children:"Icon"}),r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Hs,{children:H?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):q.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):q.map((Re,Ce)=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===0,onClick:()=>ye.mutate({id:Re.id,direction:"up"}),children:"↑"}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===q.length-1,onClick:()=>ye.mutate({id:Re.id,direction:"down"}),children:"↓"})]})}),r.jsx(vt,{className:"text-2xl",children:Re.icon||"📁"}),r.jsx(vt,{className:"font-medium",children:Re.name}),r.jsx(vt,{className:"text-muted-foreground",children:Re.description||"—"}),r.jsx(vt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>ke(Re),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ne.mutate(Re.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Re.id))})]})})})]}),r.jsxs(An,{value:"private-groups",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Private groups visible only to assigned members or brokerages"}),r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(na,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(J,{onClick:ge,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-[50px]",children:"Order"}),r.jsx(Et,{className:"w-[80px]",children:"Icon"}),r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{className:"w-[120px]",children:"Members"}),r.jsx(Et,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(Hs,{children:Z?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):K.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):K.map((Re,Ce)=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===0,onClick:()=>de.mutate({id:Re.id,direction:"up"}),children:"↑"}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===K.length-1,onClick:()=>de.mutate({id:Re.id,direction:"down"}),children:"↓"})]})}),r.jsx(vt,{className:"text-2xl",children:Re.icon||"🔒"}),r.jsx(vt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Re.name,Re.brokerage_id?r.jsxs(Ft,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:[r.jsx(Wf,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(vt,{className:"text-muted-foreground",children:Re.description||"—"}),r.jsx(vt,{children:r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>Me(Re),children:[r.jsx(Kn,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex gap-1",children:[!Re.brokerage_id&&r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>ae(Re),children:r.jsx(ha,{className:"h-4 w-4"})}),!Re.brokerage_id&&r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&fe.mutate(Re.id)},children:r.jsx(Zn,{className:"h-4 w-4"})}),Re.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Re.id))})]})})})]})]}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:l?"Edit Category":"Create Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(ct,{value:h.icon,onChange:Re=>p(Ce=>({...Ce,icon:Re.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(ct,{value:h.name,onChange:Re=>p(Ce=>({...Ce,name:Re.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ms,{value:h.description,onChange:Re=>p(Ce=>({...Ce,description:Re.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(J,{onClick:()=>be.mutate({...h,id:l==null?void 0:l.id}),disabled:!h.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Br,{open:x,onOpenChange:y,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:w?"Edit Private Group":"Create Private Group"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(ct,{value:S.icon,onChange:Re=>C(Ce=>({...Ce,icon:Re.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(ct,{value:S.name,onChange:Re=>C(Ce=>({...Ce,name:Re.target.value})),placeholder:"e.g., Pioneers",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ms,{value:S.description,onChange:Re=>C(Ce=>({...Ce,description:Re.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(J,{onClick:()=>ie.mutate({...S,id:w==null?void 0:w.id}),disabled:!S.name.trim(),children:w?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Br,{open:A,onOpenChange:E,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ba,{defaultValue:"brokerages",children:[r.jsxs(fa,{className:"w-full",children:[r.jsx(ln,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(ln,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(An,{value:"brokerages",className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select brokerages to grant all their agents access to this private group."}),r.jsx(Jo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[he.map(Re=>r.jsxs("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(cc,{checked:Ie(Re.id),onCheckedChange:()=>{T&&Ee.mutate({groupId:T.id,brokerageId:Re.id,isMember:Ie(Re.id)})}}),r.jsx("span",{className:"font-medium",children:Re.name})]}),r.jsxs(Ft,{variant:"secondary",children:[ue.filter(Ce=>Ce.brokerage_id===Re.id).length," agents"]})]},Re.id)),he.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(An,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search users...",value:z,onChange:Re=>F(Re.target.value),className:"pl-9"})]}),r.jsx(Jo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Ke.map(Re=>r.jsx("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(cc,{checked:Ue(Re.id),onCheckedChange:()=>{T&&_e.mutate({groupId:T.id,userId:Re.id,isMember:Ue(Re.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Re.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Re.email})]})]})},Re.id)),Ke.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No users found"})]})})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(J,{onClick:()=>E(!1),children:"Done"})})]})]})})]})})},t4e=e=>{switch(e){case"academy_video":return r.jsx(Sc,{className:"h-3 w-3"});case"template":return r.jsx(Ai,{className:"h-3 w-3"});case"toolbox":return r.jsx(Ol,{className:"h-3 w-3"});case"newsletter":return r.jsx(Vx,{className:"h-3 w-3"});case"social_swag":return r.jsx(Ss,{className:"h-3 w-3"});default:return r.jsx(Ls,{className:"h-3 w-3"})}},Swt=e=>{switch(e){case"academy_video":return"Academy";case"template":return"Template";case"toolbox":return"Toolbox";case"newsletter":return"Newsletter";case"social_swag":return"Social Swag";default:return e}},Cwt=e=>{switch(e){case"view":return"Viewed";case"click_canva":return"Clicked Canva";case"click_pdf":return"Downloaded PDF";case"click_video":return"Watched Video";case"click_link":return"Clicked Link";case"click_drive":return"Clicked Drive";default:return e}},Mwt=()=>{const{toast:e}=pa(),[t,n]=P.useState([]),[s,i]=P.useState([]),[o,l]=P.useState([]),[a,h]=P.useState(!0),[p,x]=P.useState(""),[y,w]=P.useState(null),[j,S]=P.useState([]),[C,A]=P.useState([]);P.useEffect(()=>{E()},[]);const E=async()=>{try{h(!0);const{data:F,error:q}=await ee.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(q)throw q;const{data:H,error:K}=await ee.from("content_engagement_logs").select(` id, user_id, resource_type, resource_id, resource_title, action_type, created_at `).order("created_at",{ascending:!1}).limit(5e3);if(K)throw K;const Z=[...new Set((H==null?void 0:H.map(ie=>ie.user_id))||[])],{data:re}=await ee.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",Z),ue=new Map((re==null?void 0:re.map(ie=>[ie.id,ie]))||[]),he=(F==null?void 0:F.map(ie=>{var fe,de,_e,Ee;return{id:ie.id,user_id:ie.user_id,app_name:ie.app_name,launched_at:ie.launched_at,user_name:((fe=ie.profiles)==null?void 0:fe.name)||"Unknown",user_email:((de=ie.profiles)==null?void 0:de.email)||"Unknown",brokerage_name:((Ee=(_e=ie.profiles)==null?void 0:_e.brokerages)==null?void 0:Ee.name)||null}}))||[],be=(H==null?void 0:H.map(ie=>{var de;const fe=ue.get(ie.user_id);return{id:ie.id,user_id:ie.user_id,resource_type:ie.resource_type,resource_id:ie.resource_id,resource_title:ie.resource_title,action_type:ie.action_type,created_at:ie.created_at,user_name:(fe==null?void 0:fe.name)||"Unknown",user_email:(fe==null?void 0:fe.email)||"Unknown",brokerage_name:((de=fe==null?void 0:fe.brokerages)==null?void 0:de.name)||null}}))||[];n(he),i(be);const ne=new Map;he.forEach(ie=>{if(!ne.has(ie.user_id))ne.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:"app",last_activity_name:ie.app_name,last_activity_at:ie.launched_at,total_app_launches:1,total_content_views:0});else{const fe=ne.get(ie.user_id);fe.total_app_launches++,new Date(ie.launched_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type="app",fe.last_activity_name=ie.app_name,fe.last_activity_at=ie.launched_at)}}),be.forEach(ie=>{if(!ne.has(ie.user_id))ne.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:ie.resource_type,last_activity_name:ie.resource_title,last_activity_at:ie.created_at,total_app_launches:0,total_content_views:1});else{const fe=ne.get(ie.user_id);fe.total_content_views++,new Date(ie.created_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type=ie.resource_type,fe.last_activity_name=ie.resource_title,fe.last_activity_at=ie.created_at)}});const ye=Array.from(ne.values()).sort((ie,fe)=>new Date(fe.last_activity_at).getTime()-new Date(ie.last_activity_at).getTime());l(ye)}catch(F){console.error("Error loading activity:",F),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{h(!1)}},T=F=>{w({id:F.user_id,name:F.user_name,email:F.user_email});const q=t.filter(K=>K.user_id===F.user_id),H=s.filter(K=>K.user_id===F.user_id);S(q),A(H)},O=()=>{w(null),S([]),A([])},z=o.filter(F=>{var H;if(!p)return!0;const q=p.toLowerCase();return F.user_name.toLowerCase().includes(q)||F.user_email.toLowerCase().includes(q)||((H=F.brokerage_name)==null?void 0:H.toLowerCase().includes(q))});return a?r.jsx(We,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"User Activity"}),r.jsx(En,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name, email, or brokerage...",value:p,onChange:F=>x(F.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"User"}),r.jsx(Et,{children:"Brokerage"}),r.jsx(Et,{children:"Last Activity"}),r.jsx(Et,{children:"Last Active"}),r.jsx(Et,{className:"text-right",children:"Apps"}),r.jsx(Et,{className:"text-right",children:"Content"})]})}),r.jsx(Hs,{children:z.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):z.map(F=>r.jsxs(Ir,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>T(F),children:[r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:F.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:F.user_email})]})}),r.jsx(vt,{children:F.brokerage_name?r.jsx(Ft,{variant:"outline",children:F.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(vt,{children:r.jsx("div",{className:"flex items-center gap-2",children:F.last_activity_type==="app"?r.jsxs(Ft,{variant:"secondary",children:[r.jsx(Ls,{className:"h-3 w-3 mr-1"}),F.last_activity_name]}):r.jsxs(Ft,{variant:"outline",className:"flex items-center gap-1",children:[t4e(F.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:F.last_activity_name})]})})}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:tu(new Date(F.last_activity_at),{addSuffix:!0})}),r.jsx(vt,{className:"text-right",children:r.jsx(Ft,{variant:"outline",children:F.total_app_launches})}),r.jsx(vt,{className:"text-right",children:r.jsx(Ft,{variant:"outline",children:F.total_content_views})})]},F.user_id))})]})})]})]}),r.jsx(Br,{open:!!y,onOpenChange:F=>!F&&O(),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(es,{children:y==null?void 0:y.email})]}),r.jsxs(ba,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsxs(ln,{value:"content",children:["Content (",C.length,")"]}),r.jsxs(ln,{value:"apps",children:["App Launches (",j.length,")"]})]}),r.jsx(An,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Type"}),r.jsx(Et,{children:"Resource"}),r.jsx(Et,{children:"Action"}),r.jsx(Et,{children:"Time"})]})}),r.jsx(Hs,{children:C.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):C.map(F=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs(Ft,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[t4e(F.resource_type),Swt(F.resource_type)]})}),r.jsx(vt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:F.resource_title})}),r.jsx(vt,{children:r.jsx(Ft,{variant:"secondary",children:Cwt(F.action_type)})}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:tu(new Date(F.created_at),{addSuffix:!0})})]},F.id))})]})})}),r.jsx(An,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"App"}),r.jsx(Et,{children:"Time"})]})}),r.jsx(Hs,{children:j.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):j.map(F=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsx(Ft,{variant:"secondary",children:F.app_name})}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:tu(new Date(F.launched_at),{addSuffix:!0})})]},F.id))})]})})})]})]})})]})},Twt=()=>{const{toast:e}=pa(),[t,n]=P.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,i]=P.useState(!0);P.useEffect(()=>{o()},[]);const o=async()=>{try{i(!0);const{count:l}=await ee.from("profiles").select("*",{count:"exact",head:!0}),{count:a}=await ee.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),h=(l||0)-(a||0),{count:p}=await ee.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:w}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),j=new Date;j.setMonth(j.getMonth()-1);const{count:S}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",j.toISOString()),{data:C}=await ee.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),A=new Set(C==null?void 0:C.map(E=>E.user_id)).size;n({totalUsers:l||0,activeUsers:a||0,pendingUsers:h,totalBrokerages:p||0,totalLaunches:x||0,launchesThisWeek:w||0,launchesThisMonth:S||0,uniqueActiveThisWeek:A})}catch(l){console.error("Error loading analytics:",l),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{i(!1)}};return s?r.jsx(We,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalUsers}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.activeUsers," active, ",t.pendingUsers," pending"]})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.activeUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:t.totalUsers>0?`${Math.round(t.activeUsers/t.totalUsers*100)}% of total`:"0% of total"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ki,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.pendingUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(na,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalBrokerages}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(xg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(xg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(xg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(Kf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},r4e={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},n4e={event:"bg-blue-100 text-blue-800",template:"bg-purple-100 text-purple-800",academy_video:"bg-green-100 text-green-800",resource_kit:"bg-orange-100 text-orange-800",newsletter:"bg-pink-100 text-pink-800",social_swag:"bg-yellow-100 text-yellow-800"};function Sze({brokerageOnly:e=!1,brokerageId:t}){const[n,s]=P.useState([]),[i,o]=P.useState(!0),[l,a]=P.useState(""),[h,p]=P.useState("all");P.useEffect(()=>{x()},[t]);const x=async()=>{o(!0);try{let E=[];if(e&&t){const{data:Z}=await ee.from("profiles").select("id").eq("brokerage_id",t);if(E=(Z==null?void 0:Z.map(re=>re.id))||[],E.length===0){s([]),o(!1);return}}let T=ee.from("resource_shares").select("*").order("created_at",{ascending:!1});e&&E.length>0&&(T=T.or(`sender_id.in.(${E.join(",")}),recipient_id.in.(${E.join(",")})`));const{data:O,error:z}=await T;if(z)throw z;const F=new Set;O==null||O.forEach(Z=>{F.add(Z.sender_id),F.add(Z.recipient_id)});const{data:q}=await ee.from("profiles").select("id, name, email").in("id",Array.from(F)),H=new Map((q==null?void 0:q.map(Z=>[Z.id,Z]))||[]),K=(O==null?void 0:O.map(Z=>({...Z,sender:H.get(Z.sender_id),recipient:H.get(Z.recipient_id)})))||[];s(K)}catch(E){console.error("Error loading shares:",E)}finally{o(!1)}},y=n.filter(E=>{var z,F;const T=l===""||E.resource_title.toLowerCase().includes(l.toLowerCase())||((z=E.sender)==null?void 0:z.name.toLowerCase().includes(l.toLowerCase()))||((F=E.recipient)==null?void 0:F.name.toLowerCase().includes(l.toLowerCase())),O=h==="all"||E.resource_type===h;return T&&O}),w=n.length,j=new Set(n.map(E=>E.sender_id)).size,S=new Set(n.map(E=>E.recipient_id)).size,C=n.length>0?Math.round(n.filter(E=>E.is_read).length/n.length*100):0,A=n.reduce((E,T)=>(E[T.resource_type]=(E[T.resource_type]||0)+1,E),{});return i?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((E,T)=>r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Pr,{className:"h-4 w-20"})}),r.jsx(Xe,{children:r.jsx(Pr,{className:"h-8 w-16"})})]},T))}),r.jsx(We,{children:r.jsx(Xe,{className:"p-6",children:r.jsx(Pr,{className:"h-[300px]"})})})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:w})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(Kf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:S})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[C,"%"]})})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(A).map(([E,T])=>r.jsxs(Ft,{variant:"secondary",className:n4e[E],children:[r4e[E],": ",T]},E)),Object.keys(A).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Share History"}),r.jsxs(En,{children:["All resource shares ",e?"in your brokerage":"across the platform"]})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:E=>a(E.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:h,onValueChange:p,children:[r.jsx(vn,{className:"w-[180px]",children:r.jsx(wn,{placeholder:"Resource type"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Types"}),r.jsx(Kt,{value:"event",children:"Events"}),r.jsx(Kt,{value:"template",children:"Templates"}),r.jsx(Kt,{value:"academy_video",children:"Academy Videos"}),r.jsx(Kt,{value:"resource_kit",children:"Resource Kits"}),r.jsx(Kt,{value:"newsletter",children:"Newsletters"}),r.jsx(Kt,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(Jo,{className:"h-[400px]",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Resource"}),r.jsx(Et,{children:"Type"}),r.jsx(Et,{children:"Sender"}),r.jsx(Et,{children:"Recipient"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{children:"Date"})]})}),r.jsx(Hs,{children:y.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(E=>{var T,O;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium max-w-[200px] truncate",children:E.resource_title}),r.jsx(vt,{children:r.jsx(Ft,{variant:"secondary",className:n4e[E.resource_type],children:r4e[E.resource_type]})}),r.jsx(vt,{children:((T=E.sender)==null?void 0:T.name)||"Unknown"}),r.jsx(vt,{children:((O=E.recipient)==null?void 0:O.name)||"Unknown"}),r.jsx(vt,{children:r.jsx(Ft,{variant:E.is_read?"default":"outline",children:E.is_read?"Read":"Unread"})}),r.jsx(vt,{className:"text-muted-foreground",children:fn(new Date(E.created_at),"MMM d, yyyy")})]},E.id)})})]})})]})]})]})}const Awt=()=>r.jsx(Or,{title:"Analytics",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Analytics & Activity"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Platform-wide usage statistics and user activity"})]}),r.jsxs(ba,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"analytics",children:"Analytics"}),r.jsx(ln,{value:"activity",children:"Activity"}),r.jsx(ln,{value:"shares",children:"Shares"})]}),r.jsx(An,{value:"analytics",className:"space-y-4",children:r.jsx(Twt,{})}),r.jsx(An,{value:"activity",className:"space-y-4",children:r.jsx(Mwt,{})}),r.jsx(An,{value:"shares",className:"space-y-4",children:r.jsx(Sze,{})})]})]})});function Ewt(){const e=Wr(),[t,n]=P.useState(!1),[s,i]=P.useState(null),[o,l]=P.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[a,h]=P.useState(null),[p,x]=P.useState(""),[y,w]=P.useState([]),[j,S]=P.useState([]),[C,A]=P.useState([]),[E,T]=P.useState(!1),[O,z]=P.useState(null),[F,q]=P.useState(""),{data:H,isLoading:K}=Jt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Te,error:Ye}=await ee.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(Ye)throw Ye;return Te}}),{data:Z}=Jt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Te,error:Ye}=await ee.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Te}}),{data:re}=Jt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Te,error:Ye}=await ee.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Te}}),{data:ue}=Jt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Te,error:Ye}=await ee.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Te}}),{data:he,isLoading:be}=Jt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Te,error:Ye}=await ee.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Te}}),ne=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),h(null),x(""),w([]),S([]),A([]),i(null),q("")},ye=Te=>{i(Te),l({title:Te.title,description:Te.description||"",publish_date:Te.publish_date.split("T")[0],is_published:Te.is_published,category_id:Te.category_id||""}),x(Te.preview_image_url||""),q("");const Ye=(Z==null?void 0:Z.filter(et=>et.resource_id===Te.id))||[];w(Ye.map(et=>({id:et.id,name:et.name,file_url:et.file_url,file_size:et.file_size,sort_order:et.sort_order})));const xe=(re==null?void 0:re.filter(et=>et.resource_id===Te.id))||[];S(xe.map(et=>({id:et.id,title:et.title,video_url:et.video_url,sort_order:et.sort_order})));const mt=(ue==null?void 0:ue.filter(et=>et.resource_id===Te.id))||[];A(mt.map(et=>({id:et.id,title:et.title,canva_share_link:et.canva_share_link,sort_order:et.sort_order}))),n(!0)},ie=Te=>{var xe;const Ye=(xe=Te.target.files)==null?void 0:xe[0];Ye&&(h(Ye),x(URL.createObjectURL(Ye)))},fe=()=>{w([...y,{name:"",file_url:"",sort_order:y.length}])},de=Te=>{w(y.filter((Ye,xe)=>xe!==Te))},_e=(Te,Ye,xe)=>{const mt=[...y];if(Ye==="file"&&xe instanceof File){const et=xe.name.replace(/\.[^/.]+$/,"");mt[Te]={...mt[Te],file:xe,file_size:xe.size,name:mt[Te].name||et}}else mt[Te]={...mt[Te],[Ye]:xe};w(mt)},Ee=()=>{S([...j,{title:"",video_url:"",sort_order:j.length}])},ke=Te=>{S(j.filter((Ye,xe)=>xe!==Te))},pe=(Te,Ye,xe)=>{const mt=[...j];Ye==="file"&&xe instanceof File?mt[Te]={...mt[Te],file:xe}:mt[Te]={...mt[Te],[Ye]:xe},S(mt)},ae=()=>{A([...C,{title:"",canva_share_link:"",sort_order:C.length}])},ge=Te=>{A(C.filter((Ye,xe)=>xe!==Te))},Me=(Te,Ye,xe)=>{const mt=[...C];mt[Te]={...mt[Te],[Ye]:xe},A(mt)},Ue=async(Te,Ye)=>{try{const xe=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:Te.name}});if(xe.error)throw xe.error;const{videoId:mt,uploadUrl:et,libraryId:nt}=xe.data,Ae=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:mt,libraryId:nt}});if(Ae.error)throw Ae.error;const{uploadUrl:pt,apiKey:Be}=Ae.data,Qe=new XMLHttpRequest;return Qe.open("PUT",pt,!0),Qe.setRequestHeader("AccessKey",Be),Qe.upload.onprogress=tt=>{if(tt.lengthComputable){const ht=Math.round(tt.loaded/tt.total*100),wt=[...j];wt[Ye]={...wt[Ye],uploadProgress:ht},S(wt)}},await new Promise((tt,ht)=>{Qe.onload=()=>Qe.status>=200&&Qe.status<300?tt():ht(new Error("Upload failed")),Qe.onerror=()=>ht(new Error("Upload failed")),Qe.send(Te)}),`https://iframe.mediadelivery.net/embed/${nt}/${mt}`}catch(xe){throw console.error("Bunny upload error:",xe),xe}},Ie=cr({mutationFn:async Te=>{const{data:Ye,error:xe}=await ee.from("brokerage_resource_categories").insert({name:Te,sort_order:(he==null?void 0:he.length)||0}).select().single();if(xe)throw xe;return Ye},onSuccess:Te=>{e.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Te.id}),q(""),ze.success("Category created")},onError:Te=>{ze.error("Failed to create category: "+Te.message)}}),Ke=cr({mutationFn:async()=>{T(!0);let Te=(s==null?void 0:s.preview_image_url)||null;if(a){const mt=a.name.split(".").pop(),et=`${Date.now()}.${mt}`,{error:nt}=await ee.storage.from("brokerage-resources").upload(`previews/${et}`,a);if(nt)throw nt;const{data:Ae}=ee.storage.from("brokerage-resources").getPublicUrl(`previews/${et}`);Te=Ae.publicUrl}const Ye={title:o.title,description:o.description||null,preview_image_url:Te,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let xe;if(s){const{error:mt}=await ee.from("brokerage_resources").update(Ye).eq("id",s.id);if(mt)throw mt;xe=s.id;const et=(Z==null?void 0:Z.filter(Ct=>Ct.resource_id===s.id).map(Ct=>Ct.id))||[],nt=y.filter(Ct=>Ct.id).map(Ct=>Ct.id),Ae=et.filter(Ct=>!nt.includes(Ct));Ae.length>0&&await ee.from("brokerage_resource_pdfs").delete().in("id",Ae);const pt=(re==null?void 0:re.filter(Ct=>Ct.resource_id===s.id).map(Ct=>Ct.id))||[],Be=j.filter(Ct=>Ct.id).map(Ct=>Ct.id),Qe=pt.filter(Ct=>!Be.includes(Ct));Qe.length>0&&await ee.from("brokerage_resource_videos").delete().in("id",Qe);const tt=(ue==null?void 0:ue.filter(Ct=>Ct.resource_id===s.id).map(Ct=>Ct.id))||[],ht=C.filter(Ct=>Ct.id).map(Ct=>Ct.id),wt=tt.filter(Ct=>!ht.includes(Ct));wt.length>0&&await ee.from("brokerage_resource_links").delete().in("id",wt)}else{const{data:mt,error:et}=await ee.from("brokerage_resources").insert(Ye).select().single();if(et)throw et;xe=mt.id}for(let mt=0;mt{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success(s?"Resource updated":"Resource created"),n(!1),ne(),T(!1)},onError:Te=>{ze.error("Failed to save resource: "+Te.message),T(!1)}}),Re=cr({mutationFn:async Te=>{const{error:Ye}=await ee.from("brokerage_resources").delete().eq("id",Te);if(Ye)throw Ye},onSuccess:()=>{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success("Resource deleted")},onError:Te=>{ze.error("Failed to delete: "+Te.message)}}),Ce=Te=>{if(Te.preventDefault(),!o.title){ze.error("Please enter a title");return}Ke.mutate()},Je=Te=>{const Ye=(Z==null?void 0:Z.filter(et=>et.resource_id===Te).length)||0,xe=(re==null?void 0:re.filter(et=>et.resource_id===Te).length)||0,mt=(ue==null?void 0:ue.filter(et=>et.resource_id===Te).length)||0;return{pdfCount:Ye,videoCount:xe,linkCount:mt}};return r.jsx(Or,{title:"Brokerage Resources Management",description:"Create and manage resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(H==null?void 0:H.length)||0})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(H==null?void 0:H.filter(Te=>Te.is_published).length)||0})})]})]}),r.jsxs(J,{onClick:()=>{ne(),n(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Category"}),r.jsx(Et,{children:"Content"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:K?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(H==null?void 0:H.length)===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):H==null?void 0:H.map(Te=>{const{pdfCount:Ye,videoCount:xe,linkCount:mt}=Je(Te.id),et=he==null?void 0:he.find(nt=>nt.id===Te.category_id);return r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Te.preview_image_url?r.jsx("img",{src:Te.preview_image_url,alt:Te.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(gh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Te.title}),Te.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Te.description})]})]})}),r.jsx(vt,{children:et?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:et.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ai,{className:"h-3.5 w-3.5"}),Ye]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fi,{className:"h-3.5 w-3.5"}),xe]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(So,{className:"h-3.5 w-3.5"}),mt]})]})}),r.jsx(vt,{children:fn(new Date(Te.publish_date),"MMM d, yyyy")}),r.jsx(vt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Te.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Te.is_published?"Published":"Draft"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{const nt=(Z==null?void 0:Z.filter(Be=>Be.resource_id===Te.id))||[],Ae=(re==null?void 0:re.filter(Be=>Be.resource_id===Te.id))||[],pt=(ue==null?void 0:ue.filter(Be=>Be.resource_id===Te.id))||[];z({...Te,pdfs:nt,videos:Ae,links:pt})},children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>ye(Te),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Re.mutate(Te.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},Te.id)})})]})})}),r.jsx(Br,{open:t,onOpenChange:n,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:Ce,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[p?r.jsx("img",{src:p,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(gh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(ct,{type:"file",accept:"image/*",onChange:ie})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title *"}),r.jsx(ct,{id:"title",value:o.title,onChange:Te=>l({...o,title:Te.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{className:"flex items-center gap-2",children:[r.jsx(Hx,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(bn,{value:o.category_id,onValueChange:Te=>l({...o,category_id:Te}),children:[r.jsx(vn,{className:"flex-1",children:r.jsx(wn,{placeholder:"Select a category"})}),r.jsx(_n,{children:he==null?void 0:he.map(Te=>r.jsx(Kt,{value:Te.id,children:Te.name},Te.id))})]}),o.category_id&&r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(Ts,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{placeholder:"Or create new category...",value:F,onChange:Te=>q(Te.target.value),className:"flex-1"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",disabled:!F.trim()||Ie.isPending,onClick:()=>Ie.mutate(F.trim()),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:o.description,onChange:Te=>l({...o,description:Te}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ct,{id:"publish_date",type:"date",value:o.publish_date,onChange:Te=>l({...o,publish_date:Te.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx($s,{checked:o.is_published,onCheckedChange:Te=>l({...o,is_published:Te})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ve,{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Te,Ye)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(ct,{placeholder:"PDF Name",value:Te.name,onChange:xe=>_e(Ye,"name",xe.target.value),className:"flex-1"}),r.jsx(ct,{type:"file",accept:".pdf",onChange:xe=>{var et;const mt=(et=xe.target.files)==null?void 0:et[0];mt&&_e(Ye,"file",mt)},className:"flex-1"}),Te.file_url&&!Te.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>de(Ye),children:r.jsx(Ts,{className:"h-4 w-4"})})]},Ye))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ve,{className:"flex items-center gap-2",children:[r.jsx(Fi,{className:"h-4 w-4"}),"Videos (",j.length,")"]}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:Ee,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),j.map((Te,Ye)=>r.jsxs("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ct,{placeholder:"Video Title",value:Te.title,onChange:xe=>pe(Ye,"title",xe.target.value),className:"flex-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>ke(Ye),children:r.jsx(Ts,{className:"h-4 w-4"})})]}),r.jsx(ct,{type:"file",accept:"video/*",onChange:xe=>{var et;const mt=(et=xe.target.files)==null?void 0:et[0];mt&&pe(Ye,"file",mt)}}),Te.uploadProgress!==void 0&&Te.uploadProgress>0&&r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${Te.uploadProgress}%`}})}),Te.video_url&&!Te.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},Ye))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ve,{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-4 w-4"}),"Canva Links (",C.length,")"]}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:ae,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),C.map((Te,Ye)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(ct,{placeholder:"Link Title",value:Te.title,onChange:xe=>Me(Ye,"title",xe.target.value),className:"flex-1"}),r.jsx(ct,{placeholder:"Canva Share Link",value:Te.canva_share_link,onChange:xe=>Me(Ye,"canva_share_link",xe.target.value),className:"flex-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>ge(Ye),children:r.jsx(Ts,{className:"h-4 w-4"})})]},Ye))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(J,{type:"submit",disabled:Ke.isPending||E,children:Ke.isPending||E?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Br,{open:!!O,onOpenChange:()=>z(null),children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:O==null?void 0:O.title})}),O&&r.jsxs("div",{className:"space-y-4",children:[O.preview_image_url&&r.jsx("img",{src:O.preview_image_url,alt:O.title,className:"w-full h-48 object-cover rounded-lg"}),O.description&&r.jsx("p",{className:"text-muted-foreground",children:O.description}),O.pdfs&&O.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"PDF Documents (",O.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:O.pdfs.map(Te=>r.jsx("a",{href:Te.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Te.name},Te.id))})]}),O.videos&&O.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Fi,{className:"h-4 w-4"}),"Videos (",O.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:O.videos.map(Te=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Te.title})},Te.id))})]}),O.links&&O.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(So,{className:"h-4 w-4"}),"Canva Links (",O.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:O.links.map(Te=>r.jsx("a",{href:Te.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Te.title},Te.id))})]})]})]})})]})})}const Cze=[{value:"events",label:"After Events Section"},{value:"academy",label:"After Academy Section"},{value:"toolbox",label:"After Toolbox Section"},{value:"templates",label:"After Templates Section"},{value:"apps",label:"After Apps Section"}];function Iwt(){const[e,t]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[l,a]=P.useState(!1),[h,p]=P.useState(null),[x,y]=P.useState(!1),[w,j]=P.useState(!1),[S,C]=P.useState(""),[A,E]=P.useState(""),[T,O]=P.useState(""),[z,F]=P.useState(""),[q,H]=P.useState("Learn More"),[K,Z]=P.useState("top"),[re,ue]=P.useState(""),[he,be]=P.useState(!0),[ne,ye]=P.useState(""),[ie,fe]=P.useState("");P.useEffect(()=>{de()},[]);const de=async()=>{try{const{data:Ie,error:Ke}=await ee.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Ke)throw Ke;t(Ie||[])}catch(Ie){ze.error("Failed to load banners: "+Ie.message)}finally{s(!1)}},_e=()=>{C(""),E(""),O(""),F(""),H("Learn More"),Z("top"),ue(""),be(!0),ye(""),fe(""),p(null)},Ee=Ie=>{p(Ie),C(Ie.title),E(Ie.description||""),O(Ie.image_url),F(Ie.link_url||""),H(Ie.link_text||"Learn More"),Z(Ie.placement),ue(Ie.section_after||""),be(Ie.is_active),ye(Ie.start_date?fn(new Date(Ie.start_date),"yyyy-MM-dd'T'HH:mm"):""),fe(Ie.end_date?fn(new Date(Ie.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},ke=async Ie=>{var Re;const Ke=(Re=Ie.target.files)==null?void 0:Re[0];if(Ke){y(!0);try{const Ce=Ke.name.split(".").pop(),Je=`${Date.now()}.${Ce}`,{error:Te}=await ee.storage.from("banner-images").upload(Je,Ke);if(Te)throw Te;const{data:{publicUrl:Ye}}=ee.storage.from("banner-images").getPublicUrl(Je);O(Ye),ze.success("Image uploaded successfully")}catch(Ce){ze.error("Failed to upload image: "+Ce.message)}finally{y(!1)}}},pe=async()=>{if(!S.trim()||!T){ze.error("Please fill in required fields (title and image)");return}j(!0);try{const Ie={title:S.trim(),description:A.trim()||null,image_url:T,link_url:z.trim()||null,link_text:q.trim()||"Learn More",placement:K,section_after:K==="between"?re:null,is_active:he,start_date:ne?new Date(ne).toISOString():null,end_date:ie?new Date(ie).toISOString():null};if(h){const{error:Ke}=await ee.from("dashboard_banners").update(Ie).eq("id",h.id);if(Ke)throw Ke;ze.success("Banner updated successfully")}else{const Ke=e.filter(Ce=>Ce.placement===K).length,{error:Re}=await ee.from("dashboard_banners").insert({...Ie,sort_order:Ke});if(Re)throw Re;ze.success("Banner created successfully")}o(!1),_e(),de()}catch(Ie){ze.error("Failed to save banner: "+Ie.message)}finally{j(!1)}},ae=async()=>{if(h)try{const{error:Ie}=await ee.from("dashboard_banners").delete().eq("id",h.id);if(Ie)throw Ie;ze.success("Banner deleted successfully"),a(!1),p(null),de()}catch(Ie){ze.error("Failed to delete banner: "+Ie.message)}},ge=async Ie=>{try{const{error:Ke}=await ee.from("dashboard_banners").update({is_active:!Ie.is_active}).eq("id",Ie.id);if(Ke)throw Ke;ze.success(Ie.is_active?"Banner deactivated":"Banner activated"),de()}catch(Ke){ze.error("Failed to update banner: "+Ke.message)}},Me=e.filter(Ie=>Ie.placement==="top"),Ue=e.filter(Ie=>Ie.placement==="between");return n?r.jsx(Or,{title:"Dashboard Management",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):r.jsxs(Or,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Zo,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(En,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Br,{open:i&&K==="top",onOpenChange:Ie=>{Ie||_e(),o(Ie),Ie&&Z("top")},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{onClick:()=>{_e(),Z("top")},children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[h?"Edit":"Create"," Banner"]}),r.jsx(es,{children:"Configure the banner's content and display settings"})]}),r.jsx(s4e,{title:S,setTitle:C,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:H,placement:K,setPlacement:Z,sectionAfter:re,setSectionAfter:ue,isActive:he,setIsActive:be,startDate:ne,setStartDate:ye,endDate:ie,setEndDate:fe,handleImageUpload:ke,uploading:x,showPlacementOptions:!1}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>{o(!1),_e()},children:"Cancel"}),r.jsx(J,{onClick:pe,disabled:w,children:w?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Xe,{children:Me.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hero banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Me.map(Ie=>r.jsx(i4e,{banner:Ie,onEdit:()=>Ee(Ie),onDelete:()=>{p(Ie),a(!0)},onToggleActive:()=>ge(Ie)},Ie.id))})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Zo,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(En,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Br,{open:i&&K==="between",onOpenChange:Ie=>{Ie||_e(),o(Ie),Ie&&Z("between")},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{onClick:()=>{_e(),Z("between")},children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[h?"Edit":"Create"," Section Banner"]}),r.jsx(es,{children:"Configure where this banner appears between sections"})]}),r.jsx(s4e,{title:S,setTitle:C,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:H,placement:K,setPlacement:Z,sectionAfter:re,setSectionAfter:ue,isActive:he,setIsActive:be,startDate:ne,setStartDate:ye,endDate:ie,setEndDate:fe,handleImageUpload:ke,uploading:x,showPlacementOptions:!0}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>{o(!1),_e()},children:"Cancel"}),r.jsx(J,{onClick:pe,disabled:w,children:w?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Xe,{children:Ue.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No section banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Ue.map(Ie=>r.jsx(i4e,{banner:Ie,onEdit:()=>Ee(Ie),onDelete:()=>{p(Ie),a(!0)},onToggleActive:()=>ge(Ie),showSection:!0},Ie.id))})})]})]}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Delete Banner"}),r.jsxs(es,{children:['Are you sure you want to delete "',h==null?void 0:h.title,'"? This action cannot be undone.']})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(J,{variant:"destructive",onClick:ae,children:"Delete"})]})]})})]})}function s4e({title:e,setTitle:t,description:n,setDescription:s,imageUrl:i,linkUrl:o,setLinkUrl:l,linkText:a,setLinkText:h,placement:p,setPlacement:x,sectionAfter:y,setSectionAfter:w,isActive:j,setIsActive:S,startDate:C,setStartDate:A,endDate:E,setEndDate:T,handleImageUpload:O,uploading:z,showPlacementOptions:F}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title *"}),r.jsx(ct,{id:"title",placeholder:"Banner headline...",value:e,onChange:q=>t(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",placeholder:"Optional banner description...",value:n,onChange:q=>s(q.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ct,{type:"file",accept:"image/*",onChange:O,disabled:z,className:"flex-1"}),z&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),i&&r.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:r.jsx("img",{src:i,alt:"Preview",className:"w-full h-40 object-cover"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(ct,{id:"linkUrl",placeholder:"https://...",value:o,onChange:q=>l(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"linkText",children:"Button Text"}),r.jsx(ct,{id:"linkText",placeholder:"Learn More",value:a,onChange:q=>h(q.target.value)})]})]}),F&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Placement"}),r.jsxs(bn,{value:y,onValueChange:w,children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select section placement..."})}),r.jsx(_n,{children:Cze.map(q=>r.jsx(Kt,{value:q.value,children:q.label},q.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(ct,{id:"startDate",type:"datetime-local",value:C,onChange:q=>A(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(ct,{id:"endDate",type:"datetime-local",value:E,onChange:q=>T(q.target.value)})]})]}),r.jsx("div",{className:"flex items-center justify-between pt-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"isActive",checked:j,onCheckedChange:S}),r.jsx(Ve,{htmlFor:"isActive",children:"Active"})]})})]})}function i4e({banner:e,onEdit:t,onDelete:n,onToggleActive:s,showSection:i=!1}){var l;const o=(l=Cze.find(a=>a.value===e.section_after))==null?void 0:l.label;return r.jsxs("div",{className:"flex items-center gap-4 p-3 border rounded-lg bg-card hover:bg-accent/50 transition-colors",children:[r.jsx(pj,{className:"h-5 w-5 text-muted-foreground cursor-grab"}),r.jsx("img",{src:e.image_url,alt:e.title,className:"w-24 h-14 object-cover rounded"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"font-medium truncate",children:e.title}),!e.is_active&&r.jsx(Ft,{variant:"secondary",children:"Inactive"}),e.start_date&&new Date(e.start_date)>new Date&&r.jsx(Ft,{variant:"outline",children:"Scheduled"})]}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:e.description}),i&&o&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.link_url&&r.jsx("a",{href:e.link_url,target:"_blank",rel:"noopener noreferrer",children:r.jsx(J,{variant:"ghost",size:"icon",children:r.jsx(Ls,{className:"h-4 w-4"})})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:s,children:e.is_active?r.jsx(Qo,{className:"h-4 w-4"}):r.jsx(c1,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:t,children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]})}const DL={open:{label:"Open",icon:Ki,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Zl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:qa,color:"bg-green-500"},closed:{label:"Closed",icon:zc,color:"bg-muted-foreground"}},a4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Pwt(){var q,H;const{user:e}=zr(),t=Wr(),[n,s]=P.useState(null),[i,o]=P.useState(""),[l,a]=P.useState("all"),[h,p]=P.useState("all"),[x,y]=P.useState(!1),{data:w=[],isLoading:j}=Jt({queryKey:["admin-support-tickets",l,h],queryFn:async()=>{let K=ee.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(K=K.eq("status",l)),h!=="all"&&(K=K.eq("category",h));const{data:Z,error:re}=await K;if(re)throw re;return Z}}),{data:S=[]}=Jt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("user_roles").select("user_id").eq("role","admin");if(Z)throw Z;const re=K.map(ie=>ie.user_id),{data:ue,error:he}=await ee.from("profiles").select("id, name, email").in("id",re);if(he)throw he;const{data:be,error:ne}=await ee.from("support_notification_settings").select("user_id, receive_notifications");if(ne)throw ne;const ye=new Map((be==null?void 0:be.map(ie=>[ie.user_id,ie.receive_notifications]))||[]);return ue.map(ie=>({...ie,receives_notifications:ye.get(ie.id)||!1}))}}),{data:C=[]}=Jt({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:K,error:Z}=await ee.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(Z)throw Z;return K},enabled:!!n}),A=cr({mutationFn:async({userId:K,enabled:Z})=>{const{data:re}=await ee.from("support_notification_settings").select("id").eq("user_id",K).maybeSingle();if(re){const{error:ue}=await ee.from("support_notification_settings").update({receive_notifications:Z}).eq("user_id",K);if(ue)throw ue}else{const{error:ue}=await ee.from("support_notification_settings").insert({user_id:K,receive_notifications:Z});if(ue)throw ue}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-users-notifications"]}),ze.success("Notification settings updated")},onError:()=>{ze.error("Failed to update settings")}}),E=cr({mutationFn:async({ticketId:K,status:Z})=>{const{error:re}=await ee.from("support_tickets").update({status:Z}).eq("id",K);if(re)throw re},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),ze.success("Status updated")},onError:()=>{ze.error("Failed to update status")}}),T=cr({mutationFn:async({ticketId:K,assignedTo:Z})=>{const{error:re}=await ee.from("support_tickets").update({assigned_to:Z}).eq("id",K);if(re)throw re},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),ze.success("Ticket assigned")},onError:()=>{ze.error("Failed to assign ticket")}}),O=cr({mutationFn:async K=>{var re,ue;if(!n||!e)throw new Error("Missing data");const{error:Z}=await ee.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:K,is_admin_reply:!0});if(Z)throw Z;try{await ee.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:K,userEmail:(re=n.profiles)==null?void 0:re.email,userName:(ue=n.profiles)==null?void 0:ue.name}})}catch(he){console.error("Failed to send reply notification:",he)}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),z=()=>{i.trim()&&O.mutate(i)};P.useEffect(()=>{const K=ee.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{ee.removeChannel(K)}},[t]);const F=w.filter(K=>K.status==="open").length;return n?(DL[n.status].icon,r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ft,{variant:"secondary",children:a4e[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((q=n.profiles)==null?void 0:q.name)||"Unknown"," (",(H=n.profiles)==null?void 0:H.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm",children:"Status"})}),r.jsx(Xe,{children:r.jsxs(bn,{value:n.status,onValueChange:K=>{E.mutate({ticketId:n.id,status:K}),s({...n,status:K})},children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"open",children:"Open"}),r.jsx(Kt,{value:"in_progress",children:"In Progress"}),r.jsx(Kt,{value:"resolved",children:"Resolved"}),r.jsx(Kt,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm",children:"Assigned To"})}),r.jsx(Xe,{children:r.jsxs(bn,{value:n.assigned_to||"unassigned",onValueChange:K=>{const Z=K==="unassigned"?null:K;T.mutate({ticketId:n.id,assignedTo:Z}),s({...n,assigned_to:Z})},children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Unassigned"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"unassigned",children:"Unassigned"}),S.map(K=>r.jsx(Kt,{value:K.id,children:K.name},K.id))]})]})})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(En,{children:["Created on ",fn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Xe,{children:[r.jsx(Jo,{className:"h-[300px] pr-4",children:C.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:C.map(K=>{var Z,re;return r.jsxs("div",{className:`p-4 rounded-lg ${K.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:K.is_admin_reply?`${((Z=K.profiles)==null?void 0:Z.name)||"Admin"} (Support)`:((re=K.profiles)==null?void 0:re.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:fn(new Date(K.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:K.content})]},K.id)})})}),r.jsx(Qd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ms,{placeholder:"Type your reply...",value:i,onChange:K=>o(K.target.value),className:"min-h-[80px]"}),r.jsx(J,{onClick:z,disabled:!i.trim()||O.isPending,className:"self-end",children:r.jsx(Lo,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Support Tickets"}),r.jsxs("p",{className:"text-muted-foreground",children:["Manage support requests from agents",F>0&&r.jsxs(Ft,{variant:"destructive",className:"ml-2",children:[F," open"]})]})]}),r.jsxs(Br,{open:x,onOpenChange:y,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{variant:"outline",children:[r.jsx(hd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Email Notification Settings"}),r.jsx(es,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:S.map(K=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:K.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:K.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[K.receives_notifications?r.jsx(vg,{className:"h-4 w-4 text-primary"}):r.jsx(aj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx($s,{checked:K.receives_notifications,onCheckedChange:Z=>A.mutate({userId:K.id,enabled:Z})})]})]},K.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(ba,{value:l,onValueChange:a,className:"w-auto",children:r.jsxs(fa,{children:[r.jsx(ln,{value:"all",children:"All"}),r.jsx(ln,{value:"open",children:"Open"}),r.jsx(ln,{value:"in_progress",children:"In Progress"}),r.jsx(ln,{value:"resolved",children:"Resolved"}),r.jsx(ln,{value:"closed",children:"Closed"})]})}),r.jsxs(bn,{value:h,onValueChange:p,children:[r.jsx(vn,{className:"w-[180px]",children:r.jsx(wn,{placeholder:"All Categories"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Categories"}),r.jsx(Kt,{value:"general",children:"General Support"}),r.jsx(Kt,{value:"technology",children:"Technology Support"}),r.jsx(Kt,{value:"crm",children:"CRM Support"}),r.jsx(Kt,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:j?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):w.length===0?r.jsx(We,{children:r.jsxs(Xe,{className:"text-center py-12",children:[r.jsx(Zl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets found"}),r.jsx("p",{className:"text-muted-foreground",children:"No support tickets match the current filters."})]})}):r.jsx("div",{className:"space-y-3",children:w.map(K=>{var re,ue;const Z=DL[K.status].icon;return r.jsx(We,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(K),children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:K.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(Ft,{variant:"outline",className:"text-xs",children:a4e[K.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(re=K.profiles)==null?void 0:re.name," • ",fn(new Date(K.created_at),"MMM d, yyyy")]}),K.assigned_to&&r.jsxs(Ft,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(Cc,{className:"h-3 w-3"}),((ue=S.find(he=>he.id===K.assigned_to))==null?void 0:ue.name)||"Assigned"]})]})]}),r.jsxs(Ft,{className:DL[K.status].color,children:[r.jsx(Z,{className:"h-3 w-3 mr-1"}),DL[K.status].label]})]})})},K.id)})})})]})]})})}const Lwt=Rd.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function Owt({content:e,onChange:t,variables:n}){const s=oze({extensions:[fze,jze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),kze.configure({types:["heading","paragraph"]}),Nze,Lwt],content:e,onUpdate:({editor:l})=>{t(l.getHTML())}});P.useEffect(()=>{s&&e!==s.getHTML()&&s.commands.setContent(e)},[e,s]);const i=l=>{s&&s.chain().focus().insertContent(`{{${l.key}}}`).run()},o=()=>{if(!s)return;const l=s.getAttributes("link").href,a=window.prompt("URL",l);if(a!==null){if(a===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:a}).run()}};return s?r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-2 border-b bg-muted/30",children:[r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(nS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(Hf,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(oS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(Z4,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("center").run(),className:s.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(K4,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(Y4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(So,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(cj,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(mS,{className:"h-4 w-4"})}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(fS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(eA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(ap,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(po,{onClick:()=>i(l),className:"flex flex-col items-start",children:[r.jsx("span",{className:"font-medium",children:l.label}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:`{{${l.key}}}`}),l.description&&r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:l.description})]},l.key))})]})]}),r.jsx(ize,{editor:s,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"}),n.length>0&&r.jsxs("div",{className:"border-t p-3 bg-muted/20",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Available variables (click to copy):"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(l=>r.jsx(Ft,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 font-mono text-xs",onClick:()=>{navigator.clipboard.writeText(`{{${l.key}}}`)},children:`{{${l.key}}}`},l.key))})]})]}):null}function Dwt(){const e=Wr(),[t,n]=P.useState(null),[s,i]=P.useState(null),[o,l]=P.useState(""),[a,h]=P.useState(""),[p,x]=P.useState(""),[y,w]=P.useState(!0),[j,S]=P.useState("visual"),{data:C,isLoading:A}=Jt({queryKey:["email-templates"],queryFn:async()=>{const{data:F,error:q}=await ee.from("email_templates").select("*").order("name");if(q)throw q;return F.map(H=>({...H,available_variables:H.available_variables||[]}))}}),E=cr({mutationFn:async F=>{const{error:q}=await ee.from("email_templates").update({subject:F.subject,body_html:F.body_html,description:F.description,is_active:F.is_active}).eq("id",F.id);if(q)throw q},onSuccess:()=>{e.invalidateQueries({queryKey:["email-templates"]}),ze.success("Email template updated successfully"),n(null)},onError:F=>{ze.error("Failed to update template: "+F.message)}}),T=F=>{n(F),l(F.subject),h(F.body_html),x(F.description||""),w(F.is_active),S("visual")},O=()=>{t&&E.mutate({id:t.id,subject:o,body_html:a,description:p,is_active:y})},z=(F,q)=>{let H=F;return q.forEach(K=>{const Z=`{{${K.key}}}`,re=`[${K.label}]`;H=H.replace(new RegExp(Z.replace(/[{}]/g,"\\$&"),"g"),re)}),H};return t?r.jsxs(Or,{title:"Edit Email Template",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(J,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(J,{variant:"outline",onClick:()=>i(t),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(J,{onClick:O,disabled:E.isPending,children:[r.jsx(bg,{className:"h-4 w-4 mr-2"}),E.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Zs,{className:"h-5 w-5"}),t.name]}),r.jsxs(En,{className:"mt-1",children:["Template slug: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:t.slug})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ve,{htmlFor:"active-toggle",children:"Active"}),r.jsx($s,{id:"active-toggle",checked:y,onCheckedChange:w})]})]})}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",value:p,onChange:F=>x(F.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"subject",children:"Email Subject"}),r.jsx(ct,{id:"subject",value:o,onChange:F=>l(F.target.value),placeholder:"Email subject line"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["You can use variables like ","{{name}}"," in the subject"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{children:"Email Body"}),r.jsx(ba,{value:j,onValueChange:F=>S(F),children:r.jsxs(fa,{className:"h-8",children:[r.jsxs(ln,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(uS,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(ln,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(cj,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),j==="visual"?r.jsx(Owt,{content:a,onChange:h,variables:t.available_variables}):r.jsx(ms,{value:a,onChange:F=>h(F.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Br,{open:!!s,onOpenChange:()=>i(null),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Email Preview"}),r.jsxs(es,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(a,t.available_variables)}})})]})})]}):r.jsx(Or,{title:"Email Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Email Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and customize system email templates"})]}),A?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((F,q)=>r.jsx(We,{children:r.jsxs(Wt,{children:[r.jsx(Pr,{className:"h-5 w-48"}),r.jsx(Pr,{className:"h-4 w-96"})]})},q))}):r.jsx("div",{className:"grid gap-4",children:C==null?void 0:C.map(F=>r.jsxs(We,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Xt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(Zs,{className:"h-5 w-5 text-muted-foreground"}),F.name,!F.is_active&&r.jsx(Ft,{variant:"secondary",children:"Inactive"})]}),r.jsx(En,{children:F.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>i(F),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(J,{size:"sm",onClick:()=>T(F),children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:F.subject})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Variables:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:F.available_variables.map(q=>r.jsx(Ft,{variant:"outline",className:"font-mono text-xs",children:`{{${q.key}}}`},q.key))})]})]})})]},F.id))}),r.jsx(Br,{open:!!s&&!t,onOpenChange:()=>i(null),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(es,{children:["Subject: ",s==null?void 0:s.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),s&&r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(s.body_html,s.available_variables)}})})]})})]})})}const Rwt=({brokerageId:e})=>{var vo,Bd;const{toast:t}=pa(),[n,s]=P.useState([]),[i,o]=P.useState(!0),[l,a]=P.useState(""),[h,p]=P.useState("all"),[x,y]=P.useState(new Set),[w,j]=P.useState(!1),[S,C]=P.useState(!1),[A,E]=P.useState(!1),[T,O]=P.useState({email:"",name:"",password:"",phone:""}),[z,F]=P.useState(!1),[q,H]=P.useState(null),[K,Z]=P.useState(!1),[re,ue]=P.useState(!1),[he,be]=P.useState(!1),[ne,ye]=P.useState(""),[ie,fe]=P.useState(!1),[de,_e]=P.useState([]),[Ee,ke]=P.useState(!1),[pe,ae]=P.useState(!1),[ge,Me]=P.useState(null),[Ue,Ie]=P.useState({name:"",phone:"",email:""}),[Ke,Re]=P.useState(!1),[Ce,Je]=P.useState(!1),[Te,Ye]=P.useState(null),[xe,mt]=P.useState("asc"),[et,nt]=P.useState(!1),[Ae,pt]=P.useState(null),[Be,Qe]=P.useState(!1),[tt,ht]=P.useState(null),[wt,Ct]=P.useState(""),[It,jt]=P.useState(!1),[rr,Ar]=P.useState(null);P.useEffect(()=>{kn(),gn()},[e]);const gn=async()=>{try{const{data:_r,error:Vn}=await ee.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",e);if(Vn)throw Vn;_e((_r==null?void 0:_r.map(kt=>kt.user_id))||[])}catch(_r){console.error("Error loading brokerage managers:",_r)}},kn=async()=>{try{o(!0);const{data:_r,error:Vn}=await ee.functions.invoke("get-brokerage-agents",{body:{brokerageId:e}});if(Vn)throw Vn;s(_r.agents||[])}catch(_r){console.error("Error loading agents:",_r),t({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},Jr=async()=>{if(!T.email||!T.name||!T.password){t({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}E(!0);try{const{data:{session:_r}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({...T,brokerageId:e})}),kt=await Vn.json();if(!Vn.ok)throw new Error(kt.error||"Failed to create agent");t({title:"Success",description:`Agent ${T.email} created successfully`}),O({email:"",name:"",password:"",phone:""}),C(!1),kn()}catch(_r){console.error("Error creating agent:",_r),t({title:"Error",description:_r.message||"Failed to create agent",variant:"destructive"})}finally{E(!1)}},zn=async _r=>{try{const{data:{session:Vn}}=await ee.auth.getSession(),kt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vn==null?void 0:Vn.access_token}`},body:JSON.stringify({userId:_r})}),we=await kt.json();if(!kt.ok)throw new Error(we.error||"Failed to resend welcome email");t({title:"Success",description:"Welcome email sent successfully"})}catch(Vn){console.error("Error resending welcome email:",Vn),t({title:"Error",description:Vn.message||"Failed to resend welcome email",variant:"destructive"})}},js=async(_r,Vn)=>{try{const{error:kt}=await ee.functions.invoke("send-password-reset",{body:{email:_r,redirectTo:window.location.origin}});if(kt)throw kt;t({title:"Password Reset Sent",description:`Password reset email sent to ${Vn}`})}catch(kt){console.error("Error sending password reset:",kt),t({title:"Error",description:kt.message||"Failed to send password reset email",variant:"destructive"})}},fr=_r=>{H(_r),F(!0)},xs=_r=>{Me(_r),Ie({name:_r.name,phone:_r.phone||"",email:_r.email}),ae(!0)},bi=async()=>{if(!ge)return;if(!Ue.name.trim()){t({title:"Error",description:"Name is required",variant:"destructive"});return}const _r=Ue.email.trim().toLowerCase()!==ge.email.toLowerCase();Re(!0);try{if(_r){if(!Ue.email.trim())throw new Error("Email is required");Je(!0);const{data:{session:kt}}=await ee.auth.getSession(),we=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.access_token}`},body:JSON.stringify({agentId:ge.id,newEmail:Ue.email.trim(),brokerageId:e})}),De=await we.json();if(Je(!1),!we.ok)throw new Error(De.error||"Failed to update email")}const{error:Vn}=await ee.from("profiles").update({name:Ue.name.trim(),phone:Ue.phone.trim()||null}).eq("id",ge.id);if(Vn)throw Vn;t({title:"Success",description:"Agent profile updated successfully"}),ae(!1),Me(null),kn()}catch(Vn){console.error("Error updating agent:",Vn),t({title:"Error",description:Vn.message||"Failed to update agent",variant:"destructive"})}finally{Re(!1),Je(!1)}},mi=async()=>{if(!ne){t({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}fe(!0);try{const{data:{session:_r}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({userId:ne,role:"brokerage_manager",action:"add",brokerageId:e})}),kt=await Vn.json();if(!Vn.ok)throw new Error(kt.error||"Failed to add brokerage manager");t({title:"Success",description:"Brokerage manager added successfully"}),be(!1),ye(""),gn()}catch(_r){console.error("Error adding brokerage manager:",_r),t({title:"Error",description:_r.message||"Failed to add brokerage manager",variant:"destructive"})}finally{fe(!1)}},La=async _r=>{try{const{data:{session:Vn}}=await ee.auth.getSession(),kt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vn==null?void 0:Vn.access_token}`},body:JSON.stringify({userId:_r,role:"brokerage_manager",action:"remove",brokerageId:e})}),we=await kt.json();if(!kt.ok)throw new Error(we.error||"Failed to remove brokerage manager");t({title:"Success",description:"Brokerage manager role removed"}),gn()}catch(Vn){console.error("Error removing brokerage manager:",Vn),t({title:"Error",description:Vn.message||"Failed to remove brokerage manager",variant:"destructive"})}},da=_r=>de.includes(_r),tl=_r=>{ht(_r),Ct(""),Qe(!0)},rl=async()=>{if(!(!tt||!wt)){if(wt.length<6){t({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}jt(!0);try{const{data:{session:_r}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({agentId:tt.id,brokerageId:e,action:"set_password",newPassword:wt})}),kt=await Vn.json();if(!Vn.ok)throw new Error(kt.error||"Failed to set password");t({title:"Success",description:`Password set for ${tt.name}`}),Qe(!1),ht(null),Ct("")}catch(_r){console.error("Error setting password:",_r),t({title:"Error",description:_r.message||"Failed to set password",variant:"destructive"})}finally{jt(!1)}}},Ws=async _r=>{Ar(_r.id);try{const{data:{session:Vn}}=await ee.auth.getSession(),kt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vn==null?void 0:Vn.access_token}`},body:JSON.stringify({agentId:_r.id,brokerageId:e,action:"claim_account"})}),we=await kt.json();if(!kt.ok)throw new Error(we.error||"Failed to claim account");t({title:"Success",description:`Account claimed for ${_r.name}`}),kn()}catch(Vn){console.error("Error claiming account:",Vn),t({title:"Error",description:Vn.message||"Failed to claim account",variant:"destructive"})}finally{Ar(null)}},Zi=async()=>{if(q){Z(!0);try{const{data:{session:_r}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({userId:q.id,brokerageId:e})}),kt=await Vn.json();if(!Vn.ok)throw new Error(kt.error||"Failed to remove agent");t({title:"Success",description:`${q.name} has been removed from your brokerage`}),F(!1),H(null),kn()}catch(_r){console.error("Error removing agent:",_r),t({title:"Error",description:_r.message||"Failed to remove agent",variant:"destructive"})}finally{Z(!1)}}},ks=_r=>{const Vn=_r.trim().split(" ");return Vn.length>1?Vn[Vn.length-1].toLowerCase():_r.toLowerCase()},Ei=_r=>{Te===_r?mt(xe==="asc"?"desc":"asc"):(Ye(_r),mt("asc"))},Ii=_r=>Te!==_r?r.jsx(zx,{className:"ml-1 h-4 w-4"}):xe==="asc"?r.jsx(yg,{className:"ml-1 h-4 w-4"}):r.jsx(n1,{className:"ml-1 h-4 w-4"}),Oo=n.filter(_r=>{if(h==="active"&&!_r.claimed||h==="pending"&&_r.claimed)return!1;if(!l)return!0;const Vn=l.toLowerCase();return _r.name.toLowerCase().includes(Vn)||_r.email.toLowerCase().includes(Vn)}),ir=[...Oo].sort((_r,Vn)=>{if(!Te)return 0;let kt=0;return Te==="name"?kt=ks(_r.name).localeCompare(ks(Vn.name)):Te==="status"&&(kt=_r.claimed===Vn.claimed?0:_r.claimed?-1:1),xe==="asc"?kt:-kt});Oo.filter(_r=>_r.claimed&&!da(_r.id));const xo=_r=>{y(Vn=>{const kt=new Set(Vn);return kt.has(_r)?kt.delete(_r):kt.add(_r),kt})},Tc=()=>{x.size===ir.length?y(new Set):y(new Set(ir.map(_r=>_r.id)))},yo=()=>{y(new Set)},ss=async()=>{const _r=Array.from(x);if(_r.length===0)return;j(!0);let Vn=0,kt=0;try{const{data:{session:we}}=await ee.auth.getSession();for(const De of _r)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${we==null?void 0:we.access_token}`},body:JSON.stringify({userId:De})})).ok?Vn++:kt++}catch{kt++}Vn>0?t({title:"Success",description:`Welcome emails sent to ${Vn} agent${Vn>1?"s":""}${kt>0?` (${kt} failed)`:""}`}):t({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),yo()}catch(we){console.error("Error bulk sending welcome emails:",we),t({title:"Error",description:we.message||"Failed to send welcome emails",variant:"destructive"})}finally{j(!1)}};return i?r.jsx(We,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Agents"}),r.jsx(En,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(J,{variant:"outline",onClick:()=>be(!0),children:[r.jsx(Gf,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(J,{variant:"outline",onClick:()=>ue(!0),children:[r.jsx(u1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(J,{onClick:()=>C(!0),children:[r.jsx(Qh,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search agents...",value:l,onChange:_r=>a(_r.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:h,onValueChange:_r=>p(_r),children:[r.jsx(vn,{className:"w-[160px]",children:r.jsx(wn,{placeholder:"Filter by status"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Agents"}),r.jsx(Kt,{value:"active",children:"Active"}),r.jsx(Kt,{value:"pending",children:"Pending"})]})]})]}),x.size>0&&r.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border bg-muted/50 p-3",children:[r.jsxs("span",{className:"text-sm font-medium",children:[x.size," agent",x.size>1?"s":""," selected"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(J,{size:"sm",variant:"outline",onClick:ss,disabled:w,children:[r.jsx(Zs,{className:"mr-2 h-4 w-4"}),w?"Sending...":"Resend Welcome Email"]}),r.jsx(J,{size:"sm",variant:"ghost",onClick:yo,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-[40px]",children:r.jsx(cc,{checked:ir.length>0&&x.size===ir.length,onCheckedChange:Tc,"aria-label":"Select all"})}),r.jsx(Et,{children:r.jsxs(J,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ei("name"),children:["Name (Last)",Ii("name")]})}),r.jsx(Et,{children:"Email"}),r.jsx(Et,{children:r.jsxs(J,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ei("status"),children:["Status",Ii("status")]})}),r.jsx(Et,{children:"Actions"})]})}),r.jsx(Hs,{children:ir.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):ir.map(_r=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsx(cc,{checked:x.has(_r.id),onCheckedChange:()=>xo(_r.id),"aria-label":`Select ${_r.name}`})}),r.jsx(vt,{className:"font-medium",children:_r.name}),r.jsx(vt,{children:_r.email}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[_r.claimed?r.jsx(Ft,{variant:"default",children:"Active"}):r.jsx(Ft,{variant:"secondary",children:"Pending"}),da(_r.id)&&r.jsxs(Ft,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(WT,{className:"mr-1 h-3 w-3"}),"Manager"]})]})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{pt(_r),nt(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(Nc,{className:"h-4 w-4"})}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>xs(_r),title:"Edit agent",children:r.jsx(ha,{className:"h-4 w-4"})}),!_r.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>zn(_r.id),title:"Resend welcome email",children:r.jsx(Zs,{className:"h-4 w-4"})}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>Ws(_r),title:"Claim account for agent",disabled:rr===_r.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(vj,{className:"h-4 w-4"})})]}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>tl(_r),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(Wf,{className:"h-4 w-4"})}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>js(_r.email,_r.name),title:"Send password reset email",children:r.jsx(mj,{className:"h-4 w-4"})}),da(_r.id)&&r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>La(_r.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(Gf,{className:"h-4 w-4"})}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>fr(_r),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},_r.id))})]})})]})]}),r.jsx(Br,{open:S,onOpenChange:C,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Add New Agent"}),r.jsx(es,{children:"Create a new agent account. They'll receive an email to set up their account."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",value:T.name,onChange:_r=>O({...T,name:_r.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"email",children:"Email"}),r.jsx(ct,{id:"email",type:"email",value:T.email,onChange:_r=>O({...T,email:_r.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(ct,{id:"phone",type:"tel",value:T.phone,onChange:_r=>O({...T,phone:_r.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"password",children:"Temporary Password"}),r.jsx(ct,{id:"password",type:"password",value:T.password,onChange:_r=>O({...T,password:_r.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(J,{onClick:Jr,disabled:A,children:A?"Creating...":"Create Agent"})]})]})}),r.jsx(Br,{open:z,onOpenChange:F,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Remove Agent"}),r.jsxs(es,{children:["Are you sure you want to remove ",r.jsx("strong",{children:q==null?void 0:q.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),r.jsx(J,{variant:"destructive",onClick:Zi,disabled:K,children:K?"Removing...":"Remove Agent"})]})]})}),r.jsx(xRe,{open:re,onOpenChange:ue,fixedBrokerageId:e,onSuccess:kn}),r.jsx(Br,{open:he,onOpenChange:be,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Add Brokerage Manager"}),r.jsx(es,{children:"Promote an existing active agent to brokerage manager. They will be able to manage agents and view analytics."})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(Ve,{children:"Select Agent"}),r.jsxs(_h,{open:Ee,onOpenChange:ke,children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",role:"combobox","aria-expanded":Ee,className:"w-full justify-between",children:[ne?((vo=n.find(_r=>_r.id===ne))==null?void 0:vo.name)+" ("+((Bd=n.find(_r=>_r.id===ne))==null?void 0:Bd.email)+")":"Select an agent to promote...",r.jsx(a1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ou,{className:"w-full p-0",align:"start",children:r.jsxs($1,{children:[r.jsx(U1,{placeholder:"Search by name or email..."}),r.jsxs(q1,{className:"max-h-[200px]",children:[r.jsx(V1,{children:"No eligible agents found."}),r.jsx(H1,{children:n.filter(_r=>!da(_r.id)).map(_r=>r.jsxs(W1,{value:`${_r.name} ${_r.email}`,onSelect:()=>{ye(_r.id),ke(!1)},children:[r.jsx(Ca,{className:`mr-2 h-4 w-4 ${ne===_r.id?"opacity-100":"opacity-0"}`}),_r.name," (",_r.email,")"]},_r.id))})]})]})})]}),n.filter(_r=>!da(_r.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>be(!1),children:"Cancel"}),r.jsx(J,{onClick:mi,disabled:ie||!ne,children:ie?"Adding...":"Add as Manager"})]})]})}),r.jsx(Br,{open:pe,onOpenChange:ae,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Agent"}),r.jsxs(es,{children:["Update profile information for ",ge==null?void 0:ge.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"edit-name",children:"Name"}),r.jsx(ct,{id:"edit-name",value:Ue.name,onChange:_r=>Ie({...Ue,name:_r.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"edit-email",children:"Email"}),r.jsx(ct,{id:"edit-email",type:"email",value:Ue.email,onChange:_r=>Ie({...Ue,email:_r.target.value}),placeholder:"agent@example.com"}),Ue.email.trim().toLowerCase()!==(ge==null?void 0:ge.email.toLowerCase())&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing email will update their login credentials"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(ct,{id:"edit-phone",type:"tel",value:Ue.phone,onChange:_r=>Ie({...Ue,phone:_r.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>ae(!1),children:"Cancel"}),r.jsx(J,{onClick:bi,disabled:Ke||Ce,children:Ce?"Updating email...":Ke?"Saving...":"Save Changes"})]})]})}),Ae&&r.jsx(yRe,{open:et,onOpenChange:_r=>{nt(_r),_r||pt(null)},userId:Ae.id,userName:Ae.name}),r.jsx(Br,{open:Be,onOpenChange:Qe,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Set Password"}),r.jsxs(es,{children:["Set a new password for ",tt==null?void 0:tt.name,". They will be able to log in with this password immediately."]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"new-password",children:"New Password"}),r.jsx(ct,{id:"new-password",type:"password",value:wt,onChange:_r=>Ct(_r.target.value),placeholder:"Enter new password (min 6 characters)"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Make sure to communicate this password to the agent through a secure channel."})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>Qe(!1),children:"Cancel"}),r.jsx(J,{onClick:rl,disabled:It||!wt||wt.length<6,children:It?"Setting...":"Set Password"})]})]})})]})},Fwt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},zwt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},Bwt=e=>{switch(e){case"academy_video":return r.jsx(Fi,{className:"h-4 w-4"});case"template":return r.jsx(Ai,{className:"h-4 w-4"});case"toolbox":return r.jsx(Ai,{className:"h-4 w-4"});case"newsletter":return r.jsx(Vx,{className:"h-4 w-4"});case"social_swag":return r.jsx(Ss,{className:"h-4 w-4"});case"event":return r.jsx(Ys,{className:"h-4 w-4"});default:return r.jsx(Ls,{className:"h-4 w-4"})}},$wt=({brokerageId:e})=>{const{toast:t}=pa(),[n,s]=P.useState([]),[i,o]=P.useState([]),[l,a]=P.useState([]),[h,p]=P.useState(!0),[x,y]=P.useState(null);P.useEffect(()=>{w()},[e]);const w=async()=>{try{p(!0);const{data:C,error:A}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",e);if(A)throw A;const E=C.map(ue=>ue.id),T=new Map(C.map(ue=>[ue.id,ue]));if(E.length===0){s([]),o([]),a([]);return}const{data:O,error:z}=await ee.from("activity_logs").select("*").in("user_id",E).order("launched_at",{ascending:!1});if(z)throw z;const F=O.map(ue=>{var he,be;return{id:ue.id,user_id:ue.user_id,app_name:ue.app_name,launched_at:ue.launched_at,user_name:((he=T.get(ue.user_id))==null?void 0:he.name)||"Unknown",user_email:((be=T.get(ue.user_id))==null?void 0:be.email)||"Unknown"}});s(F);const{data:q,error:H}=await ee.from("content_engagement_logs").select("*").in("user_id",E).order("created_at",{ascending:!1});if(H)throw H;const K=(q||[]).map(ue=>{var he,be;return{id:ue.id,user_id:ue.user_id,resource_type:ue.resource_type,resource_id:ue.resource_id,resource_title:ue.resource_title,action_type:ue.action_type,created_at:ue.created_at,user_name:((he=T.get(ue.user_id))==null?void 0:he.name)||"Unknown",user_email:((be=T.get(ue.user_id))==null?void 0:be.email)||"Unknown"}});o(K);const Z=new Map;C.forEach(ue=>{Z.set(ue.id,{user_id:ue.id,user_name:ue.name,user_email:ue.email,app_launches:0,content_views:0,last_activity:""})}),F.forEach(ue=>{const he=Z.get(ue.user_id);he&&(he.app_launches++,(!he.last_activity||new Date(ue.launched_at)>new Date(he.last_activity))&&(he.last_activity=ue.launched_at))}),K.forEach(ue=>{const he=Z.get(ue.user_id);he&&(he.content_views++,(!he.last_activity||new Date(ue.created_at)>new Date(he.last_activity))&&(he.last_activity=ue.created_at))});const re=Array.from(Z.values()).filter(ue=>ue.app_launches>0||ue.content_views>0).sort((ue,he)=>new Date(he.last_activity).getTime()-new Date(ue.last_activity).getTime());a(re)}catch(C){console.error("Error loading activity:",C),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{p(!1)}},j=C=>n.filter(A=>A.user_id===C),S=C=>i.filter(A=>A.user_id===C);return h?r.jsx(We,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Agent Activity"}),r.jsx(En,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Agent"}),r.jsx(Et,{className:"text-center",children:"App Launches"}),r.jsx(Et,{className:"text-center",children:"Content Views"}),r.jsx(Et,{children:"Last Active"})]})}),r.jsx(Hs,{children:l.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(C=>r.jsxs(Ir,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>y({id:C.user_id,name:C.user_name,email:C.user_email}),children:[r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:C.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:C.user_email})]})}),r.jsx(vt,{className:"text-center",children:r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(Sc,{className:"h-3 w-3"}),C.app_launches]})}),r.jsx(vt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Ai,{className:"h-3 w-3"}),C.content_views]})}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:C.last_activity&&tu(new Date(C.last_activity),{addSuffix:!0})})]},C.user_id))})]})})})]}),r.jsx(Br,{open:!!x,onOpenChange:C=>!C&&y(null),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(es,{children:x==null?void 0:x.email})]}),r.jsxs(ba,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsx(ln,{value:"content",children:"Content Engagement"}),r.jsx(ln,{value:"apps",children:"App Launches"})]}),r.jsx(An,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Resource"}),r.jsx(Et,{children:"Type"}),r.jsx(Et,{children:"Action"}),r.jsx(Et,{children:"Time"})]})}),r.jsx(Hs,{children:x&&S(x.id).length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&S(x.id).map(C=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"max-w-[200px] truncate font-medium",children:C.resource_title}),r.jsx(vt,{children:r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[Bwt(C.resource_type),Fwt[C.resource_type]||C.resource_type]})}),r.jsx(vt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:zwt[C.action_type]||C.action_type})}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:tu(new Date(C.created_at),{addSuffix:!0})})]},C.id))})]})})}),r.jsx(An,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"App"}),r.jsx(Et,{children:"Time"})]})}),r.jsx(Hs,{children:x&&j(x.id).length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&j(x.id).map(C=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsx(Ft,{variant:"outline",children:C.app_name})}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:tu(new Date(C.launched_at),{addSuffix:!0})})]},C.id))})]})})})]})]})})]})},Uwt=({brokerageId:e})=>{const{toast:t}=pa(),[n,s]=P.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[i,o]=P.useState(!0);P.useEffect(()=>{l()},[e]);const l=async()=>{try{o(!0);const{data:a,error:h}=await ee.from("profiles").select("id").eq("brokerage_id",e);if(h)throw h;const p=a.map(F=>F.id),x=p.length;if(p.length===0){o(!1);return}const{data:y,error:w}=await ee.from("profiles").select("id, email").in("id",p);if(w)throw w;const{count:j}=await ee.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",e).not("last_login","is",null),S=j||0,C=x-S,{count:A}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p),E=new Date;E.setDate(E.getDate()-7);const{count:T}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",E.toISOString()),O=new Date;O.setMonth(O.getMonth()-1);const{count:z}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",O.toISOString());s({totalAgents:x,activeAgents:S,pendingAgents:C,totalLaunches:A||0,launchesThisWeek:T||0,launchesThisMonth:z||0})}catch(a){console.error("Error loading analytics:",a),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return i?r.jsx(We,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalAgents}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.activeAgents," active, ",n.pendingAgents," pending"]})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.activeAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:n.totalAgents>0?`${Math.round(n.activeAgents/n.totalAgents*100)}% of total`:"0% of total"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ki,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.pendingAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(xg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(xg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(xg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]})},qwt=({brokerageId:e})=>{const[t,n]=P.useState([]),[s,i]=P.useState(!0),[o,l]=P.useState(!1),[a,h]=P.useState(!1),[p,x]=P.useState({description:"",maxUses:""});P.useEffect(()=>{y()},[e]);const y=async()=>{try{const{data:E,error:T}=await ee.from("invite_codes").select("*").eq("brokerage_id",e).order("created_at",{ascending:!1});if(T)throw T;n(E||[])}catch(E){console.error("Error loading invite codes:",E),ze.error("Failed to load invite links")}finally{i(!1)}},w=()=>Math.random().toString(36).substring(2,8).toUpperCase(),j=async()=>{l(!0);try{const E=w(),{error:T}=await ee.from("invite_codes").insert({code:E,description:p.description||null,max_uses:p.maxUses?parseInt(p.maxUses):null,brokerage_id:e,is_active:!0});if(T)throw T;ze.success("Invite link created!"),h(!1),x({description:"",maxUses:""}),y()}catch(E){console.error("Error creating invite code:",E),ze.error("Failed to create invite link")}finally{l(!1)}},S=async E=>{try{const{error:T}=await ee.from("invite_codes").delete().eq("id",E);if(T)throw T;ze.success("Invite link deleted"),n(t.filter(O=>O.id!==E))}catch(T){console.error("Error deleting invite code:",T),ze.error("Failed to delete invite link")}},C=async(E,T)=>{try{const{error:O}=await ee.from("invite_codes").update({is_active:!T}).eq("id",E);if(O)throw O;n(t.map(z=>z.id===E?{...z,is_active:!T}:z)),ze.success(`Invite link ${T?"deactivated":"activated"}`)}catch(O){console.error("Error toggling invite code:",O),ze.error("Failed to update invite link")}},A=E=>{const T=`${window.location.origin}/join?code=${E}`;navigator.clipboard.writeText(T),ze.success("Link copied to clipboard!")};return s?r.jsx(We,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(En,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Br,{open:a,onOpenChange:h,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{size:"sm",children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create Invite Link"}),r.jsx(es,{children:"Create a new invite link for agents to join your brokerage"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description (optional)"}),r.jsx(ct,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:p.description,onChange:E=>x({...p,description:E.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(ct,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:p.maxUses,onChange:E=>x({...p,maxUses:E.target.value})})]}),r.jsx(J,{onClick:j,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(Xe,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(So,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No invite links yet"}),r.jsx("p",{className:"text-sm",children:"Create one to start inviting agents"})]}):r.jsx("div",{className:"space-y-3",children:t.map(E=>r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-0.5 rounded",children:E.code}),r.jsx(Ft,{variant:E.is_active?"default":"secondary",children:E.is_active?"Active":"Inactive"})]}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:E.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[E.uses_count," uses",E.max_uses&&` / ${E.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>A(E.code),title:"Copy link",children:r.jsx(jl,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>C(E.id,E.is_active),title:E.is_active?"Deactivate":"Activate",children:E.is_active?"Disable":"Enable"}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>S(E.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Zn,{className:"h-4 w-4"})})]})]},E.id))})})]})},Vwt=({open:e,onOpenChange:t,referralCode:n,brokerageId:s,senderName:i,brokerageName:o,onInvitesSent:l})=>{const[a,h]=P.useState(""),[p,x]=P.useState([]),[y,w]=P.useState(""),[j,S]=P.useState(!1),C=z=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z),A=()=>{const z=a.trim().toLowerCase();if(z&&C(z)&&!p.includes(z)){if(p.length>=10){ze.error("Maximum 10 emails per invite");return}x([...p,z]),h("")}else z&&!C(z)?ze.error("Please enter a valid email address"):p.includes(z)&&ze.error("Email already added")},E=z=>{x(p.filter(F=>F!==z))},T=z=>{(z.key==="Enter"||z.key===",")&&(z.preventDefault(),A())},O=async()=>{if(p.length===0){ze.error("Please add at least one email address");return}S(!0);try{const{data:z,error:F}=await ee.functions.invoke("send-referral-invite",{body:{emails:p,personalMessage:y.trim()||void 0,referralCode:n,brokerageId:s,senderName:i,brokerageName:o}});if(F)throw F;z.successCount===z.totalCount?ze.success(`${z.successCount} invite${z.successCount>1?"s":""} sent successfully!`):ze.warning(`${z.successCount} of ${z.totalCount} invites sent. Some failed.`),x([]),w(""),t(!1),l==null||l()}catch(z){console.error("Error sending invites:",z),ze.error("Failed to send invites. Please try again.")}finally{S(!1)}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-[550px]",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Zs,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(es,{children:"Send a personalized email invitation to broker owners you know. They'll receive a beautiful email highlighting LevelUp's features."})]}),r.jsxs("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-lg p-4 flex items-center gap-3",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Va,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:"Earn $25/month for each referral!"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When they sign up and stay for 30 days, you save on your membership forever."})]})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:a,onChange:z=>h(z.target.value),onKeyDown:T,onBlur:A}),r.jsx(J,{type:"button",variant:"secondary",onClick:A,children:"Add"})]}),p.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:p.map(z=>r.jsxs(Ft,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[z,r.jsx("button",{type:"button",onClick:()=>E(z),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(Ts,{className:"h-3 w-3"})})]},z))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(ms,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:y,onChange:z=>w(z.target.value),rows:3,maxLength:500}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[y.length,"/500 characters"]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Ss,{className:"h-4 w-4 text-primary"}),"What they'll receive:"]}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Beautiful branded email from you"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Your personal message (if added)"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Key LevelUp features for brokerages"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Direct signup link with your referral code"]})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(J,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(J,{onClick:O,disabled:p.length===0||j,children:j?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent mr-2"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Send ",p.length>0&&`(${p.length})`," Invite",p.length!==1?"s":""]})})]})]})})},Hwt=({brokerageId:e,refreshTrigger:t})=>{const[n,s]=P.useState([]),[i,o]=P.useState(!0);P.useEffect(()=>{l()},[e,t]);const l=async()=>{try{const{data:h,error:p}=await ee.from("referral_invites").select("*").eq("referrer_brokerage_id",e).order("sent_at",{ascending:!1}).limit(20);if(p)throw p;s(h||[])}catch(h){console.error("Error fetching invites:",h)}finally{o(!1)}},a=h=>{switch(h){case"signed_up":return r.jsxs(Ft,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(qa,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Ft,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(zc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),"Pending"]})}};return i?r.jsx("div",{className:"flex justify-center py-4",children:r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):n.length===0?r.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[r.jsx(Zs,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No invites sent yet"}),r.jsx("p",{className:"text-xs",children:"Start inviting broker friends to earn rewards!"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Recent Invites"}),n.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:h.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",fn(new Date(h.sent_at),"MMM d, yyyy")]})]}),a(h.status)]},h.id))]})},Wwt=()=>{const{brokerageId:e,user:t}=zr(),[n,s]=P.useState(null),[i,o]=P.useState(""),[l,a]=P.useState(""),[h,p]=P.useState([]),[x,y]=P.useState(!0),[w,j]=P.useState(!1),[S,C]=P.useState(0);P.useEffect(()=>{e&&A()},[e]);const A=async()=>{try{const[q,H]=await Promise.all([ee.from("brokerages").select("name").eq("id",e).single(),t?ee.from("profiles").select("name").eq("id",t.id).single():Promise.resolve({data:null})]);q.data&&o(q.data.name),H.data&&a(H.data.name||"A LevelUp Member");const{data:K}=await ee.from("referral_codes").select("code").eq("brokerage_id",e).single();if(K)s(K.code);else{const re=`REF${e==null?void 0:e.slice(0,8).toUpperCase()}`;await ee.from("referral_codes").insert({brokerage_id:e,code:re}),s(re)}const{data:Z}=await ee.from("referrals").select(` *, referred_user:profiles!referred_user_id(name, email), referred_brokerage:brokerages!referred_brokerage_id(name) `).eq("referrer_brokerage_id",e).order("created_at",{ascending:!1});p(Z||[])}catch(q){console.error("Error fetching referral data:",q)}finally{y(!1)}},E=()=>{const q=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(q),ze.success("Referral link copied to clipboard!")},T=h.filter(q=>q.status==="qualified").length,O=h.filter(q=>q.status==="pending").length,z=T*25,F=Math.max(0,Math.ceil((299-z)/25));return x?null:r.jsxs(r.Fragment,{children:[r.jsxs(We,{className:"overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-b",children:r.jsxs("div",{className:"px-6 py-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Va,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-bold",children:"Referral Rewards Program"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Earn $25/month off your membership for every broker you refer"})]})]}),r.jsx("div",{className:"mt-4 bg-background/80 rounded-lg p-4 border",children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"text-3xl font-bold text-primary",children:["$",z]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),z>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(qa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),F>0&&z<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",F," more = ",r.jsx("span",{className:"text-primary",children:"FREE membership!"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your membership could cost $0/month"})]}),z>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Ss,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(Xe,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(J,{onClick:()=>j(!0),className:"w-full",size:"lg",children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(J,{onClick:E,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(jl,{className:"h-4 w-4 mr-2"}),"Copy Referral Link"]})]}),r.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Your Referral Link"}),r.jsxs("code",{className:"block px-3 py-2 bg-background rounded border text-sm break-all",children:["https://dashboard.relevelup.com/?ref=",n]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"text-center p-4 bg-green-50 dark:bg-green-950/20 rounded-lg border border-green-200 dark:border-green-900",children:[r.jsx(ud,{className:"h-5 w-5 mx-auto text-green-600 mb-1"}),r.jsxs("p",{className:"text-2xl font-bold text-green-700 dark:text-green-400",children:["$",z]}),r.jsx("p",{className:"text-xs text-green-600 dark:text-green-500",children:"Monthly Savings"})]}),r.jsxs("div",{className:"text-center p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsx(Kn,{className:"h-5 w-5 mx-auto text-primary mb-1"}),r.jsx("p",{className:"text-2xl font-bold",children:T}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified Referrals"})]}),r.jsxs("div",{className:"text-center p-4 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-900",children:[r.jsx(Ki,{className:"h-5 w-5 mx-auto text-amber-600 mb-1"}),r.jsx("p",{className:"text-2xl font-bold text-amber-700 dark:text-amber-400",children:O}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:"Pending (30 days)"})]})]}),r.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[r.jsx("h4",{className:"font-semibold text-sm mb-3",children:"How It Works"}),r.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"1"}),r.jsx("p",{children:"Share your referral link or send an invite email to broker friends"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"2"}),r.jsx("p",{children:"They sign up and subscribe to LevelUp"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"3"}),r.jsx("p",{children:"After 30 days, you get $25/month off your membership - forever!"})]})]})]}),r.jsx(Hwt,{brokerageId:e,refreshTrigger:S}),h.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),h.slice(0,5).map(q=>{var H,K;return r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsx("span",{className:"text-sm truncate",children:((H=q.referred_brokerage)==null?void 0:H.name)||((K=q.referred_user)==null?void 0:K.email)||"Pending setup"}),r.jsxs(Ft,{variant:q.status==="qualified"?"default":q.status==="pending"?"secondary":"destructive",className:q.status==="qualified"?"bg-green-600":"",children:[q.status==="qualified"&&r.jsx(qa,{className:"h-3 w-3 mr-1"}),q.status]})]},q.id)})]})]})]}),r.jsx(Vwt,{open:w,onOpenChange:j,referralCode:n||"",brokerageId:e||"",senderName:l||"A LevelUp Member",brokerageName:i,onInvitesSent:()=>C(q=>q+1)})]})},Gwt=()=>{const{user:e,isBrokerageManager:t,brokerageId:n,isAdmin:s,managedBrokerages:i,selectedBrokerageId:o,setSelectedBrokerageId:l}=zr(),a=ns(),{toast:h}=pa(),[p,x]=P.useState(""),[y,w]=P.useState(!0),j=o||(i.length>0?i[0].id:n);P.useEffect(()=>{if(!e||!t&&!s){a("/dashboard");return}!o&&i.length>0&&l(i[0].id),j?S():i.length===0&&!n&&w(!1)},[e,t,s,j,a,i,o]);const S=async()=>{if(!j){w(!1);return}try{const{data:C,error:A}=await ee.from("brokerages").select("name").eq("id",j).single();if(A)throw A;x(C.name)}catch(C){console.error("Error loading brokerage info:",C),h({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{w(!1)}};return y?r.jsx(Or,{title:"Manage Brokerages",description:"Loading brokerage information...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):j?r.jsx(Or,{title:p||"Manage Brokerages",description:"Brokerage Management Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[i.length>1&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Managing:"}),r.jsxs(bn,{value:o||"",onValueChange:l,children:[r.jsxs(vn,{className:"w-[280px]",children:[r.jsx(na,{className:"mr-2 h-4 w-4"}),r.jsx(wn,{placeholder:"Select brokerage"})]}),r.jsx(_n,{children:i.map(C=>r.jsx(Kt,{value:C.id,children:C.name},C.id))})]})]}),r.jsxs(ba,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(fa,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(ln,{value:"agents",children:"Agents"}),r.jsx(ln,{value:"invite",children:"Invite Links"}),r.jsx(ln,{value:"referrals",children:"Referrals"}),r.jsx(ln,{value:"leaderboard",children:"Leaderboard"}),r.jsx(ln,{value:"activity",children:"Activity"}),r.jsx(ln,{value:"analytics",children:"Analytics"}),r.jsx(ln,{value:"shares",children:"Shares"})]}),r.jsx(An,{value:"agents",className:"space-y-4",children:r.jsx(Rwt,{brokerageId:j})}),r.jsx(An,{value:"invite",className:"space-y-4",children:r.jsx(qwt,{brokerageId:j})}),r.jsx(An,{value:"referrals",className:"space-y-4",children:r.jsx(Wwt,{})}),r.jsx(An,{value:"leaderboard",className:"space-y-4",children:r.jsx(xDe,{brokerageId:j,title:`${p} Event Leaderboard`,showUserStats:!1})}),r.jsx(An,{value:"activity",className:"space-y-4",children:r.jsx($wt,{brokerageId:j})}),r.jsx(An,{value:"analytics",className:"space-y-4",children:r.jsx(Uwt,{brokerageId:j})}),r.jsx(An,{value:"shares",className:"space-y-4",children:r.jsx(Sze,{brokerageOnly:!0,brokerageId:j})})]})]})}):r.jsx(Or,{title:"Manage Brokerages",description:"Brokerage Management",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(na,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You don't have any brokerages to manage."})]})})};function Kwt({brokerageId:e,canManage:t}){const{user:n}=zr(),[s,i]=P.useState([]),[o,l]=P.useState(!0),[a,h]=P.useState(!1),[p,x]=P.useState(null),[y,w]=P.useState(null),[j,S]=P.useState(!1),[C,A]=P.useState(""),[E,T]=P.useState(""),[O,z]=P.useState(!1),F=async()=>{try{const{data:re,error:ue}=await ee.from("brokerage_announcements").select("*").eq("brokerage_id",e).order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(ue)throw ue;const he=re;if(he&&he.length>0){const be=[...new Set(he.map(fe=>fe.created_by))],{data:ne}=await ee.from("profiles").select("id, name, avatar_url").in("id",be),ye=new Map((ne==null?void 0:ne.map(fe=>[fe.id,fe]))||[]),ie=he.map(fe=>({...fe,author:ye.get(fe.created_by)||{name:"Unknown",avatar_url:null}}));i(ie)}else i([])}catch(re){console.error("Error fetching announcements:",re)}finally{l(!1)}};P.useEffect(()=>{F()},[e]);const q=()=>{A(""),T(""),z(!1),x(null)},H=re=>{re?(x(re),A(re.title),T(re.content),z(re.is_pinned)):q(),h(!0)},K=async()=>{if(!C.trim()||!E.trim()){ze.error("Please fill in all fields");return}S(!0);try{if(p){const{error:re}=await ee.from("brokerage_announcements").update({title:C.trim(),content:E.trim(),is_pinned:O,pinned_at:O?new Date().toISOString():null}).eq("id",p.id);if(re)throw re;ze.success("Announcement updated")}else{const{error:re}=await ee.from("brokerage_announcements").insert({brokerage_id:e,created_by:n==null?void 0:n.id,title:C.trim(),content:E.trim(),is_pinned:O,pinned_at:O?new Date().toISOString():null});if(re)throw re;ze.success("Announcement created")}h(!1),q(),F()}catch(re){console.error("Error saving announcement:",re),ze.error("Failed to save announcement")}finally{S(!1)}},Z=async()=>{if(y)try{const{error:re}=await ee.from("brokerage_announcements").delete().eq("id",y);if(re)throw re;ze.success("Announcement deleted"),F()}catch(re){console.error("Error deleting announcement:",re),ze.error("Failed to delete announcement")}finally{w(null)}};return o?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(mm,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(mm,{className:"h-5 w-5 text-primary"}),"Announcements"]}),t&&r.jsxs(J,{size:"sm",onClick:()=>H(),className:"gap-1",children:[r.jsx(jn,{className:"h-4 w-4"}),"New"]})]}),r.jsx(Xe,{children:s.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No announcements yet"}):r.jsx("div",{className:"space-y-4",children:s.map(re=>{var ue,he,be,ne;return r.jsx("div",{className:`p-4 rounded-lg border ${re.is_pinned?"bg-primary/5 border-primary/20":"bg-muted/30"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[re.is_pinned&&r.jsx(x1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:re.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:re.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(ci,{className:"h-5 w-5",children:[r.jsx(Wa,{src:((ue=re.author)==null?void 0:ue.avatar_url)||void 0}),r.jsx(di,{className:"text-[10px]",children:((be=(he=re.author)==null?void 0:he.name)==null?void 0:be.charAt(0))||"?"})]}),r.jsx("span",{children:(ne=re.author)==null?void 0:ne.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:fn(new Date(re.created_at),"MMM d, yyyy")})]})]}),t&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>H(re),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>w(re.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})},re.id)})})})]}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:p?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title"}),r.jsx(ct,{id:"title",value:C,onChange:re=>A(re.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"content",children:"Content"}),r.jsx(ms,{id:"content",value:E,onChange:re=>T(re.target.value),placeholder:"Write your announcement...",rows:4})]}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"pinned",checked:O,onCheckedChange:z}),r.jsxs(Ve,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(x1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(J,{onClick:K,disabled:j,children:j?"Saving...":p?"Update":"Create"})]})]})]})}),r.jsx(uh,{open:!!y,onOpenChange:()=>w(null),children:r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Delete Announcement"}),r.jsx(Su,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Zwt({brokerageId:e}){const[t,n]=P.useState([]),[s,i]=P.useState(!0),[o,l]=P.useState("");P.useEffect(()=>{(async()=>{try{const{data:p,error:x}=await ee.from("profiles").select("id, name, email, phone, avatar_url, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("brokerage_id",e).order("name");if(x)throw x;n(p||[])}catch(p){console.error("Error fetching agents:",p)}finally{i(!1)}})()},[e]);const a=t.filter(h=>{var p,x;return h.name.toLowerCase().includes(o.toLowerCase())||h.email.toLowerCase().includes(o.toLowerCase())||((p=h.title)==null?void 0:p.toLowerCase().includes(o.toLowerCase()))||((x=h.areas_served)==null?void 0:x.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(h=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},h))})})]}):r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5 text-primary"}),"Agent Roster",r.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",t.length,")"]})]}),r.jsxs("div",{className:"relative w-full sm:w-64",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search agents...",value:o,onChange:h=>l(h.target.value),className:"pl-9"})]})]}),r.jsx(Xe,{children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:o?"No agents match your search":"No agents in this brokerage yet"}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(h=>r.jsx(Ywt,{agent:h},h.id))})})]})}function Ywt({agent:e}){const t=e.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return r.jsxs("div",{className:"group relative bg-card border rounded-xl p-4 hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"flex flex-col items-center text-center mb-3",children:[r.jsxs(ci,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Wa,{src:e.avatar_url||void 0,alt:e.name}),r.jsx(di,{className:"text-lg bg-primary/10 text-primary",children:t})]}),r.jsx("h3",{className:"font-semibold text-sm leading-tight",children:e.name}),e.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.title})]}),e.bio&&r.jsx("p",{className:"text-xs text-muted-foreground text-center line-clamp-2 mb-3",children:e.bio}),r.jsxs("div",{className:"space-y-1.5 mb-3",children:[e.areas_served&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(pl,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:e.areas_served})]}),e.years_experience&&r.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[e.years_experience," ",e.years_experience===1?"year":"years"," experience"]})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.phone&&r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`tel:${e.phone}`,title:`Call ${e.name}`,children:r.jsx(ca,{className:"h-4 w-4"})})}),r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`mailto:${e.email}`,title:`Email ${e.name}`,children:r.jsx(Zs,{className:"h-4 w-4"})})}),e.linkedin_url&&r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:e.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:r.jsx(pm,{className:"h-4 w-4"})})}),e.instagram_url&&r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:e.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:r.jsx(eu,{className:"h-4 w-4"})})})]})]})}function Xwt({brokerageId:e}){const[t,n]=P.useState([]),[s,i]=P.useState(!0);if(P.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await ee.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(p)throw p;if(!h||h.length===0){n([]),i(!1);return}const x=h.map(C=>C.id),{data:y,error:w}=await ee.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(w)throw w;const j=new Map(h.map(C=>[C.id,C])),S=(y||[]).filter(C=>C.total_points>0).map(C=>{const A=j.get(C.user_id);return{user_id:C.user_id,total_points:C.total_points,name:(A==null?void 0:A.name)||"Unknown",avatar_url:(A==null?void 0:A.avatar_url)||null}});n(S)}catch(h){console.error("Error fetching leaderboard:",h)}finally{i(!1)}})()},[e]),s)return r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(a=>r.jsx("div",{className:"h-12 bg-muted rounded"},a))})})]});const o=a=>a===1?"text-yellow-500":a===2?"text-gray-400":a===3?"text-amber-600":"text-muted-foreground",l=a=>a<=3?r.jsx(qx,{className:$t("h-5 w-5",o(a))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:a});return r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(Xe,{children:t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No points earned yet. Attend events to earn points!"}):r.jsx("div",{className:"space-y-2",children:t.slice(0,10).map((a,h)=>{const p=a.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),x=h+1;return r.jsxs("div",{className:$t("flex items-center gap-3 p-2 rounded-lg",x<=3&&"bg-muted/50"),children:[r.jsx("div",{className:"w-6 flex justify-center",children:l(x)}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Wa,{src:a.avatar_url||void 0}),r.jsx(di,{className:"text-xs",children:p})]}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:a.name}),r.jsxs("span",{className:"text-sm font-semibold text-primary",children:[a.total_points.toLocaleString()," pts"]})]},a.user_id)})})})]})}function Qwt({brokerageId:e}){const t=ns(),[n,s]=P.useState([]),[i,o]=P.useState(!0);P.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await ee.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(p)throw p;if(!h||h.length===0){s([]),o(!1);return}const x=h.map(C=>C.id),y=new Map(h.map(C=>[C.id,C])),{data:w,error:j}=await ee.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",x).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(j)throw j;const S=(w||[]).map(C=>({id:C.id,slug:C.slug,property_address:C.property_address,city:C.city,price:C.price,property_type:C.property_type,agent_id:C.agent_id,agent:y.get(C.agent_id)||null,photos:C.listing_photos||[]}));s(S)}catch(h){console.error("Error fetching listings:",h)}finally{o(!1)}})()},[e]);const l=a=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(a);return i?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(a=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},a))})})]}):r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:()=>t("/mission-control/listings"),className:"gap-1",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(Xe,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(fi,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No active listings from your brokerage yet"}),r.jsxs(J,{size:"sm",onClick:()=>t("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Your First Listing"]})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(a=>r.jsxs("div",{onClick:()=>window.open(`https://listings.relevelup.com/${a.slug||a.id}`,"_blank"),className:"group cursor-pointer border rounded-lg overflow-hidden hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"relative h-24 bg-muted",children:[a.photos&&a.photos.length>0?r.jsx("img",{src:a.photos[0].photo_url,alt:a.property_address||"Listing",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(fi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsx("span",{className:"text-[10px] font-medium bg-primary text-primary-foreground px-1.5 py-0.5 rounded uppercase",children:a.property_type.replace("_"," ")})})]}),r.jsxs("div",{className:"p-2.5",children:[r.jsx("p",{className:"font-semibold text-sm text-primary",children:l(a.price)}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:a.property_address||"Address not available"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.city}),a.agent&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",a.agent.name]})]})]},a.id))}),n.length>0&&r.jsxs(J,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>t("/mission-control/listings"),children:["View All Listings",r.jsx(Ls,{className:"h-3 w-3 ml-1"})]})]})]})}function Jwt(){const{user:e,isAdmin:t,isBrokerageManager:n}=zr(),s=ns(),[i,o]=P.useState(!0),[l,a]=P.useState(null),[h,p]=P.useState(""),[x,y]=P.useState(0),[w,j]=P.useState(!1),[S,C]=P.useState(!1);return P.useEffect(()=>{(async()=>{if(e)try{const{data:E}=await ee.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle();if(!(E!=null&&E.brokerage_id)){o(!1);return}a(E.brokerage_id);const{data:T}=await ee.from("brokerages").select("name").eq("id",E.brokerage_id).maybeSingle();T&&p(T.name);const{count:O}=await ee.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",E.brokerage_id);if(y(O||0),t)j(!0),C(!0);else if(n){const{data:z}=await ee.from("brokerage_manager_assignments").select("id").eq("user_id",e.id).eq("brokerage_id",E.brokerage_id).maybeSingle();j(!!z),C(!!z)}}catch(E){console.error("Error fetching brokerage info:",E)}finally{o(!1)}})()},[e,t,n]),i?r.jsx(Or,{title:"My Brokerage",description:"Loading...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):l?r.jsx(Or,{title:h||"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-4 py-2",children:[r.jsx(Kn,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),S&&r.jsxs(J,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(fi,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(Kwt,{brokerageId:l,canManage:w}),r.jsx(Zwt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(Xwt,{brokerageId:l}),r.jsx(Qwt,{brokerageId:l})]})]})}):r.jsx(Or,{title:"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(na,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You're not currently part of a brokerage team."})]})})}function ejt(){const e=ns(),[t,n]=P.useState(""),[s,i]=P.useState("grid"),{data:o,isLoading:l}=Jt({queryKey:["newsletters"],queryFn:async()=>{const{data:j,error:S}=await ee.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(S)throw S;return j}}),{data:a}=Jt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:j}=await ee.from("newsletter_likes").select("newsletter_id");return j||[]}}),{data:h}=Jt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:j}=await ee.from("newsletter_comments").select("newsletter_id");return j||[]}}),p=j=>(a==null?void 0:a.filter(S=>S.newsletter_id===j).length)||0,x=j=>(h==null?void 0:h.filter(S=>S.newsletter_id===j).length)||0,y=o==null?void 0:o.filter(j=>{var S;return j.title.toLowerCase().includes(t.toLowerCase())||((S=j.description)==null?void 0:S.toLowerCase().includes(t.toLowerCase()))}),w=j=>{e(`/newsletters/${j}`)};return r.jsx(Or,{title:"Newsletter Content",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Newsletter Content"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Monthly newsletter templates and resources"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search newsletters...",value:t,onChange:j=>n(j.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(J,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(fm,{className:"h-4 w-4"})}),r.jsx(J,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx(Hf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(y==null?void 0:y.length)||0," item",(y==null?void 0:y.length)!==1?"s":""," found"]}),l&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((j,S)=>r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"})]})},S))}),!l&&(y==null?void 0:y.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ai,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No newsletters match your search":"No newsletters available yet"}),t&&r.jsx(J,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&y&&y.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:y.map(j=>r.jsxs(We,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>w(j.id),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:j.preview_image_url?r.jsx("img",{src:j.preview_image_url,alt:j.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Ai,{className:"h-16 w-16"})})}),r.jsxs(Xe,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:j.title}),j.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:j.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Od,{className:"h-3.5 w-3.5"}),p(j.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zl,{className:"h-3.5 w-3.5"}),x(j.id)]})]}),r.jsxs(J,{size:"sm",className:"w-full gap-2",onClick:S=>{S.stopPropagation(),w(j.id)},children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Details"]})]})]},j.id))})]})})}function tjt(){const{id:e}=Wc(),t=ns(),{user:n}=zr(),{toast:s}=pa(),i=Wr(),{trackEngagement:o}=SI(),[l,a]=P.useState(""),{data:h,isLoading:p}=Jt({queryKey:["newsletter",e],queryFn:async()=>{const{data:F,error:q}=await ee.from("newsletter_content").select("*").eq("id",e).single();if(q)throw q;return F},enabled:!!e});P.useEffect(()=>{h&&o("newsletter",h.id,h.title,"view")},[h==null?void 0:h.id]);const{data:x}=Jt({queryKey:["newsletter-drives",e],queryFn:async()=>{const{data:F}=await ee.from("newsletter_drive_links").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:y}=Jt({queryKey:["newsletter-pdfs",e],queryFn:async()=>{const{data:F}=await ee.from("newsletter_pdfs").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:w}=Jt({queryKey:["newsletter-videos",e],queryFn:async()=>{const{data:F}=await ee.from("newsletter_videos").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:j}=Jt({queryKey:["newsletter-canva-links",e],queryFn:async()=>{const{data:F}=await ee.from("newsletter_canva_links").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:S}=Jt({queryKey:["newsletter-likes",e],queryFn:async()=>{const{data:F}=await ee.from("newsletter_likes").select("*").eq("newsletter_id",e);return F||[]},enabled:!!e}),{data:C}=Jt({queryKey:["newsletter-comments",e],queryFn:async()=>{const{data:F}=await ee.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",e).order("created_at",{ascending:!1});return F||[]},enabled:!!e}),A=S==null?void 0:S.some(F=>F.user_id===(n==null?void 0:n.id)),E=cr({mutationFn:async()=>{A?await ee.from("newsletter_likes").delete().eq("newsletter_id",e).eq("user_id",n==null?void 0:n.id):await ee.from("newsletter_likes").insert({newsletter_id:e,user_id:n==null?void 0:n.id})},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-likes",e]})}}),T=cr({mutationFn:async F=>{const{error:q}=await ee.from("newsletter_comments").insert({newsletter_id:e,user_id:n==null?void 0:n.id,content:F});if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",e]}),a(""),s({title:"Comment added"})}}),O=cr({mutationFn:async F=>{const{error:q}=await ee.from("newsletter_comments").delete().eq("id",F);if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",e]}),s({title:"Comment deleted"})}}),z=F=>{if(F.includes("player.mediadelivery.net")||F.includes("iframe.mediadelivery.net")){const q=F.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${q[1]}/${q[2]}?autoplay=false`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})}if(F.includes("youtube.com")||F.includes("youtu.be")){const q=F.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${q[1]}`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}return r.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(Sc,{className:"h-4 w-4"})," Watch Video"]})};return p?r.jsx(Or,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-32"}),r.jsx(Pr,{className:"h-64 w-full"}),r.jsx(Pr,{className:"h-32 w-full"})]})}):h?r.jsx(Or,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(J,{variant:"ghost",onClick:()=>t("/newsletters"),className:"mb-4",children:[r.jsx(Qa,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),h.preview_image_url&&r.jsx("img",{src:h.preview_image_url,alt:h.title,className:"w-full h-64 md:h-80 object-cover rounded-lg"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:h.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:fn(new Date(h.publish_date),"MMMM d, yyyy")})]}),h.description&&r.jsx("div",{className:"text-lg text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:h.description}}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(f3,{resourceType:"newsletter",resourceId:h.id,resourceTitle:h.title}),r.jsxs(J,{variant:A?"default":"outline",size:"sm",onClick:()=>E.mutate(),children:[r.jsx(oa,{className:`h-4 w-4 mr-1 ${A?"fill-current":""}`}),(S==null?void 0:S.length)||0," ",(S==null?void 0:S.length)===1?"Like":"Likes"]})]}),j&&j.length>0&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(Xe,{className:"space-y-2",children:j.map(F=>r.jsxs("a",{href:F.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Ld,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:F.title}),r.jsx(Ls,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},F.id))})]}),x&&x.length>0&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(Xe,{className:"space-y-2",children:x.map(F=>r.jsxs("a",{href:F.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Ls,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:F.title})]},F.id))})]}),y&&y.length>0&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(Xe,{className:"space-y-2",children:y.map(F=>r.jsxs("a",{href:F.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Ai,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:F.name}),r.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"})]},F.id))})]}),w&&w.length>0&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Videos"})}),r.jsx(Xe,{className:"space-y-6",children:w.map(F=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:F.title}),z(F.video_url)]},F.id))})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg",children:["Comments (",(C==null?void 0:C.length)||0,")"]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ms,{placeholder:"Write a comment...",value:l,onChange:F=>a(F.target.value),className:"flex-1"}),r.jsx(J,{onClick:()=>l.trim()&&T.mutate(l),disabled:!l.trim()||T.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:C==null?void 0:C.map(F=>{var q,H,K;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{children:((H=(q=F.profiles)==null?void 0:q.name)==null?void 0:H[0])||"U"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-sm",children:((K=F.profiles)==null?void 0:K.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:fn(new Date(F.created_at),"MMM d, yyyy")}),F.user_id===(n==null?void 0:n.id)&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>O.mutate(F.id),children:r.jsx(Zn,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.content})]})]},F.id)})})]})]})]})}):r.jsx(Or,{title:"Not Found",description:"",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Newsletter not found"}),r.jsx(J,{variant:"link",onClick:()=>t("/newsletters"),children:"Back to Newsletters"})]})})}function rjt(){const{toast:e}=pa(),t=Wr(),[n,s]=P.useState(!1),[i,o]=P.useState(null),[l,a]=P.useState({title:"",description:"",publish_date:fn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[h,p]=P.useState(null),[x,y]=P.useState(null),[w,j]=P.useState([]),[S,C]=P.useState([]),[A,E]=P.useState([]),[T,O]=P.useState([]),[z,F]=P.useState([]),[q,H]=P.useState(!1),{data:K,isLoading:Z}=Jt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:pe,error:ae}=await ee.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(ae)throw ae;return pe}}),re=cr({mutationFn:async pe=>{const{data:ae,error:ge}=await ee.from("newsletter_content").insert({title:pe.title,description:pe.description||null,preview_image_url:pe.preview_image_url,publish_date:pe.publish_date,is_published:pe.is_published}).select().single();if(ge)throw ge;return ae},onSuccess:async pe=>{await be(pe.id),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter created successfully"}),ye()},onError:pe=>{e({title:"Error creating newsletter",description:pe.message,variant:"destructive"})}}),ue=cr({mutationFn:async pe=>{const{error:ae}=await ee.from("newsletter_content").update({title:pe.title,description:pe.description||null,preview_image_url:pe.preview_image_url,publish_date:pe.publish_date,is_published:pe.is_published}).eq("id",pe.id);if(ae)throw ae;return pe.id},onSuccess:async pe=>{await be(pe),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter updated successfully"}),ye()},onError:pe=>{e({title:"Error updating newsletter",description:pe.message,variant:"destructive"})}}),he=cr({mutationFn:async pe=>{const{error:ae}=await ee.from("newsletter_content").delete().eq("id",pe);if(ae)throw ae},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter deleted successfully"})},onError:pe=>{e({title:"Error deleting newsletter",description:pe.message,variant:"destructive"})}}),be=async pe=>{await ee.from("newsletter_drive_links").delete().eq("newsletter_id",pe),await ee.from("newsletter_pdfs").delete().eq("newsletter_id",pe),await ee.from("newsletter_videos").delete().eq("newsletter_id",pe),await ee.from("newsletter_canva_links").delete().eq("newsletter_id",pe);for(const ae of z){const ge=`${pe}/${Date.now()}-${ae.file.name}`,{error:Me}=await ee.storage.from("newsletter-content").upload(ge,ae.file);if(!Me){const{data:Ue}=ee.storage.from("newsletter-content").getPublicUrl(ge);S.push({name:ae.name,file_url:Ue.publicUrl,file_size:ae.file.size,sort_order:S.length})}}w.length>0&&await ee.from("newsletter_drive_links").insert(w.map((ae,ge)=>({newsletter_id:pe,title:ae.title,drive_url:ae.drive_url,sort_order:ge}))),S.length>0&&await ee.from("newsletter_pdfs").insert(S.map((ae,ge)=>({newsletter_id:pe,name:ae.name,file_url:ae.file_url,file_size:ae.file_size||null,sort_order:ge}))),A.length>0&&await ee.from("newsletter_videos").insert(A.map((ae,ge)=>({newsletter_id:pe,title:ae.title,video_url:ae.video_url,sort_order:ge}))),T.length>0&&await ee.from("newsletter_canva_links").insert(T.map((ae,ge)=>({newsletter_id:pe,title:ae.title,canva_share_link:ae.canva_share_link,sort_order:ge})))},ne=async pe=>{o(pe),a({title:pe.title,description:pe.description||"",publish_date:fn(new Date(pe.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:pe.is_published}),y(pe.preview_image_url);const[ae,ge,Me,Ue]=await Promise.all([ee.from("newsletter_drive_links").select("*").eq("newsletter_id",pe.id).order("sort_order"),ee.from("newsletter_pdfs").select("*").eq("newsletter_id",pe.id).order("sort_order"),ee.from("newsletter_videos").select("*").eq("newsletter_id",pe.id).order("sort_order"),ee.from("newsletter_canva_links").select("*").eq("newsletter_id",pe.id).order("sort_order")]);j(ae.data||[]),C(ge.data||[]),E(Me.data||[]),O(Ue.data||[]),F([]),s(!0)},ye=()=>{s(!1),o(null),a({title:"",description:"",publish_date:fn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),p(null),y(null),j([]),C([]),E([]),O([]),F([])},ie=async pe=>{var ge;const ae=(ge=pe.target.files)==null?void 0:ge[0];ae&&(p(ae),y(URL.createObjectURL(ae)))},fe=async()=>{if(!l.title){e({title:"Title is required",variant:"destructive"});return}H(!0);let pe=x;if(h){const ae=`previews/${Date.now()}-${h.name}`,{error:ge}=await ee.storage.from("newsletter-content").upload(ae,h);if(!ge){const{data:Me}=ee.storage.from("newsletter-content").getPublicUrl(ae);pe=Me.publicUrl}}i?ue.mutate({id:i.id,...l,preview_image_url:pe}):re.mutate({...l,preview_image_url:pe}),H(!1)},de=()=>{j([...w,{title:"",drive_url:"",sort_order:w.length}])},_e=()=>{E([...A,{title:"",video_url:"",sort_order:A.length}])},Ee=()=>{O([...T,{title:"",canva_share_link:"",sort_order:T.length}])},ke=pe=>{const ae=pe.target.files;if(!ae)return;const ge=Array.from(ae).map(Me=>({file:Me,name:Me.name.replace(/\.[^/.]+$/,"")}));F([...z,...ge])};return r.jsx(Or,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources"}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Newsletters"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(K==null?void 0:K.length)||0})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(K==null?void 0:K.filter(pe=>pe.is_published).length)||0})})]})]}),r.jsxs(Br,{open:n,onOpenChange:pe=>!pe&&ye(),children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:i?"Edit Newsletter":"Add Newsletter"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Title *"}),r.jsx(ct,{value:l.title,onChange:pe=>a({...l,title:pe.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Publish Date"}),r.jsx(ct,{type:"datetime-local",value:l.publish_date,onChange:pe=>a({...l,publish_date:pe.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:l.description,onChange:pe=>a({...l,description:pe}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[x&&r.jsx("img",{src:x,alt:"Preview",className:"h-20 w-32 object-cover rounded-md"}),r.jsxs("div",{children:[r.jsx(ct,{type:"file",accept:"image/*",onChange:ie,className:"hidden",id:"preview-upload"}),r.jsx(J,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(go,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{checked:l.is_published,onCheckedChange:pe=>a({...l,is_published:pe})}),r.jsx(Ve,{children:"Published"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:de,children:[r.jsx(jn,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),w.map((pe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ct,{placeholder:"Link title",value:pe.title,onChange:ge=>{const Me=[...w];Me[ae].title=ge.target.value,j(Me)},className:"w-1/3"}),r.jsx(ct,{placeholder:"Google Drive URL",value:pe.drive_url,onChange:ge=>{const Me=[...w];Me[ae].drive_url=ge.target.value,j(Me)},className:"flex-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>j(w.filter((ge,Me)=>Me!==ae)),children:r.jsx(Ts,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(ct,{type:"file",accept:".pdf",multiple:!0,onChange:ke,className:"hidden",id:"pdf-upload"}),r.jsx(J,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(go,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),S.map((pe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:pe.name}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>C(S.filter((ge,Me)=>Me!==ae)),children:r.jsx(Ts,{className:"h-4 w-4"})})]},`existing-${ae}`)),z.map((pe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ct,{value:pe.name,onChange:ge=>{const Me=[...z];Me[ae].name=ge.target.value,F(Me)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>F(z.filter((ge,Me)=>Me!==ae)),children:r.jsx(Ts,{className:"h-4 w-4"})})]},`pending-${ae}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:_e,children:[r.jsx(jn,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),A.map((pe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ct,{placeholder:"Video title",value:pe.title,onChange:ge=>{const Me=[...A];Me[ae].title=ge.target.value,E(Me)},className:"w-1/3"}),r.jsx(ct,{placeholder:"Video URL (YouTube, Vimeo, etc.)",value:pe.video_url,onChange:ge=>{const Me=[...A];Me[ae].video_url=ge.target.value,E(Me)},className:"flex-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>E(A.filter((ge,Me)=>Me!==ae)),children:r.jsx(Ts,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:Ee,children:[r.jsx(jn,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),T.map((pe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ct,{placeholder:"Link title",value:pe.title,onChange:ge=>{const Me=[...T];Me[ae].title=ge.target.value,O(Me)},className:"w-1/3"}),r.jsx(ct,{placeholder:"Canva share link",value:pe.canva_share_link,onChange:ge=>{const Me=[...T];Me[ae].canva_share_link=ge.target.value,O(Me)},className:"flex-1"}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>O(T.filter((ge,Me)=>Me!==ae)),children:r.jsx(Ts,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"outline",onClick:ye,children:"Cancel"}),r.jsx(J,{onClick:fe,disabled:q||re.isPending||ue.isPending,children:q?"Uploading...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:Z?r.jsx(Ir,{children:r.jsx(vt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(K==null?void 0:K.length)===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):K==null?void 0:K.map(pe=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[pe.preview_image_url?r.jsx("img",{src:pe.preview_image_url,alt:pe.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Ai,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:pe.title}),pe.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:pe.description})]})]})}),r.jsx(vt,{children:fn(new Date(pe.publish_date),"MMM d, yyyy")}),r.jsx(vt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${pe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:pe.is_published?"Published":"Draft"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>ne(pe),children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>ne(pe),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&he.mutate(pe.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},pe.id))})]})})})]})})}const o4e={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function njt(){const{user:e}=zr(),{toast:t}=pa(),n=ns(),s=Wr(),[i,o]=P.useState(""),[l,a]=P.useState("popular"),[h,p]=P.useState(!1),[x,y]=P.useState(""),[w,j]=P.useState(""),[S,C]=P.useState(!1),{data:A=[],isLoading:E}=Jt({queryKey:["wishlist-items",l,S],queryFn:async()=>{let q=ee.from("wishlist_items").select("*");S&&e&&(q=q.eq("user_id",e.id)),l==="latest"?q=q.order("created_at",{ascending:!1}):l==="popular"?q=q.order("vote_count",{ascending:!1}):l==="trending"&&(q=q.order("vote_count",{ascending:!1}));const{data:H,error:K}=await q;if(K)throw K;const Z=[...new Set((H==null?void 0:H.map(ie=>ie.user_id))||[])],{data:re}=await ee.from("profiles").select("id, name").in("id",Z),ue=new Map((re==null?void 0:re.map(ie=>[ie.id,ie]))||[]);let he=[];if(e){const{data:ie}=await ee.from("wishlist_votes").select("item_id").eq("user_id",e.id);he=(ie==null?void 0:ie.map(fe=>fe.item_id))||[]}const be=(H==null?void 0:H.map(ie=>ie.id))||[],{data:ne}=await ee.from("wishlist_comments").select("item_id").in("item_id",be),ye=new Map;return ne==null||ne.forEach(ie=>{ye.set(ie.item_id,(ye.get(ie.item_id)||0)+1)}),H==null?void 0:H.map(ie=>{const fe=ue.get(ie.user_id),de=(fe==null?void 0:fe.name)||"Unknown";return{...ie,user_name:de,user_initials:de.split(" ").map(_e=>_e[0]).join("").toUpperCase().slice(0,2),has_voted:he.includes(ie.id),comment_count:ye.get(ie.id)||0}})}}),T=cr({mutationFn:async({title:q,description:H})=>{const{error:K}=await ee.from("wishlist_items").insert({user_id:e.id,title:q,description:H});if(K)throw K},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),p(!1),y(""),j(""),t({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:q=>{t({title:"Error",description:q.message,variant:"destructive"})}}),O=cr({mutationFn:async({itemId:q,hasVoted:H})=>{if(H){const{error:K}=await ee.from("wishlist_votes").delete().eq("item_id",q).eq("user_id",e.id);if(K)throw K;return{itemId:q,wasAdded:!1}}else{const{error:K}=await ee.from("wishlist_votes").insert({item_id:q,user_id:e.id});if(K)throw K;return{itemId:q,wasAdded:!0}}},onSuccess:async q=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),q!=null&&q.wasAdded){const H=A.find(Z=>Z.id===q.itemId),K=((H==null?void 0:H.vote_count)||0)+1;ee.functions.invoke("wishlist-notify",{body:{itemId:q.itemId,voteCount:K}}).catch(console.error)}},onError:q=>{t({title:"Error",description:q.message,variant:"destructive"})}}),z=A.filter(q=>q.title.toLowerCase().includes(i.toLowerCase())||q.description.toLowerCase().includes(i.toLowerCase())),F=()=>{if(!x.trim()||!w.trim()){t({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}T.mutate({title:x.trim(),description:w.trim()})};return r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(p1,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold",children:"Wishlist"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Share ideas and vote on what we build next"})]})]}),r.jsxs(Br,{open:h,onOpenChange:p,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Submit a New Idea"})}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title"}),r.jsx(ct,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:q=>y(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:w,onChange:q=>j(q.target.value),rows:4})]}),r.jsx(J,{onClick:F,className:"w-full",disabled:T.isPending,children:T.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Idea"})]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search ideas...",value:i,onChange:q=>o(q.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ba,{value:l,onValueChange:q=>a(q),children:r.jsxs(fa,{children:[r.jsx(ln,{value:"popular",children:"Most Popular"}),r.jsx(ln,{value:"latest",children:"Latest"}),r.jsx(ln,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(J,{variant:S?"default":"outline",size:"sm",onClick:()=>C(!S),children:S?"Show All Ideas":"My Ideas"})}),E?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):z.length===0?r.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[r.jsx(p1,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),r.jsxs(J,{onClick:()=>p(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:z.map(q=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${q.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:H=>{H.stopPropagation(),O.mutate({itemId:q.id,hasVoted:q.has_voted||!1})},className:$t("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",q.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(yg,{className:$t("h-4 w-4",q.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:q.vote_count})]}),r.jsx(ci,{className:"h-10 w-10 bg-primary/20",children:r.jsx(di,{className:"bg-primary/20 text-primary text-sm font-medium",children:q.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:q.title}),r.jsx(Ft,{className:$t("text-xs",o4e[q.status].color),children:o4e[q.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:q.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(q.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Po,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:q.comment_count})]})]})},q.id))})]})})}const l4e={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function sjt(){const{itemId:e}=Wc(),t=ns(),{user:n}=zr(),{toast:s}=pa(),i=Wr(),[o,l]=P.useState(""),{data:a=!1}=Jt({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:A,error:E}=await ee.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!E&&!!A},enabled:!!n}),{data:h,isLoading:p}=Jt({queryKey:["wishlist-item",e],queryFn:async()=>{const{data:A,error:E}=await ee.from("wishlist_items").select("*").eq("id",e).single();if(E)throw E;const{data:T}=await ee.from("profiles").select("name").eq("id",A.user_id).single();let O=!1;if(n){const{data:z}=await ee.from("wishlist_votes").select("id").eq("item_id",e).eq("user_id",n.id).maybeSingle();O=!!z}return{...A,user_name:(T==null?void 0:T.name)||"Unknown",user_initials:((T==null?void 0:T.name)||"U").split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),has_voted:O}}}),{data:x=[],isLoading:y}=Jt({queryKey:["wishlist-comments",e],queryFn:async()=>{const{data:A,error:E}=await ee.from("wishlist_comments").select("*").eq("item_id",e).order("created_at",{ascending:!0});if(E)throw E;const T=[...new Set((A==null?void 0:A.map(F=>F.user_id))||[])],{data:O}=await ee.from("profiles").select("id, name").in("id",T),z=new Map((O==null?void 0:O.map(F=>[F.id,F]))||[]);return A==null?void 0:A.map(F=>{const q=z.get(F.user_id),H=(q==null?void 0:q.name)||"Unknown";return{...F,user_name:H,user_initials:H.split(" ").map(K=>K[0]).join("").toUpperCase().slice(0,2)}})}}),w=cr({mutationFn:async A=>{if(A){const{error:E}=await ee.from("wishlist_votes").delete().eq("item_id",e).eq("user_id",n.id);if(E)throw E;return{wasAdded:!1}}else{const{error:E}=await ee.from("wishlist_votes").insert({item_id:e,user_id:n.id});if(E)throw E;return{wasAdded:!0}}},onSuccess:async A=>{if(i.invalidateQueries({queryKey:["wishlist-item",e]}),i.invalidateQueries({queryKey:["wishlist-items"]}),A!=null&&A.wasAdded&&h){const E=(h.vote_count||0)+1;ee.functions.invoke("wishlist-notify",{body:{itemId:e,voteCount:E}}).catch(console.error)}},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),j=cr({mutationFn:async A=>{const{error:E}=await ee.from("wishlist_comments").insert({item_id:e,user_id:n.id,content:A});if(E)throw E},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",e]}),l(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),S=cr({mutationFn:async A=>{const{error:E}=await ee.from("wishlist_comments").delete().eq("id",A);if(E)throw E},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",e]}),s({title:"Comment deleted"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),C=()=>{o.trim()&&j.mutate(o.trim())};return p?r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Pr,{className:"h-8 w-32 mb-6"}),r.jsx(Pr,{className:"h-48 w-full mb-6"}),r.jsx(Pr,{className:"h-32 w-full"})]})}):h?r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>t("/wishlist"),className:"mb-4",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Wishlist"]}),r.jsx("div",{className:"bg-card border rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:()=>w.mutate(h.has_voted),className:$t("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",h.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(yg,{className:$t("h-5 w-5",h.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:h.vote_count}),r.jsx("span",{className:"text-xs",children:"votes"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:h.title}),r.jsx(Ft,{className:$t("text-xs",l4e[h.status].color),children:l4e[h.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:h.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(ci,{className:"h-6 w-6",children:r.jsx(di,{className:"bg-primary/20 text-primary text-xs",children:h.user_initials})}),r.jsx("span",{children:h.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(h.created_at).toLocaleDateString()})]})]})]})}),r.jsxs("div",{className:"bg-card border rounded-lg p-6",children:[r.jsxs("h2",{className:"text-lg font-semibold mb-4",children:["Comments (",x.length,")"]}),r.jsxs("div",{className:"flex gap-3 mb-6",children:[r.jsx(kte,{placeholder:a?"Share your thoughts... Use # to link templates":"Share your thoughts on this idea...",value:o,onChange:l,minHeight:"60px",mentionFormat:"encoded",enableTemplateMentions:a}),r.jsx(J,{onClick:C,disabled:!o.trim()||j.isPending,size:"icon",className:"h-auto",children:j.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(Lo,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(A=>r.jsx(Pr,{className:"h-20 w-full"},A))}):x.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No comments yet. Be the first to share your thoughts!"}):r.jsx("div",{className:"space-y-4",children:x.map(A=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"bg-primary/20 text-primary text-xs",children:A.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium text-sm",children:A.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(A.created_at).toLocaleDateString()})]}),r.jsx(Fxe,{content:A.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===A.user_id&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>S.mutate(A.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]},A.id))})]})]})}):r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Item not found"}),r.jsx(J,{variant:"link",onClick:()=>t("/wishlist"),children:"Go back to Wishlist"})]})})}const c4e={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}},d4e=["open","under_review","planned","in_progress","launched","declined"];function ijt(){const{toast:e}=pa(),t=ns(),n=Wr(),[s,i]=P.useState(""),[o,l]=P.useState("all"),[a,h]=P.useState(!1),[p,x]=P.useState(null),{data:y=[],isLoading:w}=Jt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:E,error:T}=await ee.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(T)throw T;const O=[...new Set((E==null?void 0:E.map(Z=>Z.user_id))||[])],{data:z}=await ee.from("profiles").select("id, name, email").in("id",O),F=new Map((z==null?void 0:z.map(Z=>[Z.id,Z]))||[]),q=(E==null?void 0:E.map(Z=>Z.id))||[],{data:H}=await ee.from("wishlist_comments").select("item_id").in("item_id",q),K=new Map;return H==null||H.forEach(Z=>{K.set(Z.item_id,(K.get(Z.item_id)||0)+1)}),E==null?void 0:E.map(Z=>{const re=F.get(Z.user_id);return{...Z,user_name:(re==null?void 0:re.name)||"Unknown",user_email:(re==null?void 0:re.email)||"",comment_count:K.get(Z.id)||0}})}}),j=cr({mutationFn:async({itemId:E,status:T})=>{const{error:O}=await ee.from("wishlist_items").update({status:T}).eq("id",E);if(O)throw O},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),e({title:"Status updated!"})},onError:E=>{e({title:"Error",description:E.message,variant:"destructive"})}}),S=cr({mutationFn:async E=>{const{error:T}=await ee.from("wishlist_items").delete().eq("id",E);if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),h(!1),x(null),e({title:"Item deleted!"})},onError:E=>{e({title:"Error",description:E.message,variant:"destructive"})}}),C=y.filter(E=>{const T=E.title.toLowerCase().includes(s.toLowerCase())||E.description.toLowerCase().includes(s.toLowerCase())||E.user_name.toLowerCase().includes(s.toLowerCase()),O=o==="all"||E.status===o;return T&&O}),A={total:y.length,open:y.filter(E=>E.status==="open").length,inProgress:y.filter(E=>E.status==="in_progress").length,launched:y.filter(E=>E.status==="launched").length,highVotes:y.filter(E=>E.vote_count>=10).length};return r.jsx(Or,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>t("/admin"),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Wishlist Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Review and manage community ideas"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Ideas"}),r.jsx("p",{className:"text-2xl font-bold",children:A.total})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Open"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:A.open})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-bold text-orange-600",children:A.inProgress})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Launched"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:A.launched})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"10+ Votes"}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:A.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search ideas, users...",value:s,onChange:E=>i(E.target.value),className:"pl-10"})]}),r.jsxs(bn,{value:o,onValueChange:E=>l(E),children:[r.jsx(vn,{className:"w-[180px]",children:r.jsx(wn,{placeholder:"Filter by status"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Statuses"}),d4e.map(E=>r.jsx(Kt,{value:E,children:c4e[E].label},E))]})]})]}),w?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(E=>r.jsx(Pr,{className:"h-16 w-full"},E))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-[60px]",children:"Votes"}),r.jsx(Et,{children:"Title"}),r.jsx(Et,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(Et,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Hs,{children:C.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):C.map(E=>r.jsxs(Ir,{className:$t(E.vote_count>=10&&"bg-primary/5"),children:[r.jsx(vt,{children:r.jsx(Ft,{variant:E.vote_count>=10?"default":"secondary",children:E.vote_count})}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:E.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:E.description})]})}),r.jsx(vt,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:E.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:E.user_email})]})}),r.jsx(vt,{className:"hidden sm:table-cell",children:E.comment_count}),r.jsx(vt,{children:r.jsxs(bn,{value:E.status,onValueChange:T=>j.mutate({itemId:E.id,status:T}),children:[r.jsx(vn,{className:"w-[140px] h-8",children:r.jsx(wn,{})}),r.jsx(_n,{children:d4e.map(T=>r.jsx(Kt,{value:T,children:c4e[T].label},T))})]})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${E.id}`,"_blank"),children:r.jsx(Ls,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(E.id),h(!0)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},E.id))})]})}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Delete Wishlist Item"})}),r.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to delete this idea? This will also delete all votes and comments."}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(J,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(J,{variant:"destructive",onClick:()=>p&&S.mutate(p),disabled:S.isPending,children:S.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function ajt(){const{user:e}=zr(),[t,n]=P.useState([]),[s,i]=P.useState(!0),[o,l]=P.useState(!1),[a,h]=P.useState(null),[p,x]=P.useState(!1),[y,w]=P.useState(null),[j,S]=P.useState(""),[C,A]=P.useState(""),[E,T]=P.useState(""),[O,z]=P.useState(""),[F,q]=P.useState(""),[H,K]=P.useState(!1),[Z,re]=P.useState(""),[ue,he]=P.useState("once"),[be,ne]=P.useState([]),[ye,ie]=P.useState([]),[fe,de]=P.useState(!1),[_e,Ee]=P.useState(!1),[ke,pe]=P.useState([]),[ae,ge]=P.useState({total:0,dismissed:0});P.useEffect(()=>{Me()},[]);const Me=async()=>{const{data:ht,error:wt}=await ee.from("levelup_briefs").select("*").order("created_at",{ascending:!1});wt?(ze.error("Failed to fetch briefs"),console.error(wt)):n(ht||[]),i(!1)},Ue=()=>{S(""),A(""),T(""),z(""),q(""),K(!1),re(new Date().toISOString().slice(0,16)),he("once"),ne([]),ie([]),h(null)},Ie=()=>{Ue(),l(!0)},Ke=async ht=>{h(ht),S(ht.title),A(ht.description||""),T(ht.video_url||""),z(ht.graphic_url||""),q(ht.graphic_link_url||""),K(ht.is_published),re(ht.publish_date.slice(0,16)),he(ht.show_frequency);const{data:wt}=await ee.from("levelup_brief_links").select("*").eq("brief_id",ht.id).order("sort_order");ne((wt==null?void 0:wt.map(It=>({title:It.title,url:It.url})))||[]);const{data:Ct}=await ee.from("levelup_brief_polls").select("*").eq("brief_id",ht.id).order("sort_order");if(Ct){const It=[];for(const jt of Ct){const{data:rr}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",jt.id).order("sort_order");It.push({question:jt.question,poll_type:jt.poll_type,options:(rr==null?void 0:rr.map(Ar=>Ar.option_text))||[]})}ie(It)}l(!0)},Re=async ht=>{var Ct;const wt=(Ct=ht.target.files)==null?void 0:Ct[0];if(wt){de(!0);try{const It=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:wt.name.replace(/\.[^/.]+$/,"")}});if(It.error)throw It.error;const{videoId:jt,libraryId:rr}=It.data,Ar=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:jt}});if(Ar.error)throw Ar.error;const{uploadUrl:gn,apiKey:kn}=Ar.data,Jr=new XMLHttpRequest;await new Promise((js,fr)=>{Jr.upload.addEventListener("progress",xs=>{if(xs.lengthComputable){const bi=Math.round(xs.loaded/xs.total*100);console.log("Upload progress:",bi)}}),Jr.addEventListener("load",()=>{Jr.status>=200&&Jr.status<300?js():fr(new Error(`Upload failed with status ${Jr.status}`))}),Jr.addEventListener("error",()=>fr(new Error("Upload failed"))),Jr.open("PUT",gn),Jr.setRequestHeader("AccessKey",kn),Jr.send(wt)});const zn=`https://player.mediadelivery.net/embed/${rr}/${jt}`;T(zn),ze.success("Video uploaded successfully! It may take a few minutes to process.")}catch(It){console.error("Upload error:",It),ze.error("Failed to upload video")}finally{de(!1)}}},Ce=async()=>{if(!j.trim()){ze.error("Title is required");return}try{let ht;if(a){const{error:wt}=await ee.from("levelup_briefs").update({title:j,description:C||null,video_url:E||null,graphic_url:O||null,graphic_link_url:F||null,is_published:H,publish_date:Z,show_frequency:ue}).eq("id",a.id);if(wt)throw wt;ht=a.id,await ee.from("levelup_brief_links").delete().eq("brief_id",ht);const{data:Ct}=await ee.from("levelup_brief_polls").select("id").eq("brief_id",ht);if(Ct)for(const It of Ct)await ee.from("levelup_brief_poll_options").delete().eq("poll_id",It.id);await ee.from("levelup_brief_polls").delete().eq("brief_id",ht)}else{const{data:wt,error:Ct}=await ee.from("levelup_briefs").insert({title:j,description:C||null,video_url:E||null,graphic_url:O||null,graphic_link_url:F||null,is_published:H,publish_date:Z,show_frequency:ue,created_by:e==null?void 0:e.id}).select().single();if(Ct)throw Ct;ht=wt.id}if(be.length>0){const wt=be.map((Ct,It)=>({brief_id:ht,title:Ct.title,url:Ct.url,sort_order:It}));await ee.from("levelup_brief_links").insert(wt)}for(let wt=0;wt0){const rr=Ct.options.map((Ar,gn)=>({poll_id:It.id,option_text:Ar,sort_order:gn}));await ee.from("levelup_brief_poll_options").insert(rr)}}ze.success(a?"Brief updated":"Brief created"),l(!1),Ue(),Me()}catch(ht){console.error("Error saving brief:",ht),ze.error("Failed to save brief")}},Je=async ht=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:wt}=await ee.from("levelup_briefs").delete().eq("id",ht);if(wt)throw wt;ze.success("Brief deleted"),Me()}catch(wt){console.error("Error deleting brief:",wt),ze.error("Failed to delete brief")}},Te=async ht=>{w(ht);const{count:wt}=await ee.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",ht.id),{count:Ct}=await ee.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",ht.id).not("dismissed_at","is",null);ge({total:wt||0,dismissed:Ct||0});const{data:It}=await ee.from("levelup_brief_polls").select("*").eq("brief_id",ht.id).order("sort_order");if(It){const jt=[];for(const rr of It){const{data:Ar}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",rr.id).order("sort_order"),{data:gn}=await ee.from("levelup_brief_poll_responses").select("option_id").eq("poll_id",rr.id),kn={};let Jr=0;Ar&&Ar.forEach(zn=>{const js=(gn==null?void 0:gn.filter(fr=>fr.option_id===zn.id).length)||0;kn[zn.id]=js,Jr+=js}),jt.push({...rr,options:Ar||[],results:kn,totalResponses:rr.poll_type==="single"?new Set(gn==null?void 0:gn.map(zn=>zn.option_id)).size:Jr})}pe(jt)}x(!0)},Ye=()=>{ne([...be,{title:"",url:""}])},xe=(ht,wt,Ct)=>{const It=[...be];It[ht][wt]=Ct,ne(It)},mt=ht=>{ne(be.filter((wt,Ct)=>Ct!==ht))},et=()=>{ie([...ye,{question:"",poll_type:"single",options:["",""]}])},nt=(ht,wt)=>{const Ct=[...ye];Ct[ht].question=wt,ie(Ct)},Ae=(ht,wt)=>{const Ct=[...ye];Ct[ht].poll_type=wt,ie(Ct)},pt=ht=>{const wt=[...ye];wt[ht].options.push(""),ie(wt)},Be=(ht,wt,Ct)=>{const It=[...ye];It[ht].options[wt]=Ct,ie(It)},Qe=(ht,wt)=>{const Ct=[...ye];Ct[ht].options=Ct[ht].options.filter((It,jt)=>jt!==wt),ie(Ct)},tt=ht=>{ie(ye.filter((wt,Ct)=>Ct!==ht))};return r.jsxs(Or,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(J,{onClick:Ie,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{children:"Frequency"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:s?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):t.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):t.map(ht=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:ht.title}),r.jsx(vt,{children:r.jsx(Ft,{variant:ht.is_published?"default":"secondary",children:ht.is_published?"Published":"Draft"})}),r.jsx(vt,{className:"capitalize",children:ht.show_frequency.replace("_"," ")}),r.jsx(vt,{children:fn(new Date(ht.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>Te(ht),children:r.jsx(ac,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>Ke(ht),children:r.jsx(rc,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>Je(ht.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},ht.id))})]})})})]}),r.jsx(Br,{open:o,onOpenChange:l,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:a?"Edit Brief":"Create New Brief"})}),r.jsxs(ba,{defaultValue:"content",className:"w-full",children:[r.jsxs(fa,{className:"grid w-full grid-cols-4",children:[r.jsx(ln,{value:"content",children:"Content"}),r.jsx(ln,{value:"media",children:"Media"}),r.jsx(ln,{value:"links",children:"Links"}),r.jsx(ln,{value:"polls",children:"Polls"})]}),r.jsxs(An,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Title *"}),r.jsx(ct,{value:j,onChange:ht=>S(ht.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:C,onChange:ht=>A(ht),placeholder:"Brief overview for agents...",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Publish Date"}),r.jsx(ct,{type:"datetime-local",value:Z,onChange:ht=>re(ht.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Show Frequency"}),r.jsxs(bn,{value:ue,onValueChange:he,children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"once",children:"Once (until dismissed)"}),r.jsx(Kt,{value:"every_login",children:"Every login"}),r.jsx(Kt,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx($s,{checked:H,onCheckedChange:K}),r.jsx(Ve,{children:"Publish immediately"})]})]}),r.jsxs(An,{value:"media",className:"space-y-6 mt-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Video (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ct,{type:"file",accept:"video/*",onChange:Re,disabled:fe})}),fe&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Or paste embed URL"}),r.jsx(ct,{value:E,onChange:ht=>T(ht.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),E&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:E,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),r.jsxs("div",{className:"border-t pt-4 space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Graphic / Image (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ct,{type:"file",accept:"image/*",onChange:async ht=>{var Ct;const wt=(Ct=ht.target.files)==null?void 0:Ct[0];if(wt){Ee(!0);try{const It=wt.name.split(".").pop(),jt=`brief-graphics/${Date.now()}.${It}`,{error:rr}=await ee.storage.from("banner-images").upload(jt,wt,{upsert:!0});if(rr)throw rr;const{data:Ar}=ee.storage.from("banner-images").getPublicUrl(jt);z(Ar.publicUrl),ze.success("Image uploaded!")}catch(It){console.error(It),ze.error("Failed to upload image")}finally{Ee(!1)}}},disabled:_e})}),_e&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Or paste Image URL"}),r.jsx(ct,{value:O,onChange:ht=>z(ht.target.value),placeholder:"https://example.com/image.png"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Click-through Link (optional)"}),r.jsx(ct,{value:F,onChange:ht=>q(ht.target.value),placeholder:"https://example.com/landing-page"})]}),O&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted border",children:r.jsx("img",{src:O,alt:"Brief graphic preview",className:"w-full object-contain max-h-64"})})]})]}),r.jsxs(An,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ve,{children:"Quick Links"}),r.jsxs(J,{variant:"outline",size:"sm",onClick:Ye,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),be.map((ht,wt)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(ct,{value:ht.title,onChange:Ct=>xe(wt,"title",Ct.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(ct,{value:ht.url,onChange:Ct=>xe(wt,"url",Ct.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>mt(wt),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]},wt)),be.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(An,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ve,{children:"Polls"}),r.jsxs(J,{variant:"outline",size:"sm",onClick:et,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),ye.map((ht,wt)=>r.jsx(We,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ct,{value:ht.question,onChange:Ct=>nt(wt,Ct.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(bn,{value:ht.poll_type,onValueChange:Ct=>Ae(wt,Ct),children:[r.jsx(vn,{className:"w-32",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"single",children:"Single"}),r.jsx(Kt,{value:"multi",children:"Multi-select"})]})]}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>tt(wt),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[ht.options.map((Ct,It)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:Ct,onChange:jt=>Be(wt,It,jt.target.value),placeholder:`Option ${It+1}`}),ht.options.length>2&&r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>Qe(wt,It),children:r.jsx(Zn,{className:"h-4 w-4 text-muted-foreground"})})]},It)),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>pt(wt),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},wt)),ye.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(J,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(J,{onClick:Ce,children:a?"Update Brief":"Create Brief"})]})]})}),r.jsx(Br,{open:p,onOpenChange:x,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Results: ",y==null?void 0:y.title]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-2xl font-bold",children:ae.total})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-2xl font-bold",children:ae.dismissed})})]})]}),ke.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),ke.map(ht=>r.jsxs(We,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:ht.question}),r.jsx("div",{className:"space-y-2",children:ht.options.map(wt=>{const Ct=ht.results[wt.id]||0,It=ht.totalResponses>0?Math.round(Ct/ht.totalResponses*100):0;return r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:wt.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[Ct," (",It,"%)"]})]}),r.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${It}%`}})})]},wt.id)})})]},ht.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const ojt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=P.useState(!1),[o,l]=P.useState(null),[a,h]=P.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=P.useState(null),[y,w]=P.useState(""),{data:j=[],isLoading:S}=Jt({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:F,error:q}=await ee.from("additional_services").select("*").order("publish_date",{ascending:!1});if(q)throw q;return F}}),C=cr({mutationFn:async F=>{let q=F.existingImageUrl;if(F.image){const K=F.image.name.split(".").pop(),Z=`${Date.now()}-${Math.random().toString(36).substring(7)}.${K}`,{error:re}=await ee.storage.from("service-images").upload(Z,F.image);if(re)throw re;const{data:ue}=ee.storage.from("service-images").getPublicUrl(Z);q=ue.publicUrl}const H={name:F.item.name,description:F.item.description||null,preview_image_url:q,signup_link_url:F.item.signup_link_url,publish_date:F.item.publish_date?new Date(F.item.publish_date).toISOString():new Date().toISOString(),is_published:F.item.is_published,created_by:e==null?void 0:e.id};if(F.itemId){const{error:K}=await ee.from("additional_services").update(H).eq("id",F.itemId);if(K)throw K}else{const{error:K}=await ee.from("additional_services").insert(H);if(K)throw K}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:o?"Service updated":"Service created"}),i(!1),E()},onError:F=>{t({title:"Error saving service",description:F.message,variant:"destructive"})}}),A=cr({mutationFn:async F=>{const{error:q}=await ee.from("additional_services").delete().eq("id",F);if(q)throw q},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:"Service deleted"})},onError:F=>{t({title:"Error deleting service",description:F.message,variant:"destructive"})}}),E=()=>{h({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),w(""),l(null)},T=F=>{l(F),h({name:F.name,description:F.description||"",signup_link_url:F.signup_link_url,publish_date:F.publish_date?new Date(F.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:F.is_published}),w(F.preview_image_url||""),i(!0)},O=F=>{var H;const q=(H=F.target.files)==null?void 0:H[0];q&&(x(q),w(URL.createObjectURL(q)))},z=F=>{if(F.preventDefault(),!a.name.trim()){t({title:"Name is required",variant:"destructive"});return}if(!a.signup_link_url.trim()){t({title:"Signup link URL is required",variant:"destructive"});return}C.mutate({item:a,image:p,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Or,{title:"Manage Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(F=>F.is_published).length})})]})]}),r.jsxs(Br,{open:s,onOpenChange:F=>{i(F),F||E()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Name *"}),r.jsx(ct,{id:"name",value:a.name,onChange:F=>h({...a,name:F.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(py,{content:a.description,onChange:F=>h({...a,description:F}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(ct,{id:"signup_link_url",type:"url",value:a.signup_link_url,onChange:F=>h({...a,signup_link_url:F.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(ct,{id:"publish_date",type:"date",value:a.publish_date,onChange:F=>h({...a,publish_date:F.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx($s,{id:"is_published",checked:a.is_published,onCheckedChange:F=>h({...a,is_published:F})}),r.jsx(Ve,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(J,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),w("")},children:r.jsx(Ts,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Zo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(ct,{type:"file",accept:"image/*",onChange:O,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(J,{type:"submit",disabled:C.isPending,children:C.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:S?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):j.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No services yet. Click "Add Service" to create your first one.'}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-16",children:"Preview"}),r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Signup Link"}),r.jsx(Et,{children:"Publish Date"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:j.map(F=>r.jsxs(Ir,{children:[r.jsx(vt,{children:F.preview_image_url?r.jsx("img",{src:F.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Zo,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(vt,{className:"font-medium",children:F.name}),r.jsx(vt,{children:r.jsxs("a",{href:F.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Ls,{className:"h-3 w-3"}),"Link"]})}),r.jsx(vt,{children:new Date(F.publish_date).toLocaleDateString()}),r.jsx(vt,{children:r.jsx(Ft,{variant:F.is_published?"default":"secondary",children:F.is_published?"Published":"Draft"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>T(F),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&A.mutate(F.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},F.id))})]})})})]})})};function ljt(){const{toast:e}=pa(),[t,n]=P.useState([]),[s,i]=P.useState(!0),[o,l]=P.useState(!1),[a,h]=P.useState(!1),[p,x]=P.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});P.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:A,error:E}=await ee.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(E)throw E;n(A.coupons||[])}catch(A){console.error("Error fetching coupons:",A),e({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{i(!1)}},w=async()=>{if(!p.name){e({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(p.discountType==="percent"&&!p.percentOff){e({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(p.discountType==="amount"&&!p.amountOff){e({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(p.duration==="repeating"&&!p.durationInMonths){e({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}l(!0);try{const A={action:"create",name:p.name,duration:p.duration,promotion_code:p.promotionCode.trim()||void 0};p.discountType==="percent"?A.percent_off=parseFloat(p.percentOff):(A.amount_off=Math.round(parseFloat(p.amountOff)*100),A.currency="usd"),p.duration==="repeating"&&(A.duration_in_months=parseInt(p.durationInMonths));const{data:E,error:T}=await ee.functions.invoke("stripe-manage-coupons",{body:A});if(T)throw T;e({title:"Success",description:"Coupon created successfully"}),h(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(A){console.error("Error creating coupon:",A),e({title:"Error",description:A.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},j=async A=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:E}=await ee.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:A}});if(E)throw E;e({title:"Success",description:"Coupon deleted successfully"}),y()}catch(E){console.error("Error deleting coupon:",E),e({title:"Error",description:E.message||"Failed to delete coupon",variant:"destructive"})}},S=A=>A.percent_off?`${A.percent_off}% off`:A.amount_off?`$${(A.amount_off/100).toFixed(2)} off`:"N/A",C=A=>{switch(A.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${A.duration_in_months} months`;default:return A.duration}};return r.jsx(Or,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Br,{open:a,onOpenChange:h,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New Coupon"}),r.jsx(es,{children:"Create a discount coupon that can be applied to subscriptions"})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Promotion Code (what users will type)"}),r.jsx(ct,{placeholder:"e.g., BROKERAGE50",value:p.promotionCode,onChange:A=>x({...p,promotionCode:A.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Coupon Name (internal label)"}),r.jsx(ct,{placeholder:"e.g., 50% Off Brokerage Launch",value:p.name,onChange:A=>x({...p,name:A.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Discount Type"}),r.jsxs(bn,{value:p.discountType,onValueChange:A=>{const E=A==="amount"&&p.duration==="forever"?"once":p.duration;x({...p,discountType:A,duration:E})},children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(hS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx(Kt,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(ud,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),p.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(ct,{type:"number",min:"1",max:"100",placeholder:"20",value:p.percentOff,onChange:A=>x({...p,percentOff:A.target.value})}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Amount Off (USD)"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(ct,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:p.amountOff,onChange:A=>x({...p,amountOff:A.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Duration"}),r.jsxs(bn,{value:p.duration,onValueChange:A=>x({...p,duration:A}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"once",children:"Once (first payment only)"}),r.jsx(Kt,{value:"repeating",children:"Multiple months"}),r.jsxs(Kt,{value:"forever",disabled:p.discountType==="amount",children:["Forever ",p.discountType==="amount"&&"(% discounts only)"]})]})]}),p.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),p.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Number of Months"}),r.jsx(ct,{type:"number",min:"1",placeholder:"3",value:p.durationInMonths,onChange:A=>x({...p,durationInMonths:A.target.value})})]}),r.jsx(J,{onClick:w,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Active Coupons"}),r.jsx(En,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(Xe,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No coupons created yet. Create your first coupon to get started."}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Promo Code"}),r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Discount"}),r.jsx(Et,{children:"Duration"}),r.jsx(Et,{children:"Redemptions"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:t.map(A=>{var E;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-mono font-medium",children:((E=A.promotion_codes)==null?void 0:E.length)>0?A.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(vt,{children:A.name||"-"}),r.jsx(vt,{children:S(A)}),r.jsx(vt,{children:C(A)}),r.jsx(vt,{children:A.times_redeemed}),r.jsx(vt,{children:r.jsx(Ft,{variant:A.valid?"default":"secondary",children:A.valid?"Active":"Inactive"})}),r.jsx(vt,{className:"text-right",children:r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>j(A.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})})]},A.id)})})]})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"How to Use Coupons"})}),r.jsxs(Xe,{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"1. Create a coupon above with your desired discount."}),r.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),r.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),r.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const Lce={prod_Tc07cYplXUGNkm:{name:"Individual Agent",price:"$39/mo",type:"individual"},prod_Tc08MupgoVySDG:{name:"Brokerage (Under 25)",price:"$299/mo",type:"brokerage"},prod_Tc09N1tJ4RrAFn:{name:"Brokerage (Over 25)",price:"$499/mo",type:"brokerage"}};function cjt(){const[e,t]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState(null),{data:l,isLoading:a,refetch:h}=Jt({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:S,error:C}=await ee.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(C)throw C;return S}}),{data:p}=Jt({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:S,error:C}=await ee.from("brokerages").select("*").order("name");if(C)throw C;return await Promise.all((S||[]).map(async E=>{const{data:T}=await ee.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",E.id),{data:O}=await ee.from("user_roles").select("user_id").eq("role","brokerage_manager"),z=(O==null?void 0:O.map(H=>H.user_id))||[],F=(T==null?void 0:T.filter(H=>z.includes(H.id)))||[],q=(T==null?void 0:T.length)||0;return{...E,managers:F,agentCount:q}}))}}),x=S=>{if(S.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(S.brokerage_id&&!S.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(S.is_trial&&S.trial_expires_at)return new Date(S.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(S.subscription_status==="active"||S.subscription_status==="trialing"){const C=Lce[S.subscription_product_id];return{status:(C==null?void 0:C.name)||"Active",badge:S.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return S.subscription_status==="canceled"||S.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},y=l==null?void 0:l.filter(S=>{var A,E;if(!(((A=S.name)==null?void 0:A.toLowerCase().includes(e.toLowerCase()))||((E=S.email)==null?void 0:E.toLowerCase().includes(e.toLowerCase()))))return!1;switch(x(S),n){case"active":return S.subscription_status==="active";case"trialing":return S.subscription_status==="trialing"||S.is_trial&&new Date(S.trial_expires_at)>new Date;case"grandfathered":return S.is_grandfathered;case"brokerage":return S.brokerage_id&&!S.subscription_product_id&&!S.is_grandfathered;case"expired":return S.subscription_status==="canceled"||S.subscription_status==="past_due"||S.is_trial&&new Date(S.trial_expires_at)<=new Date;case"none":return!S.subscription_status||S.subscription_status==="none";default:return!0}}),w={totalUsers:(l==null?void 0:l.length)||0,activeSubscriptions:(l==null?void 0:l.filter(S=>S.subscription_status==="active").length)||0,trials:(l==null?void 0:l.filter(S=>S.subscription_status==="trialing"||S.is_trial&&new Date(S.trial_expires_at)>new Date).length)||0,grandfathered:(l==null?void 0:l.filter(S=>S.is_grandfathered).length)||0,brokerageMembers:(l==null?void 0:l.filter(S=>S.brokerage_id&&!S.subscription_product_id&&!S.is_grandfathered).length)||0,individualSubscribers:(l==null?void 0:l.filter(S=>S.subscription_status==="active"&&S.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(l==null?void 0:l.filter(S=>S.subscription_status==="active"&&(S.subscription_product_id==="prod_Tc08MupgoVySDG"||S.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},j=S=>{window.open(`https://dashboard.stripe.com/customers/${S}`,"_blank")};return r.jsx(Or,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(J,{onClick:()=>h(),variant:"outline",size:"sm",children:[r.jsx(ql,{className:"h-4 w-4 mr-2"}),"Refresh"]})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Users"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.totalUsers})]})}),r.jsx(We,{className:"border-green-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hm,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Paid"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-green-600",children:w.activeSubscriptions})]})}),r.jsx(We,{className:"border-blue-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Trials"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:w.trials})]})}),r.jsx(We,{className:"border-purple-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(o1,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Grandfathered"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-purple-600",children:w.grandfathered})]})}),r.jsx(We,{className:"border-orange-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Members"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-orange-600",children:w.brokerageMembers})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Individual"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.individualSubscribers})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.brokerageSubscribers})]})})]}),r.jsxs(ba,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"users",children:"All Users"}),r.jsx(ln,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(An,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name or email...",value:e,onChange:S=>t(S.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:n,onValueChange:S=>s(S),children:[r.jsx(vn,{className:"w-[200px]",children:r.jsx(wn,{placeholder:"Filter by status"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Users"}),r.jsx(Kt,{value:"active",children:"Active Subscriptions"}),r.jsx(Kt,{value:"trialing",children:"Trials"}),r.jsx(Kt,{value:"grandfathered",children:"Grandfathered"}),r.jsx(Kt,{value:"brokerage",children:"Brokerage Members"}),r.jsx(Kt,{value:"expired",children:"Expired/Canceled"}),r.jsx(Kt,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"User"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{children:"Plan"}),r.jsx(Et,{children:"Brokerage"}),r.jsx(Et,{children:"End Date"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:a?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(S=>{var E,T;const C=x(S),A=Lce[S.subscription_product_id];return r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:S.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:S.email})]})}),r.jsx(vt,{children:r.jsx(Ft,{variant:C.variant,children:C.badge})}),r.jsx(vt,{children:r.jsx("span",{className:"text-sm",children:S.is_grandfathered?"Legacy Access":S.brokerage_id&&!S.subscription_product_id?"Brokerage Subscription":(A==null?void 0:A.name)||C.status})}),r.jsx(vt,{children:(E=S.brokerages)!=null&&E.name?r.jsx("span",{className:"text-sm",children:S.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(vt,{children:S.subscription_end_date?r.jsx("span",{className:"text-sm",children:fn(new Date(S.subscription_end_date),"MMM d, yyyy")}):S.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",fn(new Date(S.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[S.stripe_customer_id&&r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>j(S.stripe_customer_id),children:r.jsx(Ls,{className:"h-4 w-4"})}),r.jsxs(Br,{children:[r.jsx(Fo,{asChild:!0,children:r.jsx(J,{variant:"outline",size:"sm",onClick:()=>o(S),children:"Details"})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Subscription Details"}),r.jsxs(es,{children:[S.name," (",S.email,")"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),r.jsx(Ft,{variant:C.variant,className:"mt-1",children:C.badge})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),r.jsx("p",{className:"font-medium",children:S.is_grandfathered?"Grandfathered (Legacy)":S.brokerage_id&&!S.subscription_product_id?"Brokerage Subscription":(A==null?void 0:A.name)||"None"})]}),S.brokerage_id&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),r.jsx("p",{className:"font-medium",children:((T=S.brokerages)==null?void 0:T.name)||"Unknown"})]}),S.subscription_end_date&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period End"}),r.jsx("p",{className:"font-medium",children:fn(new Date(S.subscription_end_date),"MMMM d, yyyy")})]}),S.trial_expires_at&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Expires"}),r.jsx("p",{className:"font-medium",children:fn(new Date(S.trial_expires_at),"MMMM d, yyyy")})]}),S.stripe_customer_id&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Stripe Customer ID"}),r.jsx("p",{className:"font-mono text-sm",children:S.stripe_customer_id})]})]}),S.stripe_customer_id&&r.jsxs(J,{className:"w-full",onClick:()=>j(S.stripe_customer_id),children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},S.id)})})]})})})]}),r.jsx(An,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:p==null?void 0:p.map(S=>{var A,E;const C=(A=S.managers)==null?void 0:A.some(T=>T.subscription_status==="active"&&(T.subscription_product_id==="prod_Tc08MupgoVySDG"||T.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:r.jsx(na,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:S.name}),r.jsxs(En,{children:[S.agentCount," agents"]})]})]}),r.jsx(Ft,{variant:C?"default":"outline",children:C?"Active Subscription":"No Active Subscription"})]})}),r.jsx(Xe,{children:((E=S.managers)==null?void 0:E.length)>0?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),S.managers.map(T=>{const O=Lce[T.subscription_product_id];return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.email})]}),r.jsx("div",{className:"text-right",children:O?r.jsxs("div",{children:[r.jsx(Ft,{variant:"default",children:O.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:O.price})]}):r.jsx(Ft,{variant:"outline",children:"No Subscription"})})]},T.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},S.id)})})})]})]})})}function djt(){const[e,t]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(""),[l,a]=P.useState("all"),[h,p]=P.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});P.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:S,error:C}=await ee.from("referrals").select(` *, referrer_brokerage:brokerages!referrer_brokerage_id(name), referred_brokerage:brokerages!referred_brokerage_id(name), referred_user:profiles!referred_user_id(name, email) `).order("created_at",{ascending:!1});if(C)throw C;t(S||[]);const A=(S==null?void 0:S.filter(O=>O.status==="qualified").length)||0,E=(S==null?void 0:S.filter(O=>O.status==="pending").length)||0,T=(S==null?void 0:S.filter(O=>O.status==="cancelled").length)||0;p({total:(S==null?void 0:S.length)||0,qualified:A,pending:E,cancelled:T,totalDiscounts:A*25})}catch(S){console.error("Error fetching referrals:",S),ze.error("Failed to load referrals")}finally{s(!1)}},y=async()=>{try{ze.loading("Processing qualifications...");const{error:S}=await ee.functions.invoke("process-referral-qualifications");if(S)throw S;ze.dismiss(),ze.success("Qualifications processed successfully"),x()}catch(S){ze.dismiss(),console.error("Error processing qualifications:",S),ze.error("Failed to process qualifications")}},w=e.filter(S=>{var E,T,O,z,F,q;const C=((T=(E=S.referrer_brokerage)==null?void 0:E.name)==null?void 0:T.toLowerCase().includes(i.toLowerCase()))||((z=(O=S.referred_brokerage)==null?void 0:O.name)==null?void 0:z.toLowerCase().includes(i.toLowerCase()))||((q=(F=S.referred_user)==null?void 0:F.email)==null?void 0:q.toLowerCase().includes(i.toLowerCase())),A=l==="all"||S.status===l;return C&&A}),j=S=>{switch(S){case"qualified":return r.jsxs(Ft,{className:"bg-green-100 text-green-800",children:[r.jsx(qa,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Ft,{variant:"secondary",children:[r.jsx(Ki,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Ft,{variant:"destructive",children:[r.jsx(zc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Ft,{children:S})}};return r.jsx(Or,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(J,{onClick:y,variant:"outline",children:[r.jsx(ql,{className:"h-4 w-4 mr-2"}),"Process Qualifications"]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ud,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",h.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"All Referrals"}),r.jsx(En,{children:"View and manage all referral relationships"})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by brokerage or email...",value:i,onChange:S=>o(S.target.value),className:"pl-10"})]}),r.jsxs(bn,{value:l,onValueChange:a,children:[r.jsx(vn,{className:"w-[180px]",children:r.jsx(wn,{placeholder:"Filter by status"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Statuses"}),r.jsx(Kt,{value:"pending",children:"Pending"}),r.jsx(Kt,{value:"qualified",children:"Qualified"}),r.jsx(Kt,{value:"cancelled",children:"Cancelled"})]})]})]}),n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Referrer"}),r.jsx(Et,{children:"Referred"}),r.jsx(Et,{children:"Signup Date"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{children:"Qualified Date"}),r.jsx(Et,{children:"Discount"})]})}),r.jsx(Hs,{children:w.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):w.map(S=>{var C,A,E,T;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:((C=S.referrer_brokerage)==null?void 0:C.name)||"Unknown"}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((A=S.referred_brokerage)==null?void 0:A.name)||((E=S.referred_user)==null?void 0:E.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(T=S.referred_user)==null?void 0:T.email})]})}),r.jsx(vt,{children:fn(new Date(S.signup_date),"MMM d, yyyy")}),r.jsx(vt,{children:j(S.status)}),r.jsx(vt,{children:S.qualified_date?fn(new Date(S.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(vt,{children:S.discount_applied?r.jsx(Ft,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},S.id)})})]})]})]})]})})}const Oce=[{value:"add_agent",label:"Add Agent"},{value:"share_resource",label:"Share Resource"},{value:"post_community",label:"Post in Community"},{value:"register_event",label:"Register for Event"},{value:"view_template",label:"View Template"},{value:"watch_academy",label:"Watch Academy Video"},{value:"use_toolbox",label:"Use Toolbox"},{value:"launch_app",label:"Launch App"},{value:"add_contact",label:"Add Contact"},{value:"add_plan",label:"Add Touchpoint Plan"},{value:"create_video",label:"Create Video"},{value:"complete_touch",label:"Complete Touch"},{value:"add_transaction",label:"Add Transaction"},{value:"add_listing",label:"Add Listing"},{value:"schedule_popby",label:"Schedule Pop-by"}],ujt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function hjt(){const[e,t]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[l,a]=P.useState(null),[h,p]=P.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});P.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:T,error:O}=await ee.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(O)throw O;t(T||[])}catch(T){console.error("Error fetching checklist items:",T),ze.error("Failed to load checklist items")}finally{s(!1)}},y=()=>{a(null),p({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},w=T=>{a(T),p({title:T.title,description:T.description||"",action_type:T.action_type,target_role:T.target_role,is_active:T.is_active}),o(!0)},j=async()=>{if(!h.title.trim()){ze.error("Title is required");return}try{if(l){const{error:T}=await ee.from("onboarding_checklist_items").update({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active}).eq("id",l.id);if(T)throw T;ze.success("Checklist item updated")}else{const T=e.filter(z=>z.target_role===h.target_role).reduce((z,F)=>Math.max(z,F.sort_order),-1),{error:O}=await ee.from("onboarding_checklist_items").insert({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active,sort_order:T+1});if(O)throw O;ze.success("Checklist item created")}o(!1),x()}catch(T){console.error("Error saving checklist item:",T),ze.error("Failed to save checklist item")}},S=async T=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:O}=await ee.from("onboarding_checklist_items").delete().eq("id",T);if(O)throw O;ze.success("Checklist item deleted"),x()}catch(O){console.error("Error deleting checklist item:",O),ze.error("Failed to delete checklist item")}},C=async T=>{try{const{error:O}=await ee.from("onboarding_checklist_items").update({is_active:!T.is_active}).eq("id",T.id);if(O)throw O;ze.success(T.is_active?"Item deactivated":"Item activated"),x()}catch(O){console.error("Error toggling item:",O),ze.error("Failed to update item")}},A=e.filter(T=>T.target_role==="brokerage_manager"),E=e.filter(T=>T.target_role==="agent");return r.jsxs(Or,{title:"Onboarding Checklist",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Onboarding Checklist"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage checklist items shown to new users on their dashboard"})]}),r.jsxs(J,{onClick:y,className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ft,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(Xe,{children:A.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-12",children:"#"}),r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Action Type"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:A.map((T,O)=>{var z;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"text-muted-foreground",children:O+1}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(vt,{children:r.jsx(Ft,{variant:"outline",children:((z=Oce.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(vt,{children:r.jsx($s,{checked:T.is_active,onCheckedChange:()=>C(T)})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>w(T),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>S(T.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ft,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(Xe,{children:E.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-12",children:"#"}),r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Action Type"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:E.map((T,O)=>{var z;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"text-muted-foreground",children:O+1}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(vt,{children:r.jsx(Ft,{variant:"outline",children:((z=Oce.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(vt,{children:r.jsx($s,{checked:T.is_active,onCheckedChange:()=>C(T)})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>w(T),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>S(T.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:l?"Edit Checklist Item":"Add Checklist Item"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title *"}),r.jsx(ct,{id:"title",value:h.title,onChange:T=>p({...h,title:T.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",value:h.description,onChange:T=>p({...h,description:T.target.value}),placeholder:"Optional description for the checklist item",rows:2})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Target Role"}),r.jsxs(bn,{value:h.target_role,onValueChange:T=>p({...h,target_role:T}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:ujt.map(T=>r.jsx(Kt,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Action Type"}),r.jsxs(bn,{value:h.action_type,onValueChange:T=>p({...h,action_type:T}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:Oce.map(T=>r.jsx(Kt,{value:T.value,children:T.label},T.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"is_active",checked:h.is_active,onCheckedChange:T=>p({...h,is_active:T})}),r.jsx(Ve,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(J,{onClick:j,children:l?"Save Changes":"Create Item"})]})]})})]})}function fjt(){const[e,t]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState("name"),[l,a]=P.useState("asc"),[h,p]=P.useState(""),[x,y]=P.useState(""),[w,j]=P.useState(""),[S,C]=P.useState(""),{data:A}=Jt({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:Z,error:re}=await ee.from("brokerages").select("id, name").order("name");if(re)throw re;return Z}}),E=async Z=>{let ue=[],he=0,be=!0;for(;be;){const{data:ne,error:ye}=await Z(he,he+1e3-1);if(ye)throw ye;ne&&ne.length>0?(ue=[...ue,...ne],he+=1e3,be=ne.length===1e3):be=!1}return ue},{data:T,isLoading:O}=Jt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const Z=await E((ke,pe)=>ee.from("profiles").select("id, name, email, brokerage_id, created_at").range(ke,pe)),{data:re}=await ee.from("brokerages").select("id, name"),ue=new Map((re==null?void 0:re.map(ke=>[ke.id,ke.name]))||[]),{data:he}=await ee.rpc("get_admin_contact_counts"),be=new Map;he==null||he.forEach(ke=>{be.set(ke.owner_user_id,ke.contact_count)});const{data:ne}=await ee.rpc("get_admin_video_counts"),ye=new Map;ne==null||ne.forEach(ke=>{ye.set(ke.owner_user_id,ke.video_count)});const{data:ie}=await ee.rpc("get_admin_popby_counts"),fe=new Map;ie==null||ie.forEach(ke=>{fe.set(ke.owner_user_id,ke.popby_count)});const{data:de}=await ee.rpc("get_admin_listing_counts"),_e=new Map;return de==null||de.forEach(ke=>{_e.set(ke.agent_id,ke.listing_count)}),Z.map(ke=>({id:ke.id,name:ke.name||"Unknown",email:ke.email||"",brokerage_id:ke.brokerage_id,brokerage_name:ke.brokerage_id&&ue.get(ke.brokerage_id)||null,contact_count:be.get(ke.id)||0,video_count:ye.get(ke.id)||0,popby_count:fe.get(ke.id)||0,listing_count:_e.get(ke.id)||0,created_at:ke.created_at}))}}),z=P.useMemo(()=>{if(!T)return[];let Z=T.filter(re=>{const ue=e.toLowerCase(),he=!e||re.name.toLowerCase().includes(ue)||re.email.toLowerCase().includes(ue),be=n==="all"||n==="none"&&!re.brokerage_id||re.brokerage_id===n,ne=parseInt(h)||0,ye=parseInt(x)||0,ie=parseInt(w)||0,fe=parseInt(S)||0,de=re.contact_count>=ne&&re.video_count>=ye&&re.popby_count>=ie&&re.listing_count>=fe;return he&&be&&de});return Z.sort((re,ue)=>{let he=0;return i==="name"?he=re.name.localeCompare(ue.name):he=re[i]-ue[i],l==="asc"?he:-he}),Z},[T,e,n,i,l,h,x,w,S]),F=Z=>{i===Z?a(l==="asc"?"desc":"asc"):(o(Z),a("desc"))},q=()=>{const Z=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings"],re=z.map(ye=>[ye.name,ye.email,ye.brokerage_name||"None",ye.contact_count,ye.video_count,ye.popby_count,ye.listing_count]),ue=[Z.join(","),...re.map(ye=>ye.map(ie=>`"${ie}"`).join(","))].join(` `),he=new Blob([ue],{type:"text/csv"}),be=URL.createObjectURL(he),ne=document.createElement("a");ne.href=be,ne.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ne.click(),URL.revokeObjectURL(be)},H=P.useMemo(()=>z.length?z.reduce((Z,re)=>({contacts:Z.contacts+re.contact_count,videos:Z.videos+re.video_count,popbys:Z.popbys+re.popby_count,listings:Z.listings+re.listing_count}),{contacts:0,videos:0,popbys:0,listings:0}):{contacts:0,videos:0,popbys:0,listings:0},[z]),K=({field:Z,children:re})=>r.jsx(Et,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>F(Z),children:r.jsxs("div",{className:"flex items-center gap-1",children:[re,r.jsx(zx,{className:`h-3 w-3 ${i===Z?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(En,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:q,children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name or email...",value:e,onChange:Z=>t(Z.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(bn,{value:n,onValueChange:s,children:[r.jsxs(vn,{children:[r.jsx(na,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(wn,{placeholder:"Brokerage"})]}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Brokerages"}),r.jsx(Kt,{value:"none",children:"No Brokerage"}),A==null?void 0:A.map(Z=>r.jsx(Kt,{value:Z.id,children:Z.name},Z.id))]})]})}),r.jsx("div",{children:r.jsx(ct,{type:"number",placeholder:"Min contacts",value:h,onChange:Z=>p(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(ct,{type:"number",placeholder:"Min videos",value:x,onChange:Z=>y(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(ct,{type:"number",placeholder:"Min popbys",value:w,onChange:Z=>j(Z.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-5 text-sm",children:[r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:z.length}),r.jsx("div",{className:"text-muted-foreground",children:"Users"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.contacts.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Contacts"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.videos.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Videos"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.popbys.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Popbys"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.listings.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]})]}),O?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(K,{field:"name",children:"Name"}),r.jsx(Et,{children:"Email"}),r.jsx(Et,{children:"Brokerage"}),r.jsx(K,{field:"contact_count",children:"Contacts"}),r.jsx(K,{field:"video_count",children:"Videos"}),r.jsx(K,{field:"popby_count",children:"Popbys"}),r.jsx(K,{field:"listing_count",children:"Listings"})]})}),r.jsx(Hs,{children:z.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):z.map(Z=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:Z.name}),r.jsx(vt,{className:"text-muted-foreground",children:Z.email}),r.jsx(vt,{children:Z.brokerage_name?r.jsx(Ft,{variant:"secondary",children:Z.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(vt,{children:r.jsx(Ft,{variant:Z.contact_count>0?"default":"outline",children:Z.contact_count})}),r.jsx(vt,{children:r.jsx(Ft,{variant:Z.video_count>0?"default":"outline",children:Z.video_count})}),r.jsx(vt,{children:r.jsx(Ft,{variant:Z.popby_count>0?"default":"outline",children:Z.popby_count})}),r.jsx(vt,{children:r.jsx(Ft,{variant:Z.listing_count>0?"default":"outline",children:Z.listing_count})})]},Z.id))})]})})]})]})}function pjt(){pa(),Wr();const[e,t]=P.useState("user-analytics"),{data:n}=Jt({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:j,error:S}=await ee.from("feature_flags").select("*").order("key");if(S)throw S;return j}}),{data:s,isLoading:i}=Jt({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:j,error:S}=await ee.from("relationship_types").select("*").order("sort_order");if(S)throw S;return j}}),{data:o,isLoading:l}=Jt({queryKey:["admin-action-types"],queryFn:async()=>{const{data:j,error:S}=await ee.from("action_types").select("*").order("sort_order");if(S)throw S;return j}}),{data:a,isLoading:h}=Jt({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:j,error:S}=await ee.from("action_scripts").select("*, action_type:action_types(*)");if(S)throw S;return j}}),{data:p,isLoading:x}=Jt({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:j,error:S}=await ee.from("touchpoint_plans").select("*").order("name");if(S)throw S;return j}}),{data:y,isLoading:w}=Jt({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:j,error:S}=await ee.from("popby_items").select("*").is("owner_user_id",null).order("name");if(S)throw S;return j}});return r.jsx(Or,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(ba,{value:e,onValueChange:t,children:[r.jsxs(fa,{className:"grid w-full grid-cols-9",children:[r.jsxs(ln,{value:"user-analytics",className:"gap-2",children:[r.jsx(ac,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(ln,{value:"relationship-types",className:"gap-2",children:[r.jsx(Kn,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(ln,{value:"action-types",className:"gap-2",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(ln,{value:"scripts",className:"gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(ln,{value:"video-scripts",className:"gap-2",children:[r.jsx(Md,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(ln,{value:"plans",className:"gap-2",children:[r.jsx(Ys,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(ln,{value:"popbys",className:"gap-2",children:[r.jsx(Va,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(ln,{value:"settings",className:"gap-2",children:[r.jsx(hd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(ln,{value:"feature-flags",className:"gap-2",children:[r.jsx(Bx,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx(An,{value:"user-analytics",className:"mt-6",children:r.jsx(fjt,{})}),r.jsx(An,{value:"relationship-types",className:"mt-6",children:r.jsx(mjt,{types:s||[],isLoading:i})}),r.jsx(An,{value:"action-types",className:"mt-6",children:r.jsx(gjt,{types:o||[],isLoading:l})}),r.jsx(An,{value:"scripts",className:"mt-6",children:r.jsx(xjt,{scripts:a||[],actionTypes:o||[],isLoading:h})}),r.jsx(An,{value:"video-scripts",className:"mt-6",children:r.jsx(bjt,{})}),r.jsx(An,{value:"plans",className:"mt-6",children:r.jsx(yjt,{plans:p||[],actionTypes:o||[],scripts:a||[],isLoading:x})}),r.jsx(An,{value:"popbys",className:"mt-6",children:r.jsx(_jt,{items:y||[],isLoading:w})}),r.jsx(An,{value:"settings",className:"mt-6",children:r.jsx(wjt,{})}),r.jsx(An,{value:"feature-flags",className:"mt-6",children:r.jsx(vjt,{flags:n||[]})})]})]})})}function mjt({types:e,isLoading:t}){const{toast:n}=pa(),s=Wr(),[i,o]=P.useState(null),[l,a]=P.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await ee.from("relationship_types").update({name:x.name,description:x.description,icon:x.icon}).eq("id",x.id);if(y)throw y}else{const{error:y}=await ee.from("relationship_types").insert([{name:x.name,description:x.description,icon:x.icon,sort_order:e.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-relationship-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await ee.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Relationship Types"}),r.jsx(En,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(J,{onClick:()=>{o(null),a(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-12"}),r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"w-24",children:"Actions"})]})}),r.jsx(Hs,{children:e.map(x=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsx(pj,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(vt,{className:"font-medium",children:x.name}),r.jsx(vt,{className:"text-muted-foreground",children:x.description}),r.jsx(vt,{children:r.jsx($s,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(vt,{children:r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{o(x),a(!0)},children:r.jsx(ha,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[i?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:i==null?void 0:i.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"icon",children:"Icon"}),r.jsx(ct,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function gjt({types:e,isLoading:t}){const{toast:n}=pa(),s=Wr(),[i,o]=P.useState(null),[l,a]=P.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await ee.from("action_types").update({name:x.name,description:x.description,icon:x.icon,color:x.color}).eq("id",x.id);if(y)throw y}else{const{error:y}=await ee.from("action_types").insert([{name:x.name,description:x.description,icon:x.icon,color:x.color,sort_order:e.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-action-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await ee.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Action Types"}),r.jsx(En,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(J,{onClick:()=>{o(null),a(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{children:"Color"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"w-24",children:"Actions"})]})}),r.jsx(Hs,{children:e.map(x=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:x.name}),r.jsx(vt,{className:"text-muted-foreground",children:x.description}),r.jsx(vt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(vt,{children:r.jsx($s,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(vt,{children:r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{o(x),a(!0)},children:r.jsx(ha,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[i?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:i==null?void 0:i.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon"),color:y.get("color")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"icon",children:"Icon"}),r.jsx(ct,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"color",children:"Color"}),r.jsx(ct,{id:"color",name:"color",type:"color",defaultValue:(i==null?void 0:i.color)||"#6366f1"})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function xjt({scripts:e,actionTypes:t,isLoading:n}){const{toast:s}=pa(),i=Wr(),[o,l]=P.useState(null),[a,h]=P.useState(!1),p=cr({mutationFn:async y=>{if(y.id){const{error:w}=await ee.from("action_scripts").update({title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:y.active}).eq("id",y.id);if(w)throw w}else{const{error:w}=await ee.from("action_scripts").insert([{title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:!0}]);if(w)throw w}},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),h(!1),l(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),x=cr({mutationFn:async y=>{const{error:w}=await ee.from("action_scripts").delete().eq("id",y);if(w)throw w},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Script Library"}),r.jsx(En,{children:"Create and manage scripts for each action type"})]}),r.jsxs(J,{onClick:()=>{l(null),h(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Xe,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Action Type"}),r.jsx(Et,{children:"Tone"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"w-24",children:"Actions"})]})}),r.jsx(Hs,{children:e.map(y=>{var w;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:y.title}),r.jsx(vt,{children:r.jsx(Ft,{variant:"outline",children:((w=y.action_type)==null?void 0:w.name)||"Unknown"})}),r.jsx(vt,{className:"text-muted-foreground",children:y.tone}),r.jsx(vt,{children:r.jsx(Ft,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(vt,{className:"flex gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{l(y),h(!0)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const w=new FormData(y.currentTarget);p.mutate({id:o==null?void 0:o.id,title:w.get("title"),action_type_id:w.get("action_type_id"),tone:w.get("tone"),script_body:w.get("script_body"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"title",children:"Title"}),r.jsx(ct,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(bn,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select action type"})}),r.jsx(_n,{children:t.map(y=>r.jsx(Kt,{value:y.id,children:y.name},y.id))})]})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(ct,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ms,{id:"script_body",name:"script_body",defaultValue:o==null?void 0:o.script_body,rows:8,required:!0,placeholder:`Use {{FirstName}}, {{LastName}}, and {{AgentName}} as placeholders. Example: Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in...`})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:p.isPending,children:[p.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function yjt({plans:e,actionTypes:t,scripts:n,isLoading:s}){const{toast:i}=pa(),o=Wr(),[l,a]=P.useState(null),[h,p]=P.useState(!1),[x,y]=P.useState(null),[w,j]=P.useState(!1),[S,C]=P.useState(null),[A,E]=P.useState(null),{data:T}=Jt({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:Z,error:re}=await ee.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(re)throw re;return Z},enabled:!!x}),O=cr({mutationFn:async Z=>{if(Z.id){const{error:re}=await ee.from("touchpoint_plans").update({name:Z.name,description:Z.description,active:Z.active}).eq("id",Z.id);if(re)throw re}else{const{error:re}=await ee.from("touchpoint_plans").insert([{name:Z.name,description:Z.description,active:!0}]);if(re)throw re}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),p(!1),a(null),i({title:"Saved successfully"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),z=cr({mutationFn:async Z=>{if(Z.id){const{error:re}=await ee.from("touchpoint_plan_items").update({action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}).eq("id",Z.id);if(re)throw re}else{const{error:re}=await ee.from("touchpoint_plan_items").insert([{plan_id:Z.plan_id,month_number:Z.month_number,action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}]);if(re)throw re}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),i({title:"Item saved"})}}),F=cr({mutationFn:async Z=>{const{error:re}=await ee.from("touchpoint_plan_items").delete().eq("id",Z);if(re)throw re},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),q=cr({mutationFn:async Z=>{const{data:re,error:ue}=await ee.from("action_scripts").insert([{...Z,active:!0}]).select().single();if(ue)throw ue;return re},onSuccess:async Z=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),S&&await z.mutateAsync({id:S.itemId,plan_id:x,month_number:S.month,action_type_id:S.actionTypeId,default_script_id:Z.id}),j(!1),C(null),i({title:"Script created and assigned"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),H=(Z,re,ue)=>{C({month:Z,actionTypeId:re,itemId:ue}),j(!0)},K=Z=>n.find(re=>re.id===Z);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Touchpoint Plans"}),r.jsx(En,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(J,{onClick:()=>{a(null),p(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(Xe,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(Z=>r.jsxs(We,{className:`cursor-pointer transition-colors ${x===Z.id?"border-primary":""}`,onClick:()=>y(Z.id),children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xt,{className:"text-base",children:Z.name}),r.jsx(J,{variant:"ghost",size:"icon",onClick:re=>{re.stopPropagation(),a(Z),p(!0)},children:r.jsx(ha,{className:"h-4 w-4"})})]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:Z.description}),r.jsx(Ft,{variant:Z.active?"default":"secondary",className:"mt-2",children:Z.active?"Active":"Inactive"})]})]},Z.id))})})]}),x&&r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Plan Schedule"}),r.jsx(En,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(Xe,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(Z,re)=>re+1).map(Z=>{const re=T==null?void 0:T.find(be=>be.month_number===Z),ue=re!=null&&re.default_script_id?K(re.default_script_id):null,he=n.filter(be=>be.action_type_id===(re==null?void 0:re.action_type_id)&&be.active);return r.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"w-20 font-medium text-sm",children:["Month ",Z]}),r.jsxs(bn,{value:(re==null?void 0:re.action_type_id)||"none",onValueChange:be=>{be==="none"&&re?F.mutate(re.id):be!=="none"&&z.mutate({id:re==null?void 0:re.id,plan_id:x,month_number:Z,action_type_id:be,default_script_id:null})},children:[r.jsx(vn,{className:"w-40",children:r.jsx(wn,{placeholder:"No action"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"No action"}),t.filter(be=>be.active).map(be=>r.jsx(Kt,{value:be.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[be.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:be.color}}),be.name]})},be.id))]})]}),re&&r.jsxs(r.Fragment,{children:[r.jsxs(bn,{value:re.default_script_id||"none",onValueChange:be=>{E(null),z.mutate({id:re.id,default_script_id:be==="none"?null:be})},children:[r.jsx(vn,{className:"w-56",children:r.jsx(wn,{placeholder:"Select script"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"No default script"}),he.map(be=>r.jsxs(Kt,{value:be.id,children:[be.title," ",be.tone&&`(${be.tone})`]},be.id))]})]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>H(Z,re.action_type_id,re.id),children:[r.jsx(jn,{className:"h-3 w-3 mr-1"}),"New Script"]}),ue&&r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>E((A==null?void 0:A.id)===ue.id?null:ue),children:(A==null?void 0:A.id)===ue.id?"Hide":"Preview"})]})]}),A&&(re==null?void 0:re.default_script_id)===A.id&&r.jsxs("div",{className:"ml-24 p-3 bg-muted rounded-lg text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{variant:"outline",children:A.title}),A.tone&&r.jsx(Ft,{variant:"secondary",children:A.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:A.script_body})]})]},Z)})})})]}),r.jsx(Br,{open:h,onOpenChange:p,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const re=new FormData(Z.currentTarget);O.mutate({id:l==null?void 0:l.id,name:re.get("name"),description:re.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",name:"name",defaultValue:l==null?void 0:l.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:O.isPending,children:[O.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Br,{open:w,onOpenChange:j,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New Script"}),r.jsxs(es,{children:["Create a script for Month ",S==null?void 0:S.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const re=new FormData(Z.currentTarget);q.mutate({title:re.get("title"),action_type_id:S.actionTypeId,tone:re.get("tone"),script_body:re.get("script_body")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script_title",children:"Title"}),r.jsx(ct,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script_tone",children:"Tone"}),r.jsx(ct,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ms,{id:"script_body",name:"script_body",rows:6,required:!0,placeholder:"Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in..."})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:q.isPending,children:[q.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function vjt({flags:e}){const{toast:t}=pa(),n=Wr(),s=async(i,o)=>{const{error:l}=await ee.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",i.id);l?t({title:"Error",description:l.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),t({title:"Flag updated"}))};return r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Feature Flags"}),r.jsx(En,{children:"Control which features are enabled for members"})]}),r.jsx(Xe,{children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Flag"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{children:"Notes"}),r.jsx(Et,{children:"Last Updated"})]})}),r.jsx(Hs,{children:e.map(i=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-mono text-sm",children:i.key}),r.jsx(vt,{children:r.jsx($s,{checked:i.enabled,onCheckedChange:o=>s(i,{enabled:o})})}),r.jsx(vt,{children:r.jsx(ct,{defaultValue:i.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==i.notes&&s(i,{notes:o.target.value})}})}),r.jsx(vt,{className:"text-muted-foreground text-sm",children:new Date(i.updated_at).toLocaleDateString()})]},i.id))})]})})]})}function _jt({items:e,isLoading:t}){const{toast:n}=pa(),s=Wr(),[i,o]=P.useState(null),[l,a]=P.useState(!1),h=cr({mutationFn:async y=>{if(y.id){const{error:w}=await ee.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(w)throw w}else{const{error:w}=await ee.from("popby_items").insert([{name:y.name,description:y.description,owner_user_id:null}]);if(w)throw w}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),p=async y=>{await ee.from("popby_items").update({is_active:!y.is_active}).eq("id",y.id),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]})},x=async y=>{await ee.from("popby_items").delete().eq("id",y),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),n({title:"Deleted successfully"})};return r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Popby Ideas"}),r.jsx(En,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(J,{onClick:()=>{o(null),a(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Va,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No popby ideas yet. Add your first one!"})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"w-24",children:"Actions"})]})}),r.jsx(Hs,{children:e.map(y=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:y.name}),r.jsx(vt,{className:"text-muted-foreground",children:y.description}),r.jsx(vt,{children:r.jsx($s,{checked:y.is_active,onCheckedChange:()=>p(y)})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{o(y),a(!0)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[i?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const w=new FormData(y.currentTarget);h.mutate({id:i==null?void 0:i.id,name:w.get("name"),description:w.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function bjt(){var j;const{toast:e}=pa(),t=Wr(),[n,s]=P.useState(null),[i,o]=P.useState(!1),{data:l,isLoading:a}=Jt({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:S,error:C}=await ee.from("video_script_categories").select("*").order("sort_order");if(C)throw C;return S}}),{data:h,isLoading:p}=Jt({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:S,error:C}=await ee.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(C)throw C;return S}}),x=cr({mutationFn:async S=>{var C,A;if(S.id){const{error:E}=await ee.from("video_scripts").update({title:S.title,script_text:S.script_text,category_id:S.category_id,tags:((C=S.tags)==null?void 0:C.split(",").map(T=>T.trim()).filter(Boolean))||[]}).eq("id",S.id);if(E)throw E}else{const{error:E}=await ee.from("video_scripts").insert([{title:S.title,script_text:S.script_text,category_id:S.category_id||null,tags:((A=S.tags)==null?void 0:A.split(",").map(T=>T.trim()).filter(Boolean))||[]}]);if(E)throw E}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),s(null),e({title:"Video script saved!"})},onError:S=>e({title:"Error",description:S.message,variant:"destructive"})}),y=async S=>{await ee.from("video_scripts").update({is_active:!S.is_active}).eq("id",S.id),t.invalidateQueries({queryKey:["admin-video-scripts"]})},w=async S=>{confirm("Delete this video script?")&&(await ee.from("video_scripts").delete().eq("id",S),t.invalidateQueries({queryKey:["admin-video-scripts"]}),e({title:"Script deleted"}))};return r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Video Scripts"}),r.jsx(En,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(J,{onClick:()=>{s(null),o(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Xe,{children:p?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Title"}),r.jsx(Et,{children:"Category"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"w-24",children:"Actions"})]})}),r.jsx(Hs,{children:h==null?void 0:h.map(S=>{var C;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:S.title}),r.jsx(vt,{className:"text-muted-foreground",children:((C=S.category)==null?void 0:C.name)||"Uncategorized"}),r.jsx(vt,{children:r.jsx($s,{checked:S.is_active,onCheckedChange:()=>y(S)})}),r.jsxs(vt,{className:"flex gap-1",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>{s(S),o(!0)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>w(S.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]},S.id)})})]})}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:S=>{S.preventDefault();const C=new FormData(S.currentTarget);x.mutate({id:n==null?void 0:n.id,title:C.get("title"),script_text:C.get("script_text"),category_id:C.get("category_id")||null,tags:C.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"title",children:"Title"}),r.jsx(ct,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"category_id",children:"Category"}),r.jsxs(bn,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select category"})}),r.jsx(_n,{children:l==null?void 0:l.map(S=>r.jsx(Kt,{value:S.id,children:S.name},S.id))})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script_text",children:"Script Text"}),r.jsx(ms,{id:"script_text",name:"script_text",defaultValue:n==null?void 0:n.script_text,rows:6,required:!0,placeholder:"Enter the teleprompter script..."})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(ct,{id:"tags",name:"tags",defaultValue:((j=n==null?void 0:n.tags)==null?void 0:j.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function wjt(){const{toast:e}=pa(),[t,n]=P.useState(""),[s,i]=P.useState(!0),[o,l]=P.useState(!1);P.useEffect(()=>{(async()=>{i(!0);try{const{data:p}=await ee.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();p!=null&&p.value&&n(p.value)}catch(p){console.error("Error fetching settings:",p)}i(!1)})()},[]);const a=async()=>{l(!0);try{await ee.from("settings").upsert({key:"mapbox_public_token",value:t.trim()}),e({title:"Mapbox token saved!"})}catch{e({title:"Error saving token",variant:"destructive"})}l(!1)};return s?r.jsx(We,{children:r.jsx(Xe,{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(pl,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(En,{children:"Configure the map feature for popbys"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(ct,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:t,onChange:h=>n(h.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"}),". This token will be used by all agents for the popby map feature."]})]}),r.jsxs(J,{onClick:a,disabled:o,children:[o&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),t&&r.jsx(Ft,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const jjt=()=>{const[e,t]=P.useState(""),[n,s]=P.useState("grid"),i=ns(),{data:o=[],isLoading:l}=Jt({queryKey:["additional-services"],queryFn:async()=>{const{data:h,error:p}=await ee.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(p)throw p;return h}}),a=o.filter(h=>{var x;return h.name.toLowerCase().includes(e.toLowerCase())||((x=h.description)==null?void 0:x.toLowerCase().includes(e.toLowerCase()))});return r.jsx(Or,{title:"Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Additional Services"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Explore our additional services and offerings"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search services...",value:e,onChange:h=>t(h.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(J,{variant:"outline",size:"sm",onClick:()=>t(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(fm,{className:"h-4 w-4"})}),r.jsx(J,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(Hf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," service",a.length!==1?"s":""," found"]}),l&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(4)].map((h,p)=>r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"})]})},p))}),!l&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No services match your search":"No additional services available yet"}),e&&r.jsx(J,{variant:"outline",onClick:()=>t(""),children:"Clear Search"})]}),!l&&a.length>0&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(h=>r.jsxs(We,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>i(`/additional-services/${h.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:h.preview_image_url?r.jsx("img",{src:h.preview_image_url,alt:h.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Ss,{className:"h-8 w-8"})})}),r.jsxs(Xe,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:h.name}),h.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:Ane(h.description)})]})]},h.id))})]})})},kjt=()=>{const{serviceId:e}=Wc(),t=ns(),{data:n,isLoading:s}=Jt({queryKey:["additional-service",e],queryFn:async()=>{const{data:i,error:o}=await ee.from("additional_services").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;return i},enabled:!!e});return s?r.jsx(Or,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Pr,{className:"h-8 w-48"}),r.jsx(Pr,{className:"h-64 w-full rounded-lg"}),r.jsx(Pr,{className:"h-24 w-full"})]})}):n?r.jsx(Or,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(J,{variant:"ghost",onClick:()=>t("/additional-services"),className:"gap-2",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(We,{className:"overflow-hidden",children:r.jsx("div",{className:"relative bg-muted",children:n.preview_image_url?r.jsx("img",{src:n.preview_image_url,alt:n.name,className:"w-full h-auto max-h-[500px] object-contain mx-auto"}):r.jsx("div",{className:"w-full h-64 flex items-center justify-center text-muted-foreground",children:r.jsx(Ss,{className:"h-16 w-16"})})})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:n.name}),r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[r.jsx(Ys,{className:"h-4 w-4 mr-1"}),"Published ",fn(new Date(n.publish_date),"MMMM d, yyyy")]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:n.description}}),r.jsx("div",{className:"pt-4 border-t",children:r.jsxs(J,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Ls,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Or,{title:"Not Found",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center py-12",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Service Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"The service you're looking for doesn't exist or has been removed."}),r.jsxs(J,{onClick:()=>t("/additional-services"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},qM=[{id:"content-calendar",name:"Social Media Content Calendar Generator",iframe:``},{id:"property-promotion",name:"Property Promotion AI Tool",iframe:''},{id:"bio-boost",name:"Realtor Bio-Boost",iframe:''},{id:"market-report",name:"Market Report & Video Script Generator",iframe:''},{id:"property-description",name:"Property Description Writer",iframe:''},{id:"newsletter-generator",name:"Local Real Estate Newsletter Generator",iframe:''}];function Njt(){const[e,t]=P.useState(qM[0].id),n=qM.find(s=>s.id===e)||qM[0];return r.jsx(Or,{title:"AI Toolkit",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Q4,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"AI Toolkit"}),r.jsx("p",{className:"text-muted-foreground",children:"Powerful AI tools to boost your real estate business"})]})]}),r.jsx("div",{className:"md:hidden",children:r.jsxs(bn,{value:e,onValueChange:t,children:[r.jsx(vn,{className:"w-full",children:r.jsx(wn,{placeholder:"Select a tool"})}),r.jsx(_n,{children:qM.map(s=>r.jsx(Kt,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(ba,{value:e,onValueChange:t,className:"w-full",children:r.jsx(fa,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:qM.map(s=>r.jsx(ln,{value:s.id,className:"flex-1 min-w-[150px] text-xs lg:text-sm whitespace-normal h-auto py-2",children:s.name},s.id))})})}),r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-full max-w-[700px]",dangerouslySetInnerHTML:{__html:n.iframe}})})]})})}const u4e="agent-os-onboarding-completed",RL=[{icon:_g,iconColor:"text-white",bgGradient:"from-primary via-primary/80 to-purple-600",title:"Welcome to Agent OS",description:"You've unlocked a powerful new tool designed to help you build stronger relationships and close more deals. Agent OS is currently in beta, and we're excited for you to try it!",highlights:["Manage your most important relationships","Stay in touch with automated reminders","Track your transactions and goals","Maximize referrals from your sphere"]},{icon:jg,iconColor:"text-white",bgGradient:"from-pink-500 via-rose-500 to-red-500",title:"InnerCircle Home",description:"Your daily command center. See today's action items, track your momentum streak, and get a snapshot of your relationship health—all at a glance.",highlights:["Today's touchpoints and special dates","Momentum stats and streak tracking","Relationship health overview","Quick access to all features"]},{icon:Kn,iconColor:"text-white",bgGradient:"from-blue-500 via-indigo-500 to-purple-500",title:"Contacts",description:"Import and organize your sphere of influence. Tag contacts by relationship type (Top 25, Past Clients, Referral Partners, etc.) to prioritize your outreach.",highlights:["Import contacts via CSV","Tag by relationship type","Track birthdays and home anniversaries","See relationship health scores"]},{icon:um,iconColor:"text-white",bgGradient:"from-emerald-500 via-teal-500 to-cyan-500",title:"Touchpoint Plans",description:"Assign automated touchpoint schedules to your contact groups. Each plan tells you exactly who to reach out to and when—with pre-written scripts to make it easy.",highlights:["Pre-built 12-month plans","Create your own custom plans","Scripts for calls, texts, and emails","Automatic daily action items"]},{icon:Va,iconColor:"text-white",bgGradient:"from-orange-500 via-amber-500 to-yellow-500",title:"Popbys",description:"Pop-by visits are one of the most powerful ways to stay top-of-mind. Track your gift drop-offs and see who's due for a visit on the map.",highlights:["Track pop-by gift ideas","Set visit frequency by contact type","Log completed pop-bys","Map view for route planning"]},{icon:ac,iconColor:"text-white",bgGradient:"from-purple-500 via-violet-500 to-indigo-500",title:"Scorecard",description:"Track your transactions, set goals, and see your progress over time. Know exactly where your business stands and where your deals are coming from.",highlights:["Log buyer and seller transactions","Set and track annual goals","See your top lead sources","Export data for your records"]}],Sjt=()=>{const[e,t]=P.useState(!1),[n,s]=P.useState(0),[i,o]=P.useState(!1);P.useEffect(()=>{if(!localStorage.getItem(u4e)){const S=setTimeout(()=>t(!0),500);return()=>clearTimeout(S)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):h()},a=()=>{h()},h=()=>{localStorage.setItem(u4e,"true"),t(!1)},p=RL[n],x=p.icon,y=n===RL.length-1,w=j=>{j||h(),t(j)};return r.jsx(Br,{open:e,onOpenChange:w,children:r.jsxs(Fr,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[r.jsxs("div",{className:`relative bg-gradient-to-br ${p.bgGradient} p-8 pb-12 transition-all duration-500`,children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[r.jsx("div",{className:"absolute -top-4 -right-4 w-32 h-32 bg-white/10 rounded-full blur-2xl animate-pulse"}),r.jsx("div",{className:"absolute -bottom-8 -left-8 w-40 h-40 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl"})]}),r.jsxs("div",{className:`relative mx-auto flex h-20 w-20 items-center justify-center transition-all duration-300 ${i?"scale-75 opacity-0":"scale-100 opacity-100"}`,children:[r.jsx("div",{className:"absolute inset-0 bg-white/20 rounded-2xl blur-xl"}),r.jsx("div",{className:"relative flex h-20 w-20 items-center justify-center rounded-2xl bg-white/20 backdrop-blur-sm border border-white/30 shadow-2xl",children:r.jsx(x,{className:`h-10 w-10 ${p.iconColor} drop-shadow-lg`})})]}),n===0&&r.jsxs("div",{className:"absolute top-4 right-4 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm border border-white/30 text-white text-xs font-medium flex items-center gap-1.5",children:[r.jsx(Ss,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(Hr,{className:"text-center sm:text-center pb-2",children:[r.jsx(qr,{className:`text-2xl font-bold transition-all duration-300 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.title}),r.jsx(es,{className:`text-base pt-2 transition-all duration-300 delay-75 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.description})]}),p.highlights&&r.jsx("div",{className:`space-y-2.5 py-4 transition-all duration-300 delay-100 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.highlights.map((j,S)=>r.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+S*50}ms`},children:[r.jsx("div",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gradient-to-br ${p.bgGradient} shadow-sm`,children:r.jsx(Ca,{className:"h-3.5 w-3.5 text-white"})}),r.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:j})]},S))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:RL.map((j,S)=>r.jsx("button",{onClick:()=>{S!==n&&(o(!0),setTimeout(()=>{s(S),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${S===n?"w-8 bg-gradient-to-r "+p.bgGradient:S{const{user:e}=zr();return Jt({queryKey:["contact-snoozes",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return t},enabled:!!e})},Mjt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({contactId:n,days:s})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const i=Vl(new Date,s);await ee.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await ee.from("contact_snoozes").insert({contact_id:n,owner_user_id:t.id,snoozed_until:i.toISOString()});if(o)throw o},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),e.invalidateQueries({queryKey:["popby-logs"]}),$i({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{$i({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},Tjt=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("contact_snoozes").delete().eq("contact_id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),$i({title:"Snooze cancelled"})},onError:t=>{$i({title:"Error cancelling snooze",description:t.message,variant:"destructive"})}})},Ajt=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function wye({open:e,onOpenChange:t,contactId:n,contactName:s}){const[i,o]=P.useState(null),l=Mjt(),a=async()=>{i&&(await l.mutateAsync({contactId:n,days:i}),o(null),t(!1))},h=p=>fn(Vl(new Date,p),"MMM d, yyyy");return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(es,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:Ajt.map(p=>r.jsxs("button",{type:"button",onClick:()=>o(p.days),className:$t("w-full flex items-center justify-between p-3 rounded-lg border transition-colors",i===p.days?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50"),children:[r.jsx("span",{className:"font-medium",children:p.label}),r.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Ys,{className:"h-3.5 w-3.5"}),"Until ",h(p.days)]})]},p.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(J,{onClick:a,disabled:!i||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const Ejt={Crown:o1,FileText:Ai,Users:Kn,Globe:Ux,Star:vs,Phone:ca,MessageSquare:Po,PenTool:xj,Video:Fi,Gift:Va};function Ijt({actions:e,onMarkComplete:t,onViewScript:n,isLoading:s,buildSmsLink:i,buildEmailLink:o}){const l=ns(),[a,h]=P.useState("name"),[p,x]=P.useState("asc"),[y,w]=P.useState(null),[j,S]=P.useState(""),C=z=>{a===z?x(F=>F==="asc"?"desc":"asc"):(h(z),x("asc"))},A=P.useMemo(()=>[...e].sort((z,F)=>{var H,K;let q=0;switch(a){case"name":{const Z=`${z.contact.first_name} ${z.contact.last_name||""}`.toLowerCase(),re=`${F.contact.first_name} ${F.contact.last_name||""}`.toLowerCase();q=Z.localeCompare(re);break}case"relationship_type":q=(z.relationshipTypeName||"").localeCompare(F.relationshipTypeName||"");break;case"action_type":q=(((H=z.actionType)==null?void 0:H.name)||"").localeCompare(((K=F.actionType)==null?void 0:K.name)||"");break;case"last_touch":q=(z.monthNumber||0)-(F.monthNumber||0);break}return p==="asc"?q:-q}),[e,a,p]),E=z=>Ejt[z||"Phone"]||ca,T=({field:z,children:F})=>r.jsxs(J,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>C(z),children:[F,a===z?p==="asc"?r.jsx(yg,{className:"ml-2 h-4 w-4"}):r.jsx(n1,{className:"ml-2 h-4 w-4"}):r.jsx(zx,{className:"ml-2 h-4 w-4 opacity-50"})]}),O=(z,F,q)=>{w(z),S(`${F} ${q||""}`.trim())};return e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{className:"bg-muted/50",children:[r.jsx(Et,{className:"w-[180px]",children:r.jsx(T,{field:"name",children:"Contact"})}),r.jsx(Et,{className:"w-[130px]",children:r.jsx(T,{field:"relationship_type",children:"Type"})}),r.jsx(Et,{className:"w-[120px]",children:r.jsx(T,{field:"action_type",children:"Action"})}),r.jsx(Et,{className:"w-[130px]",children:"Phone"}),r.jsx(Et,{className:"w-[200px]",children:"Quick Actions"})]})}),r.jsx(Hs,{children:A.map((z,F)=>{var ue,he,be,ne,ye,ie;const q=z.isSpecialDate,H=z.specialDateType,K=q?H==="birthday"?Gh:fi:E(((ue=z.actionType)==null?void 0:ue.icon)||null),Z=z.contact.phone,re=z.contact.email;return r.jsxs(Ir,{className:$t("hover:bg-muted/50 transition-colors",q&&H==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",q&&H==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(vt,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>l(`/mission-control/contacts/${z.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[z.contact.first_name," ",z.contact.last_name]})})}),r.jsx(vt,{children:z.relationshipTypeName?r.jsx(Ft,{variant:"secondary",className:"text-xs",children:z.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(vt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:q?r.jsx(Ft,{className:$t("gap-1",H==="birthday"&&"bg-pink-500 hover:bg-pink-600",H==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:H==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(Gh,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(fi,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(K,{className:"h-3 w-3"}),(he=z.actionType)==null?void 0:he.name]})})}),r.jsx(vt,{children:Z?r.jsx("span",{className:"text-sm font-mono",children:z.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[Z&&r.jsx("a",{href:`tel:${z.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(ca,{className:"h-3.5 w-3.5"})}),Z&&r.jsx("a",{href:i(z.contact.phone,(be=z.script)==null?void 0:be.script_body,z.contact),className:"p-1.5 rounded bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 transition-colors",title:"Text",children:r.jsx(Po,{className:"h-3.5 w-3.5"})}),re&&r.jsx("a",{href:o(z.contact.email,(ne=z.script)==null?void 0:ne.script_body,(ye=z.script)==null?void 0:ye.email_subject,(ie=z.actionType)==null?void 0:ie.name,z.contact),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Email",children:r.jsx(Zs,{className:"h-3.5 w-3.5"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>O(z.contact.id,z.contact.first_name,z.contact.last_name),title:"Snooze",children:r.jsx(Xh,{className:"h-3.5 w-3.5"})}),r.jsxs(J,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var fe;return t(z.contact.id,z.actionType.id,(fe=z.script)==null?void 0:fe.id)},disabled:s,children:[r.jsx(Za,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${z.contact.id}-${F}`)})})]})}),r.jsx(wye,{open:!!y,onOpenChange:z=>!z&&w(null),contactId:y||"",contactName:j})]})}const h4e={Crown:o1,FileText:Ai,Users:Kn,Globe:Ux,Star:vs,Phone:ca,MessageSquare:Po,PenTool:xj,Video:Fi,Gift:Va},Pjt={"Top 25":"bg-primary text-primary-foreground","Past Client":"bg-sky-500 text-white","Referral Partner":"bg-orange-500 text-white",Sphere:"bg-emerald-500 text-white",VIP:"bg-amber-500 text-white"};function Ljt(){const e=ns(),{user:t}=zr(),{data:n}=Bg(),{data:s}=fOe(),{data:i}=op(),{data:o}=bxe(),{data:l}=bOe(),a=Gft(),h=_Oe(),p=Hft(90),x=xOe(),[y,w]=P.useState(null),[j,S]=P.useState(null),[C,A]=P.useState(!1),[E,T]=P.useState(""),[O,z]=P.useState(!1),[F,q]=P.useState(""),[H,K]=P.useState(vte()),[Z,re]=P.useState("cards"),ue=()=>{const Ce=parseInt(F,10);if(isNaN(Ce)||Ce<1){$i({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}K(Ce),vOe(Ce),z(!1),$i({title:"Goal updated",description:`Weekly touch goal set to ${Ce}`})},he=()=>{q(H.toString()),z(!0)};P.useEffect(()=>{(async()=>{if(!(t!=null&&t.id))return;const{data:Je}=await ee.from("profiles").select("name").eq("id",t.id).single();Je!=null&&Je.name&&T(Je.name.split(" ")[0])})()},[t==null?void 0:t.id]),P.useEffect(()=>{a.mutate()},[]);const be=af(new Date),ne=Vl(be,7),ye=Ce=>{if(!Ce)return null;const Je=new Date(Ce);return new Date(be.getFullYear(),Je.getMonth(),Je.getDate())},ie=(i==null?void 0:i.filter(Ce=>{const Je=ye(Ce.birthday),Te=ye(Ce.home_anniversary);return Je&&Kl(Je,be)||Te&&Kl(Te,be)}))||[],fe=(i==null?void 0:i.filter(Ce=>{if(!Ce.birthday&&!Ce.home_anniversary)return!1;const Je=Te=>{if(!Te)return!1;const Ye=ye(Te);return Ye?mte(Ye,be)&&gse(Ye,ne):!1};return Je(Ce.birthday)||Je(Ce.home_anniversary)}).slice(0,5))||[],de=ie.map(Ce=>{var xe,mt,et;const Je=ye(Ce.birthday),Te=Je&&Kl(Je,be),Ye=(o==null?void 0:o.find(nt=>nt.name==="Call"))||(o==null?void 0:o[0]);return{contact:Ce,actionType:Ye||{id:"special-date",name:Te?"Birthday Call":"Anniversary Call",icon:Te?"Cake":"Home",color:Te?"#EC4899":"#8B5CF6",description:Te?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Te?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((et=(mt=(xe=Ce.tags)==null?void 0:xe[0])==null?void 0:mt.relationship_type)==null?void 0:et.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Te?"birthday":"anniversary"}}),Ee=l!==void 0?l||[]:(i==null?void 0:i.slice(0,5).map((Ce,Je)=>{var Ye,xe,mt;const Te=o==null?void 0:o[Je%((o==null?void 0:o.length)||1)];return Te?{contact:Ce,actionType:Te,planName:"Quick Touch",relationshipTypeName:((mt=(xe=(Ye=Ce.tags)==null?void 0:Ye[0])==null?void 0:xe.relationship_type)==null?void 0:mt.name)||"",monthNumber:0}:null}).filter(Boolean))||[],ke=[...de,...Ee],pe=async(Ce,Je,Te)=>{await x.mutateAsync({contactId:Ce,actionTypeId:Je,scriptUsedId:Te}),A(!1),S(null)},ae=Ce=>{Ce.script?(S(Ce),A(!0)):pe(Ce.contact.id,Ce.actionType.id)},ge=Ce=>h4e[Ce||"Phone"]||ca,Me=Ce=>h4e[Ce||"Users"]||Kn,Ue=(Ce,Je)=>Ce.replace(/\{\{FirstName\}\}/g,Je.first_name).replace(/\{\{LastName\}\}/g,Je.last_name||"").replace(/\{\{AgentName\}\}/g,E||"there"),Ie=(Ce,Je)=>({Call:`Thinking of you, ${Je}!`,Text:`Quick hello, ${Je}`,Email:`Checking in, ${Je}`,"Handwritten Note":`A note for ${Je}`,Video:`Video message for ${Je}`,Gift:`Something special for you, ${Je}`})[Ce]||`Hello ${Je}!`,Ke=(Ce,Je,Te)=>{const Ye=`sms:${Ce}`;if(Je&&Te){const xe=Ue(Je,Te);return`${Ye}?body=${encodeURIComponent(xe)}`}return Ye},Re=(Ce,Je,Te,Ye,xe)=>{const mt=`mailto:${Ce}`,et=[];if(xe){const nt=Te||Ie(Ye||"Email",xe.first_name);if(et.push(`subject=${encodeURIComponent(nt)}`),Je){const Ae=Ue(Je,xe);et.push(`body=${encodeURIComponent(Ae)}`)}}return et.length>0?`${mt}?${et.join("&")}`:mt};return r.jsxs(Or,{title:"Mission Control",description:"Your relationship-first contact system",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Mission Control"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Your Sphere"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:n==null?void 0:n.filter(Ce=>Ce.active).map(Ce=>{const Je=Me(Ce.icon),Te=(s==null?void 0:s[Ce.id])||0,Ye=y===Ce.id,xe=Pjt[Ce.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{Ye?(w(null),e("/mission-control/contacts")):(w(Ce.id),e(`/mission-control/contacts?type=${Ce.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Ye?xe:"bg-card hover:bg-accent"} `,children:[r.jsx(Je,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:Ce.name}),r.jsxs("div",{className:`text-sm ${Ye?"opacity-90":"text-muted-foreground"}`,children:[Te," Contacts"]})]})]},Ce.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(J,{onClick:()=>e("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Md,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(J,{onClick:()=>e("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Ga,{className:"h-4 w-4 ml-1"})]}),r.jsx(J,{variant:"outline",onClick:()=>e("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(J,{variant:"outline",onClick:()=>e("/mission-control/plans"),className:"w-full",children:"Manage Plans"})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Today in Your InnerCircle"}),l!==void 0&&r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(Ss,{className:"h-3 w-3"}),"Plan-based"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-1 border rounded-lg p-0.5",children:[r.jsx(J,{variant:Z==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>re("cards"),title:"Card view",children:r.jsx(fm,{className:"h-4 w-4"})}),r.jsx(J,{variant:Z==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>re("table"),title:"Table view",children:r.jsx(Hf,{className:"h-4 w-4"})})]})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:ke.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."}),r.jsx(J,{variant:"outline",className:"mt-4",onClick:()=>e("/mission-control/plans"),children:"Manage Plans"})]}):Z==="table"?r.jsx(Ijt,{actions:ke,onMarkComplete:pe,onViewScript:ae,isLoading:x.isPending,buildSmsLink:Ke,buildEmailLink:Re}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[ke.map((Ce,Je)=>{var pt,Be,Qe,tt,ht,wt,Ct;const Te=Ce.isSpecialDate,Ye=Ce.specialDateType,xe=Te?Ye==="birthday"?Gh:fi:ge(((pt=Ce.actionType)==null?void 0:pt.icon)||null),mt=Ce.contact.phone,et=Ce.contact.email,nt=Te?Ye==="birthday"?"#EC4899":"#8B5CF6":((Be=Ce.actionType)==null?void 0:Be.color)||"#3B82F6",Ae=Te?Ye==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Qe=Ce.actionType)==null?void 0:Qe.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Te?"ring-2 ring-offset-2":""}`,style:Te?{"--tw-ring-color":nt}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:nt},children:[r.jsx(xe,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:Ae})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>e(`/mission-control/contacts/${Ce.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[Ce.contact.first_name," ",Ce.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[mt&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${Ce.contact.phone}`,className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-primary/10 hover:bg-primary/20 text-primary rounded text-xs font-medium transition-colors",title:"Call",children:[r.jsx(ca,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:Ke(Ce.contact.phone,(tt=Ce.script)==null?void 0:tt.script_body,Ce.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 rounded text-xs font-medium transition-colors",title:"Text",children:[r.jsx(Po,{className:"h-3 w-3"}),"Text"]})]}),et&&r.jsxs("a",{href:Re(Ce.contact.email,(ht=Ce.script)==null?void 0:ht.script_body,(wt=Ce.script)==null?void 0:wt.email_subject,(Ct=Ce.actionType)==null?void 0:Ct.name,Ce.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 rounded text-xs font-medium transition-colors",title:"Email",children:[r.jsx(Zs,{className:"h-3 w-3"}),"Email"]})]}),!mt&&!et&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Ce.relationshipTypeName&&r.jsx(Ft,{variant:"secondary",className:"text-xs",children:Ce.relationshipTypeName}),Ce.monthNumber>0&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:["Month ",Ce.monthNumber]})]}),Ce.script&&r.jsx(J,{size:"sm",variant:"outline",className:"w-full",onClick:()=>ae(Ce),children:"View Script"}),r.jsx(J,{size:"sm",className:"w-full",onClick:()=>{var It;return pe(Ce.contact.id,Ce.actionType.id,(It=Ce.script)==null?void 0:It.id)},disabled:x.isPending,children:"Mark Complete"})]})]},Ce.contact.id+Je)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsxs(J,{variant:"ghost",className:"h-full w-full",children:[r.jsx(og,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(ap,{children:r.jsx(po,{onClick:()=>e("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(We,{className:"md:col-span-2",children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"text-lg",children:"Momentum"}),r.jsxs(Br,{open:O,onOpenChange:z,children:[r.jsx(Fo,{asChild:!0,children:r.jsx("button",{onClick:he,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(hd,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Fr,{className:"sm:max-w-[360px]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Set Weekly Goal"}),r.jsx(es,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(ct,{id:"weekly-goal-ic",type:"number",min:"1",value:F,onChange:Ce=>q(Ce.target.value),placeholder:"20",onKeyDown:Ce=>{Ce.key==="Enter"&&ue()}})]}),r.jsx(J,{onClick:ue,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(Hc,{value:Math.min(h.actionsThisWeek/H*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Kh,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[h.actionsThisWeek," / ",H]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),h.streak>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-lg",children:"🔥"}),r.jsx("span",{className:"font-medium",children:"Great Job!"}),r.jsxs("span",{className:"text-muted-foreground",children:["Keep Your Streak Going! (",h.streak," days)"]})]})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(Xe,{className:"space-y-3",children:[fe.length>0?fe.map(Ce=>{const Je=Ce.birthday,Te=Ce.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Je?r.jsx("span",{className:"text-lg",children:"🎂"}):r.jsx("span",{className:"text-lg",children:"🏠"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium",children:[Ce.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",Je?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Je&&Ce.birthday&&fn(new Date(Ce.birthday),"MMM d"),Te&&Ce.home_anniversary&&fn(new Date(Ce.home_anniversary),"MMM d")]})]})]},Ce.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),p.count>0&&r.jsxs("button",{onClick:()=>e("/mission-control/contacts?filter=not-touched-90"),className:"flex items-start gap-2 text-sm pt-2 border-t w-full text-left hover:bg-accent/50 -mx-4 px-4 py-2 rounded-md transition-colors",children:[r.jsx(Ki,{className:"h-4 w-4 text-orange-500 mt-0.5"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium text-orange-600 dark:text-orange-400",children:[p.count," Contact",p.count!==1?"s":""]}),r.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),r.jsx(Ga,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(OOe,{})]})]}),r.jsx(Br,{open:C,onOpenChange:A,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsx(Hr,{children:r.jsx(qr,{className:"flex items-center gap-2",children:j&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:j.actionType.color||"#3B82F6"}}),j.actionType.name," Script"]})})}),j&&j.script&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["For: ",r.jsxs("span",{className:"font-medium text-foreground",children:[j.contact.first_name," ",j.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Ue(j.script.script_body,j.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{variant:"outline",className:"flex-1",onClick:()=>A(!1),children:"Close"}),r.jsx(J,{className:"flex-1",onClick:()=>{var Ce;return pe(j.contact.id,j.actionType.id,(Ce=j.script)==null?void 0:Ce.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(Sjt,{})]})}const Mze=()=>{const{user:e}=zr();return Jt({queryKey:["popby-items",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("popby_items").select("*").or(`owner_user_id.is.null,owner_user_id.eq.${e==null?void 0:e.id}`).eq("is_active",!0).order("name");if(n)throw n;return t},enabled:!!e})},Gse=e=>{const{user:t}=zr();return Jt({queryKey:["popby-logs",t==null?void 0:t.id,e],queryFn:async()=>{let n=ee.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(e){const o=new Date;o.setDate(o.getDate()-e),n=n.gte("completed_at",o.toISOString())}const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!t})},jye=()=>{const{user:e}=zr();return Jt({queryKey:["relationship-type-popby-defaults",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("relationship_type_popby_defaults").select("*");if(n)throw n;return t},enabled:!!e})},Tze=()=>{const{user:e}=zr();return Jt({queryKey:["contact-popby-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("contact_popby_settings").select("*");if(n)throw n;return t},enabled:!!e})},Aze=()=>{const{data:e}=op(),{data:t}=Bg(),{data:n}=Gse(),{data:s}=Tze(),{data:i}=jye(),o=new Map;n==null||n.forEach(x=>{const y=o.get(x.contact_id);(!y||new Date(x.completed_at)>new Date(y))&&o.set(x.contact_id,x.completed_at)});const l=new Map;i==null||i.forEach(x=>l.set(x.relationship_type_id,x.frequency_days));const a=new Map;s==null||s.filter(x=>x.is_active).forEach(x=>{a.set(x.contact_id,x.frequency_days)});const h=af(new Date);return(e||[]).map(x=>{let y=90;if(a.has(x.id))y=a.get(x.id);else if(x.tags&&x.tags.length>0){const A=x.tags.map(E=>l.get(E.relationship_type_id)).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}const w=o.get(x.id)||null,j=w?mC(h,af(new Date(w))):null,S=j===null||j>=y,C=S&&j!==null?j-y:0;return{...x,lastPopby:w,daysSinceLastPopby:j,frequencyDays:y,isDue:S,daysOverdue:C}}).sort((x,y)=>y.daysOverdue-x.daysOverdue)},Eze=()=>Aze().filter(t=>t.isDue),Ojt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("popby_items").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-items"]}),$i({title:"Popby item created!"})},onError:n=>{$i({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},Ize=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("popby_logs").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-logs"]}),$i({title:"Popby logged!"})},onError:n=>{$i({title:"Error logging popby",description:n.message,variant:"destructive"})}})},Djt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await ee.from("relationship_type_popby_defaults").upsert({...n,owner_user_id:t==null?void 0:t.id},{onConflict:"relationship_type_id,owner_user_id"});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),$i({title:"Frequency updated!"})},onError:n=>{$i({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},Rjt=()=>{const{data:e}=Gse(30),t=Eze(),n=new Date;n.setDate(n.getDate()-7);const s=(e==null?void 0:e.filter(o=>new Date(o.completed_at)>=n).length)||0,i=(e==null?void 0:e.length)||0;return{thisWeekCount:s,thisMonthCount:i,dueCount:t.length}};function Fjt(){const{user:e}=zr();return Jt({queryKey:["contact-touch-logs",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function Pze(e){const{data:t}=Fjt(),{data:n}=Tze(),{data:s}=jye(),{data:i}=Cjt();return P.useMemo(()=>{const o=i==null?void 0:i.find(A=>A.contact_id===e.id),l=o?new Date(o.snoozed_until):null,a=af(new Date);if(l&&!gse(l,a))return{nextTouchDate:l,daysUntil:mC(l,a),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const p=((t==null?void 0:t.filter(A=>A.contact_id===e.id))||[]).sort((A,E)=>new Date(E.completed_at).getTime()-new Date(A.completed_at).getTime())[0],x=p?new Date(p.completed_at):null;let y=90;const w=n==null?void 0:n.find(A=>A.contact_id===e.id&&A.is_active);if(w)y=w.frequency_days;else if(e.tags&&e.tags.length>0){const A=e.tags.map(E=>{const T=s==null?void 0:s.find(O=>O.relationship_type_id===E.relationship_type_id);return T==null?void 0:T.frequency_days}).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const j=Vl(af(x),y),S=mC(j,a);let C;return S<0?C="overdue":S<=7?C="due-soon":C="on-track",{nextTouchDate:j,daysUntil:S,status:C,frequencyDays:y,lastTouchDate:x,snoozedUntil:null}},[e,t,n,s,i])}function cfe({contact:e}){const t=Pze(e),s=(()=>{switch(t.status){case"overdue":return{variant:"destructive",icon:El,text:`${Math.abs(t.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Ki,text:t.daysUntil===0?"Due today":`Due in ${t.daysUntil} days`,className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"};case"on-track":return{variant:"secondary",icon:Za,text:`Next touch in ${t.daysUntil} days`,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"snoozed":return{variant:"secondary",icon:Xh,text:`Snoozed until ${fn(t.snoozedUntil,"MMM d")}`,className:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300"};case"never-touched":return{variant:"outline",icon:Ys,text:"Never touched",className:"border-dashed"}}})(),i=s.icon;return r.jsxs(Ft,{variant:s.variant,className:$t("gap-1",s.className),children:[r.jsx(i,{className:"h-3 w-3"}),s.text]})}function zjt({contact:e,onLogTouch:t,onSnooze:n}){const s=Pze(e),i=Tjt(),[o,l]=P.useState(!1),a=()=>{switch(s.status){case"overdue":return"text-destructive";case"due-soon":return"text-amber-600 dark:text-amber-400";case"on-track":return"text-emerald-600 dark:text-emerald-400";case"snoozed":return"text-slate-600 dark:text-slate-400";case"never-touched":return"text-muted-foreground"}},h=()=>{switch(s.status){case"overdue":return r.jsx(El,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Ki,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(Za,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(Xh,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(Ys,{className:"h-5 w-5 text-muted-foreground"})}},p=()=>{switch(s.status){case"overdue":return`${Math.abs(s.daysUntil)} days overdue`;case"due-soon":return s.daysUntil===0?"Due today!":`Due in ${s.daysUntil} days`;case"on-track":return`On track - ${s.daysUntil} days remaining`;case"snoozed":return`Snoozed for ${s.daysUntil} more days`;case"never-touched":return"No touches logged yet"}},x=async()=>{await i.mutateAsync(e.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(Xe,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[h(),r.jsx("span",{className:$t("font-medium",a()),children:p()})]}),s.status==="snoozed"&&s.snoozedUntil&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",fn(s.snoozedUntil,"MMMM d, yyyy")]}),s.status!=="snoozed"&&s.nextTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Scheduled:"})," ",fn(s.nextTouchDate,"MMMM d, yyyy")]}),s.lastTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Last touch:"})," ",fn(s.lastTouchDate,"MMM d, yyyy")]}),s.status!=="snoozed"&&r.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",s.frequencyDays," days"]}),s.status==="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(J,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:i.isPending,children:[r.jsx(Ts,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),t&&r.jsx(J,{size:"sm",className:"flex-1",onClick:t,children:"Log Touch"})]}),s.status!=="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(J,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[r.jsx(Xh,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&t&&r.jsx(J,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:t,children:"Log Touch"})]})]})]}),r.jsx(wye,{open:o,onOpenChange:l,contactId:e.id,contactName:`${e.first_name} ${e.last_name||""}`.trim()})]})}const Dce=768;function OI(){const[e,t]=P.useState(void 0);return P.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Dce-1}px)`),s=()=>{t(window.innerWidthn.removeEventListener("change",s)},[]),!!e}const Bjt={warm:{label:"Warm",emoji:"🟢",bgClass:"bg-emerald-500",textClass:"text-emerald-600 dark:text-emerald-400",borderClass:"border-emerald-500",bgLightClass:"bg-emerald-500/10"},cooling:{label:"Cooling Off",emoji:"🟡",bgClass:"bg-amber-500",textClass:"text-amber-600 dark:text-amber-400",borderClass:"border-amber-500",bgLightClass:"bg-amber-500/10"},"at-risk":{label:"At Risk",emoji:"🔴",bgClass:"bg-red-500",textClass:"text-red-600 dark:text-red-400",borderClass:"border-red-500",bgLightClass:"bg-red-500/10"}},$jt={sm:{dot:"h-2 w-2",text:"text-xs",badge:"px-1.5 py-0.5 gap-1"},md:{dot:"h-2.5 w-2.5",text:"text-sm",badge:"px-2 py-1 gap-1.5"},lg:{dot:"h-3 w-3",text:"text-base",badge:"px-3 py-1.5 gap-2"}};function f4e({score:e,showScore:t=!1,showTooltip:n=!0,size:s="sm",className:i}){const o=Bjt[e.status],l=$jt[s],a=r.jsxs("div",{className:$t("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,l.badge,l.text,i),children:[r.jsx("span",{className:$t("rounded-full",o.bgClass,l.dot)}),t?r.jsx("span",{children:e.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(fI,{children:r.jsxs(Ng,{children:[r.jsx(Sg,{asChild:!0,children:a}),r.jsx(ym,{side:"top",className:"w-64 p-3",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-semibold",children:"Relationship Score"}),r.jsxs("span",{className:$t("font-bold",o.textClass),children:[e.score,"/100"]})]}),r.jsx(Hc,{value:e.score,className:"h-2"}),r.jsxs("div",{className:"space-y-1.5 text-xs",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Recency"}),r.jsxs("span",{children:[e.breakdown.recency,"/40"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Touchpoints (12mo)"}),r.jsxs("span",{children:[e.breakdown.touchpoints,"/30"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Transactions"}),r.jsxs("span",{children:[e.breakdown.transactions,"/20"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Referrals"}),r.jsxs("span",{children:[e.breakdown.referrals,"/10"]})]})]}),e.daysSinceTouch!==null&&r.jsxs("p",{className:"text-xs text-muted-foreground pt-1 border-t",children:["Last contact: ",e.daysSinceTouch===0?"Today":`${e.daysSinceTouch} days ago`]}),e.daysSinceTouch===null&&r.jsx("p",{className:"text-xs text-muted-foreground pt-1 border-t italic",children:"Never contacted"})]})})]})}):a}const Ujt=[{key:"first_name",label:"First Name",required:!0},{key:"last_name",label:"Last Name",required:!1},{key:"email",label:"Email",required:!1},{key:"phone",label:"Phone",required:!1},{key:"address",label:"Street Address",required:!1},{key:"city",label:"City",required:!1},{key:"state",label:"State",required:!1},{key:"zip",label:"Zip Code",required:!1},{key:"spouse_name",label:"Spouse Name",required:!1},{key:"spouse_email",label:"Spouse Email",required:!1},{key:"company_name",label:"Company",required:!1},{key:"job_title",label:"Job Title",required:!1},{key:"birthday",label:"Birthday",required:!1},{key:"home_anniversary",label:"Home Anniversary",required:!1},{key:"notes",label:"Notes",required:!1}],qjt=({open:e,onOpenChange:t,relationshipTypes:n,onSuccess:s})=>{const{user:i}=zr(),{toast:o}=pa(),l=P.useRef(null),[a,h]=P.useState("upload"),[p,x]=P.useState([]),[y,w]=P.useState([]),[j,S]=P.useState({}),[C,A]=P.useState([]),[E,T]=P.useState([]),[O,z]=P.useState(!1),[F,q]=P.useState(null),H=()=>{h("upload"),x([]),w([]),S({}),A([]),T([]),q(null),l.current&&(l.current.value="")},K=()=>{H(),t(!1)},Z=fe=>{const de=fe.split(` `).map(pe=>pe.trim()).filter(pe=>pe);if(de.length===0)return{headers:[],data:[]};const _e=pe=>{const ae=[];let ge="",Me=!1;for(let Ue=0;Ue{var Ee;const de=(Ee=fe.target.files)==null?void 0:Ee[0];if(!de)return;const _e=new FileReader;_e.onload=ke=>{var Ue;const pe=(Ue=ke.target)==null?void 0:Ue.result,{headers:ae,data:ge}=Z(pe);if(ae.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(ae),w(ge);const Me={};ae.forEach(Ie=>{const Ke=Ie.toLowerCase().replace(/[_\s-]/g,"");Ke.includes("firstname")||Ke==="first"?Me.first_name=Ie:Ke.includes("lastname")||Ke==="last"?Me.last_name=Ie:Ke.includes("email")?Me.email=Ie:Ke.includes("phone")||Ke.includes("mobile")||Ke.includes("cell")?Me.phone=Ie:Ke.includes("address")||Ke.includes("street")?Me.address=Ie:Ke==="city"?Me.city=Ie:Ke==="state"||Ke==="province"?Me.state=Ie:Ke==="zip"||Ke==="zipcode"||Ke==="postalcode"?Me.zip=Ie:Ke.includes("spouse")&&Ke.includes("email")?Me.spouse_email=Ie:Ke.includes("spouse")||Ke.includes("partner")?Me.spouse_name=Ie:Ke.includes("company")||Ke.includes("organization")||Ke.includes("business")?Me.company_name=Ie:Ke.includes("jobtitle")||Ke.includes("title")||Ke.includes("position")?Me.job_title=Ie:Ke.includes("birthday")||Ke.includes("dob")||Ke.includes("birthdate")?Me.birthday=Ie:Ke.includes("anniversary")||Ke.includes("homeanniversary")?Me.home_anniversary=Ie:(Ke.includes("notes")||Ke.includes("comment"))&&(Me.notes=Ie)}),S(Me),h("mapping")},_e.readAsText(de)},ue=(fe,de)=>{S(_e=>{if(de==="none"){const{[fe]:Ee,...ke}=_e;return ke}return{..._e,[fe]:de}})},he=fe=>{A(de=>de.includes(fe)?de.filter(_e=>_e!==fe):[...de,fe])},be=()=>{const fe=y.map(de=>{const _e=pe=>{const ae=j[pe];if(!ae)return"";const ge=p.indexOf(ae);return ge>=0?(de[ge]||"").trim():""},Ee=_e("first_name"),ke=Ee.length>0;return{first_name:Ee,last_name:_e("last_name"),email:_e("email"),phone:_e("phone"),address:_e("address"),city:_e("city"),state:_e("state"),zip:_e("zip"),spouse_name:_e("spouse_name"),spouse_email:_e("spouse_email"),company_name:_e("company_name"),job_title:_e("job_title"),birthday:_e("birthday"),home_anniversary:_e("home_anniversary"),notes:_e("notes"),isValid:ke,error:ke?void 0:"First name is required"}});T(fe),h("preview")},ne=async()=>{if(!(i!=null&&i.id))return;const fe=E.filter(ke=>ke.isValid);if(fe.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}z(!0);let de=0,_e=0,Ee=0;try{for(const ke of fe)try{let pe=null;if(ke.email){const{data:ge}=await ee.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("email",ke.email).maybeSingle();pe=ge}if(!pe&&ke.phone){const{data:ge}=await ee.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("phone",ke.phone).maybeSingle();pe=ge}const ae={owner_user_id:i.id,first_name:ke.first_name,last_name:ke.last_name||null,email:ke.email||null,phone:ke.phone||null,address:ke.address||null,city:ke.city||null,state:ke.state||null,zip:ke.zip||null,spouse_name:ke.spouse_name||null,spouse_email:ke.spouse_email||null,company_name:ke.company_name||null,job_title:ke.job_title||null,birthday:ke.birthday||null,home_anniversary:ke.home_anniversary||null,notes:ke.notes||null};if(pe)await ee.from("innercircle_contacts").update(ae).eq("id",pe.id),_e++;else{const{data:ge}=await ee.from("innercircle_contacts").insert(ae).select("id").single();ge&&C.length>0&&await ee.from("innercircle_contact_tags").insert(C.map(Me=>({contact_id:ge.id,relationship_type_id:Me}))),de++}}catch(pe){console.error("Error importing contact:",pe),Ee++}q({created:de,updated:_e,failed:Ee}),h("result"),(de>0||_e>0)&&s(),o({title:"Import Complete",description:`${de} created, ${_e} updated${Ee>0?`, ${Ee} failed`:""}.`})}catch(ke){console.error("Import error:",ke),o({title:"Import Failed",description:ke.message||"Failed to import contacts",variant:"destructive"})}finally{z(!1)}},ye=E.filter(fe=>fe.isValid).length,ie=E.filter(fe=>!fe.isValid).length;return r.jsx(Br,{open:e,onOpenChange:K,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(u1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(es,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),a==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:re,className:"hidden"}),r.jsx(go,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(J,{onClick:()=>{var fe;return(fe=l.current)==null?void 0:fe.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),r.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:"First Name, Last Name, Email, Phone, Street Address, City, State, Zip, Spouse Name, Company, Job Title, Birthday, Home Anniversary, Notes"}),r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{const fe=`First Name,Last Name,Email,Phone,Street Address,City,State,Zip,Spouse Name,Company,Job Title,Birthday,Home Anniversary,Notes John,Doe,john@example.com,555-123-4567,123 Main St,Austin,TX,78701,Jane Doe,ABC Realty,Real Estate Agent,1985-06-15,2020-03-22,Met at open house`,de=new Blob([fe],{type:"text/csv"}),_e=URL.createObjectURL(de),Ee=document.createElement("a");Ee.href=_e,Ee.download="contact_import_template.csv",Ee.click(),URL.revokeObjectURL(_e)},children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),a==="mapping"&&r.jsxs("div",{className:"flex-1 overflow-auto space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:Ujt.map(fe=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(Ve,{className:"w-40 text-sm",children:[fe.label,fe.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(bn,{value:j[fe.key]||"none",onValueChange:de=>ue(fe.key,de),children:[r.jsx(vn,{className:"w-48",children:r.jsx(wn,{placeholder:"Select column..."})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"-- Not mapped --"}),p.map(de=>r.jsx(Kt,{value:de,children:de},de))]})]})]},fe.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(fe=>r.jsx(Ft,{variant:C.includes(fe.id)?"default":"outline",className:"cursor-pointer",onClick:()=>he(fe.id),children:fe.name},fe.id))})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:r.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",y.length," row(s) found in CSV"]})})]}),a==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Za,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[ye," valid"]})]}),ie>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(El,{className:"h-4 w-4"}),r.jsxs("span",{children:[ie," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{className:"bg-muted/30",children:[r.jsx(Et,{children:"First Name"}),r.jsx(Et,{children:"Last Name"}),r.jsx(Et,{children:"Email"}),r.jsx(Et,{children:"Phone"}),r.jsx(Et,{children:"Status"})]})}),r.jsx(Hs,{children:E.slice(0,100).map((fe,de)=>r.jsxs(Ir,{children:[r.jsx(vt,{children:fe.first_name}),r.jsx(vt,{children:fe.last_name}),r.jsx(vt,{children:fe.email}),r.jsx(vt,{children:fe.phone}),r.jsx(vt,{children:fe.isValid?r.jsx(Ft,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ft,{variant:"destructive",children:fe.error||"Invalid"})})]},de))})]}),E.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",E.length," contacts"]})]})]}),a==="result"&&F&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(Za,{className:"h-12 w-12 mx-auto text-green-500"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground",children:[F.created," contact(s) created, ",F.updated," updated"]}),F.failed>0&&r.jsxs("p",{className:"text-destructive",children:[F.failed," failed to import"]})]}),r.jsxs(ri,{children:[a==="upload"&&r.jsx(J,{variant:"outline",onClick:K,children:"Cancel"}),a==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"outline",onClick:H,children:"Back"}),r.jsx(J,{onClick:be,disabled:!j.first_name,children:"Continue"})]}),a==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"outline",onClick:()=>h("mapping"),children:"Back"}),r.jsx(J,{onClick:ne,disabled:O||ye===0,children:O?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${ye} Contact${ye!==1?"s":""}`})]}),a==="result"&&r.jsx(J,{onClick:K,children:"Done"})]})]})})};function Vjt(){return"contacts"in navigator&&"ContactsManager"in window}function Hjt(e){const t=[],n=e.split("BEGIN:VCARD").filter(s=>s.trim());for(const s of n){const i=s.split(/\r?\n/);let o="",l="",a="",h="",p="";for(const x of i){const y=x.replace(/^\s+/,"");if(y.startsWith("N:")||y.startsWith("N;")){const j=y.substring(y.indexOf(":")+1).split(";");l=(j[0]||"").trim(),o=(j[1]||"").trim()}if((y.startsWith("FN:")||y.startsWith("FN;"))&&!o){const j=y.substring(y.indexOf(":")+1).trim().split(" ");o=j[0]||"",l=j.slice(1).join(" ")}(y.startsWith("EMAIL")||y.match(/^item\d+\.EMAIL/i))&&!a&&(a=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("TEL")||y.match(/^item\d+\.TEL/i))&&!h&&(h=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!p&&(p=y.substring(y.indexOf(":")+1).split(";").map(S=>S.trim()).filter(Boolean).join(", "))}(o||l)&&t.push({first_name:o,last_name:l,email:a,phone:h,address:p})}return t}function Wjt({open:e,onOpenChange:t,onComplete:n}){const{user:s}=zr(),{data:i}=op(),o=_xe(),l=P.useRef(null),[a,h]=P.useState("choose"),[p,x]=P.useState([]),[y,w]=P.useState(new Set),[j,S]=P.useState(0),[C,A]=P.useState(0),E=Vjt(),T=P.useCallback(ue=>{if(!i)return ue;const he=new Set(i.filter(ne=>ne.email).map(ne=>ne.email.toLowerCase())),be=new Set(i.filter(ne=>ne.phone).map(ne=>ne.phone.replace(/\D/g,"")));return ue.map(ne=>{var fe,de;const ye=(fe=ne.email)==null?void 0:fe.toLowerCase(),ie=(de=ne.phone)==null?void 0:de.replace(/\D/g,"");return ye&&he.has(ye)?{...ne,isDuplicate:!0,duplicateField:"email"}:ie&&ie.length>=7&&be.has(ie)?{...ne,isDuplicate:!0,duplicateField:"phone"}:ne})},[i]),O=async()=>{try{const ue=["name","email","tel","address"],he=await navigator.contacts.select(ue,{multiple:!0});if(!he||he.length===0)return;const be=he.map(ie=>{var _e,Ee,ke,pe;const de=(((_e=ie.name)==null?void 0:_e[0])||"").split(" ");return{first_name:de[0]||"",last_name:de.slice(1).join(" "),email:((Ee=ie.email)==null?void 0:Ee[0])||"",phone:((ke=ie.tel)==null?void 0:ke[0])||"",address:(pe=ie.address)!=null&&pe[0]?[ie.address[0].streetAddress,ie.address[0].city,ie.address[0].region,ie.address[0].postalCode].filter(Boolean).join(", "):""}}),ne=T(be);x(ne);const ye=new Set;ne.forEach((ie,fe)=>{ie.isDuplicate||ye.add(fe)}),w(ye),h("preview")}catch(ue){console.error("Contact Picker error:",ue),$i({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},z=ue=>{var ne;const he=(ne=ue.target.files)==null?void 0:ne[0];if(!he)return;const be=new FileReader;be.onload=ye=>{var Ee;const ie=(Ee=ye.target)==null?void 0:Ee.result,fe=Hjt(ie);if(fe.length===0){$i({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const de=T(fe);x(de);const _e=new Set;de.forEach((ke,pe)=>{ke.isDuplicate||_e.add(pe)}),w(_e),h("preview")},be.readAsText(he),l.current&&(l.current.value="")},F=async()=>{const ue=p.filter((be,ne)=>y.has(ne));if(ue.length===0)return;h("importing");let he=0;for(const be of ue)try{await o.mutateAsync({first_name:be.first_name,last_name:be.last_name||void 0,email:be.email||void 0,phone:be.phone||void 0,address:be.address||void 0}),he++,A(Math.round(he/ue.length*100))}catch(ne){console.error(`Failed to import ${be.first_name} ${be.last_name}:`,ne)}S(he),h("done")},q=ue=>{w(he=>{const be=new Set(he);return be.has(ue)?be.delete(ue):be.add(ue),be})},H=()=>{y.size===p.length?w(new Set):w(new Set(p.map((ue,he)=>he)))},K=ue=>{ue||(h("choose"),x([]),w(new Set),S(0),A(0),a==="done"&&n()),t(ue)},Z=p.filter(ue=>ue.isDuplicate).length,re=y.size;return r.jsx(Br,{open:e,onOpenChange:K,children:r.jsxs(Fr,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5 text-primary"}),a==="choose"&&"Import Phone Contacts",a==="preview"&&"Select Contacts to Import",a==="importing"&&"Importing Contacts...",a==="done"&&"Import Complete"]}),a==="choose"&&r.jsx(es,{children:"Add contacts from your phone directly into Agent OS."})]}),a==="choose"&&r.jsxs("div",{className:"space-y-4 pt-2",children:[E&&r.jsxs(J,{onClick:O,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(gm,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Select from Phone"}),r.jsx("div",{className:"text-xs opacity-80",children:"Pick contacts directly from your device"})]})]}),r.jsxs("div",{className:"relative",children:[E&&r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),E&&r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),r.jsxs(J,{variant:E?"outline":"default",onClick:()=>{var ue;return(ue=l.current)==null?void 0:ue.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(go,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Upload Contact File"}),r.jsx("div",{className:"text-xs opacity-80",children:E?"Import a .vcf file exported from your Contacts app":"Export contacts from your phone as a .vcf file, then upload here"})]})]}),r.jsx("input",{ref:l,type:"file",accept:".vcf,.vcard",onChange:z,className:"hidden"}),!E&&r.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{className:"font-medium",children:"How to export contacts:"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"iPhone:"}),r.jsx("p",{className:"text-xs",children:'Open Contacts → select contacts → Share → choose "Export vCard"'})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"Android:"}),r.jsx("p",{className:"text-xs",children:"Open Contacts → Menu → Export → save as .vcf file"})]})]})]}),a==="preview"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("span",{children:[p.length," contact",p.length!==1?"s":""," found",Z>0&&r.jsxs("span",{className:"text-amber-600 ml-1",children:["(",Z," already exist)"]})]}),r.jsx(J,{variant:"ghost",size:"sm",onClick:H,children:y.size===p.length?"Deselect All":"Select All"})]}),r.jsx(Jo,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:p.map((ue,he)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ue.isDuplicate?"opacity-60":""}`,onClick:()=>q(he),children:[r.jsx(cc,{checked:y.has(he),onCheckedChange:()=>q(he),className:"mt-0.5"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:[ue.first_name," ",ue.last_name]}),ue.isDuplicate&&r.jsxs(Ft,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-amber-500/10 text-amber-600 border-amber-200",children:["Exists (",ue.duplicateField,")"]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[ue.phone&&r.jsx("div",{children:ue.phone}),ue.email&&r.jsx("div",{className:"truncate",children:ue.email})]})]})]},he))})}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>h("choose"),children:"Back"}),r.jsxs(J,{onClick:F,disabled:re===0,children:["Import ",re," Contact",re!==1?"s":""]})]})]}),a==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(nn,{className:"h-8 w-8 animate-spin text-primary"}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"font-medium",children:"Importing contacts..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[C,"% complete"]})]}),r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${C}%`}})})]}),a==="done"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-emerald-500/10 flex items-center justify-center",children:r.jsx(Ca,{className:"h-6 w-6 text-emerald-600"})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"font-semibold text-lg",children:[j," contact",j!==1?"s":""," imported!"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Your contacts are now in Agent OS and ready for touchpoint plans."})]}),r.jsx(J,{onClick:()=>K(!1),className:"mt-2",children:"Done"})]})]})})}function Gjt(){const e=ns(),[t]=Fd(),{user:n}=zr(),s=OI(),i=Wr(),o=t.get("type"),l=t.get("filter")??t.get("status"),a=t.get("new")==="true",{contactsWithScores:h,isLoading:p}=kxe(),{data:x}=Bg(),y=_xe(),w=pOe(),j=mOe(),[S,C]=P.useState(""),[A,E]=P.useState(o||"all"),[T,O]=P.useState(l||"all"),[z,F]=P.useState("name"),[q,H]=P.useState(a),[K,Z]=P.useState(null),[re,ue]=P.useState(!1),[he,be]=P.useState(!1),[ne,ye]=P.useState(null),[ie,fe]=P.useState("");P.useEffect(()=>{if(!(n!=null&&n.id))return;const ge=ee.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{i.invalidateQueries({queryKey:["innercircle-contacts"]}),i.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{ee.removeChannel(ge)}},[i,n==null?void 0:n.id]),P.useEffect(()=>{l&&O(l)},[l]);const[de,_e]=P.useState({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",notes:"",tagIds:[]});P.useEffect(()=>{a&&H(!0)},[a]),P.useEffect(()=>{var ge;K&&_e({first_name:K.first_name||"",last_name:K.last_name||"",email:K.email||"",phone:K.phone||"",address:K.address||"",city:K.city||"",state:K.state||"",zip_code:K.zip_code||"",birthday:K.birthday||"",home_anniversary:K.home_anniversary||"",notes:K.notes||"",tagIds:((ge=K.tags)==null?void 0:ge.map(Me=>Me.relationship_type_id))||[]})},[K]);const Ee=P.useMemo(()=>{if(!h)return[];let ge=h.filter(Me=>{var Ke,Re,Ce;const Ue=S===""||`${Me.first_name} ${Me.last_name}`.toLowerCase().includes(S.toLowerCase())||((Ke=Me.email)==null?void 0:Ke.toLowerCase().includes(S.toLowerCase()))||((Re=Me.phone)==null?void 0:Re.includes(S)),Ie=A==="all"||((Ce=Me.tags)==null?void 0:Ce.some(Je=>Je.relationship_type_id===A));return Ue&&Ie});return T==="not-touched-90"?ge=ge.filter(Me=>{const Ue=Me.relationshipScore.daysSinceTouch;return Ue===null||Ue>90}):T==="at-risk"?ge=ge.filter(Me=>Me.relationshipScore.status==="at-risk"):T==="cooling"?ge=ge.filter(Me=>Me.relationshipScore.status==="cooling"):T==="warm"&&(ge=ge.filter(Me=>Me.relationshipScore.status==="warm")),ge=[...ge].sort((Me,Ue)=>{switch(z){case"last-touched":{const Ie=Me.relationshipScore.lastTouchDate,Ke=Ue.relationshipScore.lastTouchDate;return!Ie&&!Ke?0:Ie?Ke?new Date(Ie).getTime()-new Date(Ke).getTime():1:-1}case"next-touch":{const Ie=Me.relationshipScore.daysSinceTouch,Ke=Ue.relationshipScore.daysSinceTouch;return Ie===null&&Ke===null?0:Ie===null?-1:Ke===null?1:Ke-Ie}case"score":return Me.relationshipScore.score-Ue.relationshipScore.score;case"date-added":{const Ie=Me.created_at,Ke=Ue.created_at;return!Ie&&!Ke?0:Ie?Ke?new Date(Ke).getTime()-new Date(Ie).getTime():-1:1}case"name":default:{const Ie=`${Me.first_name||""} ${Me.last_name||""}`.toLowerCase(),Ke=`${Ue.first_name||""} ${Ue.last_name||""}`.toLowerCase();return Ie.localeCompare(Ke)}}}),ge},[h,S,A,T,z]),ke=()=>{_e({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",notes:"",tagIds:[]})},pe=async ge=>{ge.preventDefault(),K?(await w.mutateAsync({id:K.id,...de}),Z(null)):(await y.mutateAsync(de),H(!1)),ke()},ae=async ge=>{confirm("Are you sure you want to delete this contact?")&&await j.mutateAsync(ge)};return r.jsx(Or,{title:"Contacts",description:"Manage your InnerCircle contacts",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Contacts"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsx("div",{className:"flex items-center gap-4",children:r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control"),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name, email, or phone...",value:S,onChange:ge=>C(ge.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:A,onValueChange:E,children:[r.jsx(vn,{className:"w-[160px]",children:r.jsx(wn,{placeholder:"Filter by type"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Types"}),x==null?void 0:x.filter(ge=>ge.active).map(ge=>r.jsx(Kt,{value:ge.id,children:ge.name},ge.id))]})]}),r.jsxs(bn,{value:T,onValueChange:O,children:[r.jsx(vn,{className:"w-[160px]",children:r.jsx(wn,{placeholder:"Filter by status"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Status"}),r.jsx(Kt,{value:"warm",children:"🟢 Warm"}),r.jsx(Kt,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx(Kt,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(bn,{value:z,onValueChange:F,children:[r.jsx(vn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(wn,{placeholder:"Sort by"})]})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"name",children:"Name (A-Z)"}),r.jsx(Kt,{value:"last-touched",children:"Last Touched"}),r.jsx(Kt,{value:"next-touch",children:"Next Touch Due"}),r.jsx(Kt,{value:"score",children:"Relationship Score"}),r.jsx(Kt,{value:"date-added",children:"Date Added"})]})]}),r.jsxs(J,{onClick:()=>H(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(J,{variant:"outline",onClick:()=>ue(!0),children:[r.jsx(go,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(J,{variant:"outline",onClick:()=>be(!0),children:[r.jsx(gm,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),s?r.jsx("div",{className:"space-y-3",children:p?r.jsx(We,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):Ee.length===0?r.jsx(We,{className:"p-6 text-center text-muted-foreground",children:S||A!=="all"||T!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):Ee.map(ge=>{var Ue;const{relationshipScore:Me}=ge;return r.jsx(We,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const Ie=new URLSearchParams;S&&Ie.set("search",S),A!=="all"&&Ie.set("type",A),T!=="all"&&Ie.set("filter",T);const Ke=Ie.toString();e(`/mission-control/contacts/${ge.id}${Ke?`?${Ke}`:""}`)},children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("h3",{className:"font-semibold text-base truncate",children:[ge.first_name," ",ge.last_name]}),r.jsx(Ga,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[ge.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Zs,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:ge.email})]}),ge.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(ca,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:ge.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(f4e,{score:Me,size:"sm"}),r.jsx(cfe,{contact:ge}),(Ue=ge.tags)==null?void 0:Ue.map(Ie=>{var Ke;return r.jsx(Ft,{variant:"secondary",className:"text-xs",children:(Ke=Ie.relationship_type)==null?void 0:Ke.name},Ie.id)})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Me.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),fn(new Date(Me.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),ge.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ys,{className:"h-3 w-3"}),fn(new Date(ge.birthday),"MMM d")]}),ge.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(fi,{className:"h-3 w-3"}),fn(new Date(ge.home_anniversary),"MMM d")]})]})]}),r.jsxs("div",{className:"flex flex-col gap-1 ml-2",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Snooze Touch",onClick:Ie=>{Ie.stopPropagation(),ye(ge.id),fe(`${ge.first_name} ${ge.last_name||""}`.trim())},children:r.jsx(Xh,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ie=>{Ie.stopPropagation(),Z(ge)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ie=>{Ie.stopPropagation(),ae(ge.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]})})},ge.id)})}):r.jsx(We,{children:r.jsx(Xe,{className:"p-0 overflow-x-auto",children:r.jsxs(qs,{className:"min-w-[600px]",children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{children:"Contact Info"}),r.jsx(Et,{children:"Relationship Types"}),r.jsx(Et,{children:"Last Contact"}),r.jsx(Et,{children:"Important Dates"}),r.jsx(Et,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Hs,{children:p?r.jsx(Ir,{children:r.jsx(vt,{colSpan:7,className:"text-center py-8",children:"Loading contacts..."})}):Ee.length===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:S||A!=="all"||T!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):Ee.map(ge=>{var Ue;const{relationshipScore:Me}=ge;return r.jsxs(Ir,{className:"cursor-pointer hover:bg-accent/50",onClick:()=>{const Ie=new URLSearchParams;S&&Ie.set("search",S),A!=="all"&&Ie.set("type",A),T!=="all"&&Ie.set("status",T);const Ke=Ie.toString();e(`/mission-control/contacts/${ge.id}${Ke?`?${Ke}`:""}`)},children:[r.jsx(vt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ge.first_name," ",ge.last_name]})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(f4e,{score:Me,size:"sm"}),r.jsx(cfe,{contact:ge})]})}),r.jsx(vt,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[ge.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Zs,{className:"h-3 w-3"}),ge.email]}),ge.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(ca,{className:"h-3 w-3"}),ge.phone]})]})}),r.jsx(vt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:(Ue=ge.tags)==null?void 0:Ue.map(Ie=>{var Ke;return r.jsx(Ft,{variant:"secondary",className:"text-xs",children:(Ke=Ie.relationship_type)==null?void 0:Ke.name},Ie.id)})})}),r.jsx(vt,{children:r.jsx("div",{className:"text-sm",children:Me.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ki,{className:"h-3 w-3"}),fn(new Date(Me.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(vt,{children:r.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[ge.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ys,{className:"h-3 w-3"}),fn(new Date(ge.birthday),"MMM d")]}),ge.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(fi,{className:"h-3 w-3"}),fn(new Date(ge.home_anniversary),"MMM d")]})]})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{variant:"ghost",size:"sm",title:"Snooze Touch",onClick:Ie=>{Ie.stopPropagation(),ye(ge.id),fe(`${ge.first_name} ${ge.last_name||""}`.trim())},children:r.jsx(Xh,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:Ie=>{Ie.stopPropagation(),Z(ge)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:Ie=>{Ie.stopPropagation(),ae(ge.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},ge.id)})})]})})}),r.jsx(Br,{open:q||!!K,onOpenChange:ge=>{ge||(H(!1),Z(null),ke())},children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:K?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:pe,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"first_name",children:"First Name *"}),r.jsx(ct,{id:"first_name",value:de.first_name,onChange:ge=>_e({...de,first_name:ge.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"last_name",children:"Last Name"}),r.jsx(ct,{id:"last_name",value:de.last_name,onChange:ge=>_e({...de,last_name:ge.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"email",children:"Email"}),r.jsx(ct,{id:"email",type:"email",value:de.email,onChange:ge=>_e({...de,email:ge.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"phone",children:"Phone"}),r.jsx(ct,{id:"phone",value:de.phone,onChange:ge=>_e({...de,phone:ge.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"address",children:"Address"}),r.jsx(ct,{id:"address",value:de.address,onChange:ge=>_e({...de,address:ge.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"city",children:"City"}),r.jsx(ct,{id:"city",value:de.city,onChange:ge=>_e({...de,city:ge.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"state",children:"State"}),r.jsx(ct,{id:"state",value:de.state,onChange:ge=>_e({...de,state:ge.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"zip_code",children:"Zip"}),r.jsx(ct,{id:"zip_code",value:de.zip_code,onChange:ge=>_e({...de,zip_code:ge.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"birthday",children:"Birthday"}),r.jsx(ct,{id:"birthday",type:"date",value:de.birthday,onChange:ge=>_e({...de,birthday:ge.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(ct,{id:"home_anniversary",type:"date",value:de.home_anniversary,onChange:ge=>_e({...de,home_anniversary:ge.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(ge=>ge.active).map(ge=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(cc,{checked:de.tagIds.includes(ge.id),onCheckedChange:Me=>{_e(Me?{...de,tagIds:[...de.tagIds,ge.id]}:{...de,tagIds:de.tagIds.filter(Ue=>Ue!==ge.id)})}}),r.jsx("span",{className:"text-sm",children:ge.name})]},ge.id))})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"notes",children:"Notes"}),r.jsx(ms,{id:"notes",value:de.notes,onChange:ge=>_e({...de,notes:ge.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>{H(!1),Z(null),ke()},children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:y.isPending||w.isPending,children:[K?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(qjt,{open:re,onOpenChange:ue,relationshipTypes:(x==null?void 0:x.filter(ge=>ge.active))||[],onSuccess:()=>{ue(!1)}}),r.jsx(Wjt,{open:he,onOpenChange:be,onComplete:()=>be(!1)}),r.jsx(wye,{open:!!ne,onOpenChange:ge=>{ge||ye(null)},contactId:ne||"",contactName:ie})]})})}function Kjt(){return Jt({queryKey:["video-script-categories"],queryFn:async()=>{const{data:e,error:t}=await ee.from("video_script_categories").select("*").order("sort_order");if(t)throw t;return e}})}function Zjt(e){return Jt({queryKey:["video-scripts",e],queryFn:async()=>{let t=ee.from("video_scripts").select("*, category:video_script_categories(*)").eq("is_active",!0).order("title");const{data:n,error:s}=await t;if(s)throw s;return n}})}function Yjt(){const{user:e}=zr();return Jt({queryKey:["user-video-scripts",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await ee.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",e.id).order("title");if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function Xjt(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("user_video_scripts").insert([{owner_user_id:e.id,source_script_id:n.id,category_id:n.category_id,title:n.title,script_text:n.script_text,tags:n.tags,is_custom:!1}]).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["user-video-scripts"]})}})}function Qjt(e){const{user:t}=zr();return Jt({queryKey:["agent-videos",t==null?void 0:t.id,e],queryFn:async()=>{if(!(t!=null&&t.id))return[];let n=ee.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",t.id).order("created_at",{ascending:!1});n=n.eq("is_deleted",!1);const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!(t!=null&&t.id)})}function Jjt(e){return Jt({queryKey:["agent-video",e],queryFn:async()=>{const{data:t,error:n}=await ee.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function Lze(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("agent_videos").insert([{owner_user_id:e.id,contact_id:n.contact_id,bunny_video_id:n.bunny_video_id,playback_url:n.playback_url,thumbnail_url:n.thumbnail_url,preview_url:n.preview_url,duration_seconds:n.duration_seconds,file_size_mb:n.file_size_mb||0,title:n.title,notes:n.notes,task_id:n.task_id,status:n.status||"processing",touch_type:n.touch_type||"video",page_template:"default"}]).select("*, share_token").single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function ekt(){const e=Wr();return cr({mutationFn:async({id:t,bunnyVideoId:n,hardDelete:s=!1})=>{if(console.log("Deleting video:",{id:t,bunnyVideoId:n,hardDelete:s}),n){console.log("Calling bunny-upload delete for videoId:",n);const{data:i,error:o}=await ee.functions.invoke("bunny-upload",{body:{action:"delete",videoId:n,isAgentVideo:!0}});o?console.error("Failed to delete from Bunny:",o):console.log("Bunny delete response:",i)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",t);const{error:i}=await ee.from("agent_videos").delete().eq("id",t);if(i)throw i}else{console.log("Soft deleting from database:",t);const{error:i}=await ee.from("agent_videos").update({is_deleted:!0}).eq("id",t);if(i)throw i}console.log("Video deletion complete")},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function kye(){const{user:e}=zr();return Jt({queryKey:["storage-usage",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return null;const{data:t,error:n}=await ee.from("agent_storage_usage").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t||{user_id:e.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(e!=null&&e.id)})}function tkt(){const{data:e,isLoading:t}=kye(),n=e?e.total_storage_mb0?e.total_storage_mb/e.max_storage_mb*100:0,o=i>=80;return{canRecord:n,remainingMb:s,usagePercent:i,isNearLimit:o,storage:e,isLoading:t}}async function rkt(e){const{data:t,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:e,isAgentVideo:!0}});if(n)throw n;return t}async function nkt(e){const{data:t,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}async function skt(e){const{data:t,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"status",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}function ikt(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async({contactId:n,videoId:s,notes:i})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:o}=await ee.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:l,error:a}=await ee.from("contact_touch_logs").insert([{owner_user_id:e.id,contact_id:n,action_type_id:o.id,notes:i||`Quick Video Touch - Video ID: ${s}`}]).select().single();if(a)throw a;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts"]})}})}function akt(e){return Jt({queryKey:["contact-video-replies",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await ee.from("video_replies").select(` *, video:agent_videos(id, title, thumbnail_url, playback_url) `).eq("contact_id",e).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function okt({videoId:e}){var l;const{data:t,isLoading:n,error:s}=Jjt(e);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Pr,{className:"w-full aspect-video rounded-lg"}),r.jsx(Pr,{className:"h-4 w-1/3"})]});if(s||!t||t.is_deleted)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(zh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-medium",children:"Video Unavailable"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video has been deleted or is no longer available."})]});const i=a=>{let h=a;return h.includes("iframe.mediadelivery.net/play/")&&(h=h.replace("/play/","/embed/"),h+=(h.includes("?")?"&":"?")+"autoplay=true&responsive=true"),h},o=(l=t.playback_url)==null?void 0:l.includes("iframe.mediadelivery.net");return r.jsxs("div",{className:"space-y-4",children:[t.playback_url?r.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:o?r.jsx("iframe",{src:i(t.playback_url),title:t.title||"Video preview",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:t.playback_url,controls:!0,autoPlay:!0,className:"absolute top-0 left-0 w-full h-full object-contain"})}):r.jsx("div",{className:"w-full aspect-video bg-muted rounded-lg flex items-center justify-center",children:r.jsx("p",{className:"text-muted-foreground",children:"Video is still processing..."})}),t.title&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:t.title}),t.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.notes})]})]})}function lkt(){var Me,Ue;const{contactId:e}=Wc(),t=ns(),[n]=Fd(),s=n.get("search")||"",i=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:a}=Lft(e||""),{data:h}=Bg(),{data:p}=bxe(),{data:x}=bse(365),{data:y}=Gse(365),{data:w}=akt(e),{contactsWithScores:j}=kxe(),S=pOe(),C=mOe(),A=xOe(),[E,T]=P.useState(!1),[O,z]=P.useState({}),[F,q]=P.useState(!1),[H,K]=P.useState(null),[Z,re]=P.useState(""),[ue,he]=P.useState(null),be=Ie=>{if(!Ie)return null;const Ke=Ie.match(/Video ID:\s*([a-f0-9-]+)/i);return Ke?Ke[1]:null},ne=P.useMemo(()=>{if(!j)return[];let Ie=j.filter(Ke=>{var Je,Te,Ye;const Re=s===""||`${Ke.first_name} ${Ke.last_name}`.toLowerCase().includes(s.toLowerCase())||((Je=Ke.email)==null?void 0:Je.toLowerCase().includes(s.toLowerCase()))||((Te=Ke.phone)==null?void 0:Te.includes(s)),Ce=i==="all"||((Ye=Ke.tags)==null?void 0:Ye.some(xe=>xe.relationship_type_id===i));return Re&&Ce});return o==="not-touched-90"?Ie=Ie.filter(Ke=>{const Re=Ke.relationshipScore.daysSinceTouch;return Re===null||Re>90}):o==="at-risk"?Ie=Ie.filter(Ke=>Ke.relationshipScore.status==="at-risk"):o==="cooling"?Ie=Ie.filter(Ke=>Ke.relationshipScore.status==="cooling"):o==="warm"&&(Ie=Ie.filter(Ke=>Ke.relationshipScore.status==="warm")),Ie.map(Ke=>Ke.id)},[j,s,i,o]),ye=ne.indexOf(e||""),ie=ye>0?ne[ye-1]:null,fe=ye1&&ye!==-1,_e=Ie=>{const Ke=new URLSearchParams;s&&Ke.set("search",s),i!=="all"&&Ke.set("type",i),o!=="all"&&Ke.set("status",o);const Re=Ke.toString();return`/mission-control/contacts/${Ie}${Re?`?${Re}`:""}`},Ee=P.useMemo(()=>{const Ie=((x==null?void 0:x.filter(Re=>Re.contact_id===e))||[]).map(Re=>{var Je,Te;const Ce=be(Re.notes);return{id:Re.id,type:"touch",completed_at:Re.completed_at,name:((Je=Re.action_type)==null?void 0:Je.name)||"Touch",color:((Te=Re.action_type)==null?void 0:Te.color)||"#3B82F6",notes:Re.notes,videoId:Ce}}),Ke=((y==null?void 0:y.filter(Re=>Re.contact_id===e))||[]).map(Re=>({id:Re.id,type:"popby",completed_at:Re.completed_at,name:"Pop-by",color:"#F97316",notes:Re.notes,videoId:null}));return[...Ie,...Ke].sort((Re,Ce)=>new Date(Ce.completed_at).getTime()-new Date(Re.completed_at).getTime())},[x,y,e]),ke=()=>{var Ie;l&&(z({first_name:l.first_name||"",last_name:l.last_name||"",email:l.email||"",phone:l.phone||"",address:l.address||"",city:l.city||"",state:l.state||"",zip_code:l.zip_code||"",birthday:l.birthday||"",home_anniversary:l.home_anniversary||"",spouse_name:l.spouse_name||"",spouse_email:l.spouse_email||"",company_name:l.company_name||"",job_title:l.job_title||"",notes:l.notes||"",tagIds:((Ie=l.tags)==null?void 0:Ie.map(Ke=>Ke.relationship_type_id))||[]}),T(!0))},pe=async()=>{await S.mutateAsync({id:e,...O}),T(!1)},ae=async()=>{confirm("Are you sure you want to delete this contact?")&&(await C.mutateAsync(e),t("/mission-control/contacts"))},ge=async()=>{H&&(await A.mutateAsync({contactId:e,actionTypeId:H,notes:Z}),q(!1),K(null),re(""))};return a?r.jsx(Or,{title:"Contact Details",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):l?r.jsx(Or,{title:`${l.first_name} ${l.last_name||""}`,description:"Contact details and activity",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/contacts"),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),de&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>ie&&t(_e(ie)),disabled:!ie,className:"px-2",children:[r.jsx(qc,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only sm:not-sr-only sm:ml-1",children:"Prev"})]}),r.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[ye+1," of ",ne.length]}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>fe&&t(_e(fe)),disabled:!fe,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Ga,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[r.jsxs(J,{variant:"default",onClick:()=>t(`/mission-control/video/record?contact_id=${e}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Fi,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Br,{open:F,onOpenChange:q,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{variant:"outline",children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:p==null?void 0:p.filter(Ie=>Ie.active).map(Ie=>r.jsxs("button",{onClick:()=>K(Ie.id),className:` p-3 rounded-lg border text-left transition-all ${H===Ie.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Ie.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Ie.description})]},Ie.id))})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(ms,{id:"action-notes",value:Z,onChange:Ie=>re(Ie.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(J,{onClick:ge,disabled:!H||A.isPending,className:"w-full",children:[r.jsx(Ca,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(J,{variant:"outline",onClick:ke,children:[r.jsx(rc,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(J,{variant:"destructive",size:"icon",onClick:ae,children:r.jsx(Zn,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"bg-card border rounded-lg p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold",children:[l.first_name," ",l.last_name||""]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[l.email&&r.jsxs("a",{href:`mailto:${l.email}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(Zs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.email})]}),l.phone&&r.jsxs("a",{href:`tel:${l.phone}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.phone})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(cfe,{contact:l}),(Me=l.tags)==null?void 0:Me.map(Ie=>{const Ke=h==null?void 0:h.find(Re=>Re.id===Ie.relationship_type_id);return Ke?r.jsx(Ft,{variant:"secondary",className:"text-xs",children:Ke.name},Ie.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(We,{className:"md:col-span-2",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Contact Information"})}),r.jsx(Xe,{children:E?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"first_name",children:"First Name"}),r.jsx(ct,{id:"first_name",value:O.first_name,onChange:Ie=>z({...O,first_name:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"last_name",children:"Last Name"}),r.jsx(ct,{id:"last_name",value:O.last_name,onChange:Ie=>z({...O,last_name:Ie.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"email",children:"Email"}),r.jsx(ct,{id:"email",type:"email",value:O.email,onChange:Ie=>z({...O,email:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"phone",children:"Phone"}),r.jsx(ct,{id:"phone",value:O.phone,onChange:Ie=>z({...O,phone:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"address",children:"Street Address"}),r.jsx(ct,{id:"address",value:O.address,onChange:Ie=>z({...O,address:Ie.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx(Ve,{htmlFor:"city",children:"City"}),r.jsx(ct,{id:"city",value:O.city,onChange:Ie=>z({...O,city:Ie.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"state",children:"State"}),r.jsx(ct,{id:"state",value:O.state,onChange:Ie=>z({...O,state:Ie.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(ct,{id:"zip_code",value:O.zip_code,onChange:Ie=>z({...O,zip_code:Ie.target.value}),placeholder:"12345"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"birthday",children:"Birthday"}),r.jsx(ct,{id:"birthday",type:"date",value:O.birthday,onChange:Ie=>z({...O,birthday:Ie.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(ct,{id:"home_anniversary",type:"date",value:O.home_anniversary,onChange:Ie=>z({...O,home_anniversary:Ie.target.value})})]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(ct,{id:"spouse_name",value:O.spouse_name,onChange:Ie=>z({...O,spouse_name:Ie.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(ct,{id:"spouse_email",type:"email",value:O.spouse_email,onChange:Ie=>z({...O,spouse_email:Ie.target.value}),placeholder:"Enter spouse email"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"company_name",children:"Company"}),r.jsx(ct,{id:"company_name",value:O.company_name,onChange:Ie=>z({...O,company_name:Ie.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"job_title",children:"Job Title"}),r.jsx(ct,{id:"job_title",value:O.job_title,onChange:Ie=>z({...O,job_title:Ie.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:h==null?void 0:h.filter(Ie=>Ie.active).map(Ie=>{var Ke;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(cc,{checked:(Ke=O.tagIds)==null?void 0:Ke.includes(Ie.id),onCheckedChange:Re=>{var Ce;z(Re?{...O,tagIds:[...O.tagIds||[],Ie.id]}:{...O,tagIds:(Ce=O.tagIds)==null?void 0:Ce.filter(Je=>Je!==Ie.id)})}}),r.jsx("span",{className:"text-sm",children:Ie.name})]},Ie.id)})})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"notes",children:"Notes"}),r.jsx(ms,{id:"notes",value:O.notes,onChange:Ie=>z({...O,notes:Ie.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{onClick:pe,disabled:S.isPending,children:"Save Changes"}),r.jsx(J,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ee.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",fn(new Date(Ee[0].completed_at),"MMM d, yyyy")," ","(",Ee[0].name,")"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[l.email&&r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(Zs,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`mailto:${l.email}`,className:"text-primary hover:underline truncate",children:l.email})]}),l.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ca,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`tel:${l.phone}`,className:"text-primary hover:underline",children:l.phone})]})]}),(l.address||l.city||l.state||l.zip_code)&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(pl,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex flex-col",children:[l.address&&r.jsx("span",{children:l.address}),(l.city||l.state||l.zip_code)&&r.jsxs("span",{className:"text-muted-foreground",children:[[l.city,l.state].filter(Boolean).join(", "),l.zip_code&&` ${l.zip_code}`]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.birthday&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",fn(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",fn(new Date(l.home_anniversary),"MMMM d")]})]})]}),(l.spouse_name||l.spouse_email||l.company_name||l.job_title)&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(l.spouse_name||l.spouse_email)&&r.jsxs("div",{className:"space-y-1",children:[l.spouse_name&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Spouse: ",l.spouse_name]})]}),l.spouse_email&&r.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[r.jsx(Zs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:`mailto:${l.spouse_email}`,className:"text-primary hover:underline",children:l.spouse_email})]})]}),(l.company_name||l.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:l.job_title&&l.company_name?`${l.job_title} at ${l.company_name}`:l.job_title||l.company_name})]})]})]}),r.jsx(Qd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(Ue=l.tags)!=null&&Ue.length?l.tags.map(Ie=>{var Ke;return r.jsx(Ft,{variant:"secondary",children:(Ke=Ie.relationship_type)==null?void 0:Ke.name},Ie.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:l.notes})]})]})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(zjt,{contact:l,onLogTouch:()=>q(!0)}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Activity Log"})}),r.jsx(Xe,{children:Ee.length>0?r.jsx("div",{className:"space-y-4",children:Ee.map(Ie=>{var Ke;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[r.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:Ie.color},children:Ie.type==="popby"?r.jsx(Va,{className:"h-4 w-4"}):(Ke=Ie.name)==null?void 0:Ke.charAt(0)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:Ie.name}),Ie.videoId&&r.jsxs(J,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>he(Ie.videoId),children:[r.jsx(Sc,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:fn(new Date(Ie.completed_at),"MMM d, yyyy h:mm a")}),Ie.notes&&!Ie.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ie.notes})]})]},Ie.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),w&&w.length>0&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Po,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:w.map(Ie=>{var Ke,Re;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Ke=Ie.video)!=null&&Ke.thumbnail_url?r.jsx("img",{src:Ie.video.thumbnail_url,alt:Ie.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>he(Ie.video_id)}):r.jsx("div",{className:"h-12 w-16 bg-muted rounded flex items-center justify-center cursor-pointer hover:bg-muted/80 transition-colors",onClick:()=>he(Ie.video_id),children:r.jsx(Fi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:["Replied to: ",((Re=Ie.video)==null?void 0:Re.title)||"Untitled Video"]}),r.jsxs(J,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>he(Ie.video_id),children:[r.jsx(Sc,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:fn(new Date(Ie.created_at),"MMM d, yyyy h:mm a")}),Ie.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Ie.message,'"']})]})]},Ie.id)})})})]})]}),r.jsx(Br,{open:!!ue,onOpenChange:Ie=>!Ie&&he(null),children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Video Preview"})}),ue&&r.jsx(okt,{videoId:ue})]})})]})]})}):r.jsx(Or,{title:"Contact Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This contact was not found."}),r.jsx(J,{onClick:()=>t("/mission-control/contacts"),children:"Back to Contacts"})]})})}const p4e={Crown:o1,FileText:Ai,Users:Kn,Globe:Ux,Star:vs,Phone:ca,MessageSquare:Po,PenTool:xj,Video:Fi,Gift:Va},Rce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ckt(){var wt,Ct;const e=ns(),{user:t}=zr(),{data:n}=Bg(),{data:s}=Dft(),{data:i}=qft(),{data:o}=fOe(),{data:l}=bxe(),{data:a}=Oft(),h=Vft(),p=Rft(),x=zft(),y=Bft(),w=$ft(),j=Uft(),S=Fft(),[C,A]=P.useState(null),[E,T]=P.useState(!1),[O,z]=P.useState(null),[F,q]=P.useState(""),[H,K]=P.useState(""),[Z,re]=P.useState([]),[ue,he]=P.useState(null),[be,ne]=P.useState(null),[ye,ie]=P.useState(!1),[fe,de]=P.useState(""),[_e,Ee]=P.useState(""),[ke,pe]=P.useState(""),[ae,ge]=P.useState(""),Me=(It,jt)=>i==null?void 0:i.some(rr=>rr.plan_id===It&&rr.relationship_type_id===jt&&rr.active),Ue=It=>i==null?void 0:i.find(jt=>jt.relationship_type_id===It&&jt.active),Ie=async(It,jt)=>{const rr=Me(It,jt);await h.mutateAsync({planId:It,relationshipTypeId:jt,active:!rr})},Ke=(s==null?void 0:s.filter(It=>It.active&&!It.owner_user_id))||[],Re=(s==null?void 0:s.filter(It=>It.owner_user_id===(t==null?void 0:t.id)))||[],Ce=n==null?void 0:n.find(It=>It.id===C),Je=C?Ue(C):null,Te=s==null?void 0:s.find(It=>It.id===(Je==null?void 0:Je.plan_id)),Ye=async()=>{if(!F.trim())return;const It=await p.mutateAsync({name:F,description:H});It&&Z.length>0&&await w.mutateAsync({planId:It.id,items:Z}),et()},xe=async()=>{!F.trim()||!O||(await x.mutateAsync({id:O,name:F,description:H}),await w.mutateAsync({planId:O,items:Z}),et())},mt=It=>{var jt;z(It.id),q(It.name),K(It.description||""),re(((jt=It.items)==null?void 0:jt.map(rr=>({month_number:rr.month_number,action_type_id:rr.action_type_id,default_script_id:rr.default_script_id||void 0,notes:rr.notes||void 0})))||[]),T(!0)},et=()=>{T(!1),z(null),q(""),K(""),re([])},nt=(It,jt)=>{ne(jt)},Ae=(It,jt,rr)=>{re(Ar=>[...Ar.filter(kn=>kn.month_number!==It),{month_number:It,action_type_id:jt,default_script_id:rr}]),he(null),ne(null)},pt=It=>{re(jt=>jt.filter(rr=>rr.month_number!==It))},Be=async()=>{if(!fe.trim()||!_e.trim()||!be)return;const It=await j.mutateAsync({actionTypeId:be,title:fe,scriptBody:_e,emailSubject:ke||void 0,tone:ae||void 0});It&&ue!==null&&Ae(ue,be,It.id),ie(!1),de(""),Ee(""),pe(""),ge("")},Qe=be?a==null?void 0:a.filter(It=>It.action_type_id===be&&It.active):[],tt=It=>p4e[It||"Phone"]||ca,ht=It=>p4e[It||"Users"]||Kn;return r.jsxs(Or,{title:"Touchpoint Plans",description:"Assign plans to your contact groups",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Touchpoint Plans"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control"),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(J,{onClick:()=>T(!0),className:"w-full sm:w-auto",children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Custom Plan"]})]}),r.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Your Contact Groups"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a group to assign a touchpoint plan"}),n==null?void 0:n.filter(It=>It.active).map(It=>{const jt=ht(It.icon),rr=(o==null?void 0:o[It.id])||0,Ar=Ue(It.id),gn=s==null?void 0:s.find(Jr=>Jr.id===(Ar==null?void 0:Ar.plan_id)),kn=C===It.id;return r.jsxs("button",{onClick:()=>A(It.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${kn?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(jt,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium",children:It.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[rr," contacts"]})]}),gn?r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:[r.jsx(qa,{className:"h-3 w-3 mr-1"}),gn.name.split(" ")[0]]}):r.jsx(Ft,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},It.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:C&&Ce?r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[(()=>{const It=ht(Ce.icon);return r.jsx(It,{className:"h-5 w-5"})})(),Ce.name," Touchpoint Plan"]}),r.jsxs(En,{children:["Choose a plan for your ",Ce.name," contacts"]})]}),r.jsxs(Xe,{className:"space-y-6",children:[Te&&r.jsxs("div",{className:"p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"font-medium flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Te.name]}),Te.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Te.description})]}),r.jsx(J,{variant:"outline",size:"sm",onClick:()=>Ie(Te.id,C),children:"Disable"})]}),Te.items&&Te.items.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:Rce.map((It,jt)=>{var kn,Jr;const rr=((kn=Te.items)==null?void 0:kn.filter(zn=>zn.month_number===jt+1))||[],Ar=(Jr=rr[0])==null?void 0:Jr.action_type,gn=Ar?tt(Ar.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${rr.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:It}),gn&&r.jsx(gn,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Ar==null?void 0:Ar.color)||"#3B82F6"}})]},jt)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Te?"Switch to a Different Plan":"Choose a Plan"}),Ke.length>0&&r.jsxs("div",{className:"space-y-2 mb-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"Pre-built Templates"}),Ke.map(It=>{var rr;const jt=(Te==null?void 0:Te.id)===It.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${jt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:It.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((rr=It.items)==null?void 0:rr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:S.isPending,onClick:()=>{const Ar=`${It.name} (Copy)`;S.mutate({sourcePlanId:It.id,newName:Ar})},children:r.jsx(jl,{className:"h-4 w-4"})}),r.jsx(J,{size:"sm",variant:jt?"outline":"default",disabled:jt||h.isPending,onClick:()=>Ie(It.id,C),children:jt?"Active":"Use This"})]})]},It.id)})]}),Re.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Re.map(It=>{var rr;const jt=(Te==null?void 0:Te.id)===It.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${jt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:It.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((rr=It.items)==null?void 0:rr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>mt(It),children:r.jsx(f0,{className:"h-4 w-4"})}),r.jsx(J,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(It.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})}),r.jsx(J,{size:"sm",variant:jt?"outline":"default",disabled:jt||h.isPending,onClick:()=>Ie(It.id,C),children:jt?"Active":"Use This"})]})]},It.id)})]}),Ke.length===0&&Re.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No plans available. Create a custom plan to get started."})]})]})]}):r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Ys,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a contact group to view and assign plans"})]})})})]}),r.jsx(We,{className:"bg-muted/50",children:r.jsx(Xe,{className:"py-4",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.jsx("strong",{children:"How it works:"})," When you assign a plan to a contact group, those contacts will appear in your daily suggested actions based on the plan's schedule."]})})})]}),r.jsx(Br,{open:E,onOpenChange:It=>{It?T(!0):et()},children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:O?"Edit Touchpoint Plan":"Create Custom Touchpoint Plan"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(ct,{id:"plan-name",value:F,onChange:It=>q(It.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(ms,{id:"plan-description",value:H,onChange:It=>K(It.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"12-Month Schedule"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Click on a month to add a touchpoint"}),r.jsx("div",{className:"grid grid-cols-6 gap-2",children:Rce.map((It,jt)=>{const rr=jt+1,Ar=Z.find(Jr=>Jr.month_number===rr),gn=Ar?l==null?void 0:l.find(Jr=>Jr.id===Ar.action_type_id):null,kn=gn?tt(gn.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>he(ue===rr?null:rr),className:` w-full p-3 rounded-lg border text-center transition-all ${Ar?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${ue===rr?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:It}),kn?r.jsx(kn,{className:"h-5 w-5 mx-auto mt-1",style:{color:(gn==null?void 0:gn.color)||"#3B82F6"}}):r.jsx(jn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Ar&&r.jsx("button",{type:"button",onClick:Jr=>{Jr.stopPropagation(),pt(rr)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(Ts,{className:"h-3 w-3"})})]},jt)})}),ue!==null&&!be&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"text-sm font-medium mb-2",children:["Step 1: Select action for ",Rce[ue-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(It=>It.active).map(It=>{const jt=tt(It.icon);return r.jsxs("button",{type:"button",onClick:()=>nt(ue,It.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(jt,{className:"h-4 w-4",style:{color:It.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:It.name})]},It.id)})})]}),ue!==null&&be&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-sm font-medium",children:"Step 2: Select a script (optional)"}),r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>ne(null),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"})," Back"]})]}),r.jsxs("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-1",children:[r.jsx("button",{type:"button",onClick:()=>Ae(ue,be),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"No Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Use without a predefined script"})]})}),Qe==null?void 0:Qe.map(It=>r.jsx("button",{type:"button",onClick:()=>Ae(ue,be,It.id),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:It.title}),It.tone&&r.jsx(Ft,{variant:"secondary",className:"text-xs mt-1",children:It.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[It.script_body.substring(0,100),"..."]})]})},It.id)),r.jsxs("button",{type:"button",onClick:()=>ie(!0),className:"w-full flex items-center gap-3 p-3 rounded-lg border border-dashed bg-background hover:bg-accent transition-colors text-left",children:[r.jsx(jn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"Create Custom Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Write your own script for this action"})]})]})]})]})]}),Z.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.length," touchpoint",Z.length!==1?"s":""," per year"]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:et,children:"Cancel"}),r.jsxs(J,{onClick:O?xe:Ye,disabled:!F.trim()||p.isPending||x.isPending,children:[r.jsx(bg,{className:"h-4 w-4 mr-2"}),O?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Br,{open:ye,onOpenChange:ie,children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script-title",children:"Script Title"}),r.jsx(ct,{id:"script-title",value:fe,onChange:It=>de(It.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(bn,{value:ae,onValueChange:ge,children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select tone..."})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"friendly",children:"Friendly"}),r.jsx(Kt,{value:"professional",children:"Professional"}),r.jsx(Kt,{value:"casual",children:"Casual"}),r.jsx(Kt,{value:"formal",children:"Formal"})]})]})]}),((Ct=(wt=l==null?void 0:l.find(It=>It.id===be))==null?void 0:wt.name)==null?void 0:Ct.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(ct,{id:"script-email-subject",value:ke,onChange:It=>pe(It.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(Ve,{htmlFor:"script-body",children:"Script Content"}),r.jsx(ms,{id:"script-body",value:_e,onChange:It=>Ee(It.target.value),placeholder:"Write your script here... You can use {{FirstName}} and {{LastName}} as placeholders.",rows:6}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Tip: Use ","{{FirstName}}"," and ","{{LastName}}"," as placeholders"]})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>ie(!1),children:"Cancel"}),r.jsxs(J,{onClick:Be,disabled:!fe.trim()||!_e.trim()||j.isPending,children:[r.jsx(bg,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const dkt="0dde5abb-0005-4c8c-a471-30d0cbc9e280",ukt=[{value:"30",label:"Monthly (30 days)"},{value:"60",label:"Bi-Monthly (60 days)"},{value:"90",label:"Quarterly (90 days)"},{value:"180",label:"Twice a Year (180 days)"},{value:"365",label:"Yearly (365 days)"}];function hkt(){const e=ns(),t=Eze(),{data:n}=Mze(),{data:s}=Bg(),{data:i}=jye(),{data:o}=Gse(90),{data:l}=op(),a=Rjt(),h=Ize(),p=Ojt(),x=Djt(),{data:y=[],isLoading:w}=Jt({queryKey:["popby-templates"],queryFn:async()=>{const{data:ye,error:ie}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",dkt).order("publish_date",{ascending:!1});if(ie)throw ie;const{data:fe}=await ee.from("template_likes").select("template_id"),{data:de}=await ee.from("template_comments").select("template_id"),_e=new Map;fe==null||fe.forEach(ke=>{_e.set(ke.template_id,(_e.get(ke.template_id)||0)+1)});const Ee=new Map;return de==null||de.forEach(ke=>{Ee.set(ke.template_id,(Ee.get(ke.template_id)||0)+1)}),(ye||[]).map(ke=>({...ke,likesCount:_e.get(ke.id)||0,commentsCount:Ee.get(ke.id)||0}))}}),j=ye=>{const ie=l==null?void 0:l.find(fe=>fe.id===ye);return ie?`${ie.first_name} ${ie.last_name||""}`.trim():"Unknown"},S=ye=>{if(!ye)return null;const ie=n==null?void 0:n.find(fe=>fe.id===ye);return(ie==null?void 0:ie.name)||null},[C,A]=P.useState(null),[E,T]=P.useState(!1),[O,z]=P.useState(!1),[F,q]=P.useState(!1),[H,K]=P.useState({popby_item_id:"",notes:""}),[Z,re]=P.useState({name:"",description:""}),ue=async()=>{C&&(await h.mutateAsync({contact_id:C.id,popby_item_id:H.popby_item_id||void 0,notes:H.notes||void 0}),T(!1),A(null),K({popby_item_id:"",notes:""}))},he=async()=>{Z.name.trim()&&(await p.mutateAsync({name:Z.name.trim(),description:Z.description.trim()||void 0}),q(!1),re({name:"",description:""}))},be=async(ye,ie)=>{await x.mutateAsync({relationship_type_id:ye,frequency_days:parseInt(ie)})},ne=ye=>{var fe;const ie=i==null?void 0:i.find(de=>de.relationship_type_id===ye);return((fe=ie==null?void 0:ie.frequency_days)==null?void 0:fe.toString())||"90"};return r.jsx(Or,{title:"Popbys",description:"Drop off gifts to stay top of mind",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Popbys"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:a.thisWeekCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:a.thisMonthCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-amber-500",children:a.dueCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Now"})]})})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(J,{onClick:()=>e("/mission-control/popbys/map"),children:[r.jsx(pl,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(J,{variant:"outline",onClick:()=>z(!0),children:[r.jsx(hd,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(J,{variant:"outline",onClick:()=>q(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(ba,{defaultValue:"due",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"due",children:"Due for Popby"}),r.jsx(ln,{value:"activity",children:"Recent Activity"}),r.jsx(ln,{value:"library",children:"Popby Library"}),r.jsx(ln,{value:"templates",children:"Popby Templates"})]}),r.jsx(An,{value:"due",className:"space-y-4 mt-4",children:!t||t.length===0?r.jsx(We,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Va,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No contacts due for a popby right now!"}),r.jsx("p",{className:"text-sm mt-1",children:"Great job staying connected."})]})}):r.jsx("div",{className:"space-y-3",children:t.map(ye=>r.jsx(We,{className:"hover:shadow-md transition-shadow",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium",children:[ye.first_name," ",ye.last_name]}),ye.daysOverdue>0&&r.jsxs(Ft,{variant:"destructive",className:"text-xs",children:[ye.daysOverdue,"+ days overdue"]}),ye.daysSinceLastPopby===null&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Never visited"})]}),r.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-muted-foreground",children:[ye.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pl,{className:"h-3 w-3"}),ye.city||ye.address]}),ye.tags&&ye.tags.length>0&&r.jsx("span",{children:ye.tags.map(ie=>{var fe;return(fe=ie.relationship_type)==null?void 0:fe.name}).join(", ")})]}),ye.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",fn(new Date(ye.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[ye.phone&&r.jsx(J,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${ye.phone}`,children:r.jsx(ca,{className:"h-4 w-4"})})}),r.jsxs(J,{size:"sm",onClick:()=>{A(ye),T(!0)},children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},ye.id))})}),r.jsx(An,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(We,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ki,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby activity yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Start logging popbys to see your history here."})]})}):r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(Xe,{className:"space-y-3",children:o.map(ye=>r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:r.jsx(Va,{className:"h-5 w-5 text-orange-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium",children:j(ye.contact_id)}),S(ye.popby_item_id)&&r.jsx(Ft,{variant:"secondary",className:"text-xs",children:S(ye.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:fn(new Date(ye.completed_at),"MMM d, yyyy h:mm a")}),ye.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ye.notes})]})]},ye.id))})]})}),r.jsx(An,{value:"library",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[n==null?void 0:n.map(ye=>r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Va,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:ye.name}),ye.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ye.description}),!ye.owner_user_id&&r.jsx(Ft,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},ye.id)),r.jsx(We,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>q(!0),children:r.jsx(Xe,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(jn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(An,{value:"templates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:[y.length," template",y.length!==1?"s":""," found"]}),w&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(4)].map((ye,ie)=>r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Pr,{className:"h-5 w-16"}),r.jsx(Pr,{className:"h-5 w-20"})]})]})},ie))}),!w&&y.length===0&&r.jsx(We,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby templates available yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!w&&y.length>0&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:y.map(ye=>r.jsxs(We,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>e(`/templates/${ye.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:ye.preview_image_url?r.jsx("img",{src:ye.preview_image_url,alt:ye.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"})}),r.jsxs(Xe,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:ye.name}),ye.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Ane(ye.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"PopBys"})}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Od,{className:"h-3.5 w-3.5"}),ye.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Zl,{className:"h-3.5 w-3.5"}),ye.commentsCount]})]}),r.jsxs(J,{size:"sm",className:"w-full gap-2",onClick:ie=>{ie.stopPropagation(),e(`/templates/${ye.id}`)},children:[r.jsx(Ls,{className:"h-4 w-4"}),"View Template"]})]})]},ye.id))})]})]}),r.jsx(Br,{open:E,onOpenChange:T,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Log Popby for ",C==null?void 0:C.first_name," ",C==null?void 0:C.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Popby Item (optional)"}),r.jsxs(bn,{value:H.popby_item_id,onValueChange:ye=>K(ie=>({...ie,popby_item_id:ye})),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select a popby item..."})}),r.jsx(_n,{children:n==null?void 0:n.map(ye=>r.jsx(Kt,{value:ye.id,children:ye.name},ye.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Notes (optional)"}),r.jsx(ms,{placeholder:"Any notes about this popby...",value:H.notes,onChange:ye=>K(ie=>({...ie,notes:ye.target.value}))})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(J,{onClick:ue,disabled:h.isPending,children:"Log Popby"})]})]})}),r.jsx(Br,{open:O,onOpenChange:z,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Popby Frequency Settings"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Set default popby frequency for each relationship type. You can override these per-contact."}),s==null?void 0:s.map(ye=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(Ve,{className:"font-medium",children:ye.name}),r.jsxs(bn,{value:ne(ye.id),onValueChange:ie=>be(ye.id,ie),children:[r.jsx(vn,{className:"w-[180px]",children:r.jsx(wn,{})}),r.jsx(_n,{children:ukt.map(ie=>r.jsx(Kt,{value:ie.value,children:ie.label},ie.value))})]})]},ye.id))]}),r.jsx(ri,{children:r.jsx(J,{onClick:()=>z(!1),children:"Done"})})]})}),r.jsx(Br,{open:F,onOpenChange:q,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Name *"}),r.jsx(ct,{placeholder:"e.g., Homemade cookies",value:Z.name,onChange:ye=>re(ie=>({...ie,name:ye.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(ms,{placeholder:"Optional description...",value:Z.description,onChange:ye=>re(ie=>({...ie,description:ye.target.value}))})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(J,{onClick:he,disabled:!Z.name.trim()||p.isPending,children:"Add Item"})]})]})})]})})}var Oze={exports:{}};(function(e,t){(function(n,s){e.exports=s()})(Ax,function(){var n,s,i;function o(a,h){if(!n)n=h;else if(!s)s=h;else{var p="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+n+")(sharedChunk); ("+s+")(sharedChunk); self.onerror = null;",x={};n(x),i=h(x),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([p],{type:"text/javascript"})))}}o(["exports"],function(a){var h=1e-6,p=typeof Float32Array<"u"?Float32Array:Array;function x(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],N=u*k-v*g;return N?(f[0]=k*(N=1/N),f[1]=-g*N,f[2]=-v*N,f[3]=u*N,f):null}function y(){var f=new p(9);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[5]=0,f[6]=0,f[7]=0),f[0]=1,f[4]=1,f[8]=1,f}function w(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],N=c[4],I=c[5],R=c[6],$=c[7],W=c[8];return f[0]=N*W-I*$,f[1]=v*$-g*W,f[2]=g*I-v*N,f[3]=I*R-k*W,f[4]=u*W-v*R,f[5]=v*k-u*I,f[6]=k*$-N*R,f[7]=g*R-u*$,f[8]=u*N-g*k,f}function j(f,c,u){var g=c[0],v=c[1],k=c[2],N=c[3],I=c[4],R=c[5],$=c[6],W=c[7],G=c[8],X=u[0],te=u[1],se=u[2],me=u[3],Se=u[4],Ne=u[5],Oe=u[6],Fe=u[7],He=u[8];return f[0]=X*g+te*N+se*$,f[1]=X*v+te*I+se*W,f[2]=X*k+te*R+se*G,f[3]=me*g+Se*N+Ne*$,f[4]=me*v+Se*I+Ne*W,f[5]=me*k+Se*R+Ne*G,f[6]=Oe*g+Fe*N+He*$,f[7]=Oe*v+Fe*I+He*W,f[8]=Oe*k+Fe*R+He*G,f}function S(){var f=new p(16);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=0,f[12]=0,f[13]=0,f[14]=0),f[0]=1,f[5]=1,f[10]=1,f[15]=1,f}function C(f){var c=new p(16);return c[0]=f[0],c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=f[6],c[7]=f[7],c[8]=f[8],c[9]=f[9],c[10]=f[10],c[11]=f[11],c[12]=f[12],c[13]=f[13],c[14]=f[14],c[15]=f[15],c}function A(f){return f[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function E(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],N=c[4],I=c[5],R=c[6],$=c[7],W=c[8],G=c[9],X=c[10],te=c[11],se=c[12],me=c[13],Se=c[14],Ne=c[15],Oe=u*I-g*N,Fe=u*R-v*N,He=u*$-k*N,dt=g*R-v*I,it=g*$-k*I,gt=v*$-k*R,Nt=W*me-G*se,Tt=W*Se-X*se,Gt=W*Ne-te*se,Dt=G*Se-X*me,tr=G*Ne-te*me,or=X*Ne-te*Se,lr=Oe*or-Fe*tr+He*Dt+dt*Gt-it*Tt+gt*Nt;return lr?(f[0]=(I*or-R*tr+$*Dt)*(lr=1/lr),f[1]=(v*tr-g*or-k*Dt)*lr,f[2]=(me*gt-Se*it+Ne*dt)*lr,f[3]=(X*it-G*gt-te*dt)*lr,f[4]=(R*Gt-N*or-$*Tt)*lr,f[5]=(u*or-v*Gt+k*Tt)*lr,f[6]=(Se*He-se*gt-Ne*Fe)*lr,f[7]=(W*gt-X*He+te*Fe)*lr,f[8]=(N*tr-I*Gt+$*Nt)*lr,f[9]=(g*Gt-u*tr-k*Nt)*lr,f[10]=(se*it-me*He+Ne*Oe)*lr,f[11]=(G*He-W*it-te*Oe)*lr,f[12]=(I*Tt-N*Dt-R*Nt)*lr,f[13]=(u*Dt-g*Tt+v*Nt)*lr,f[14]=(me*Fe-se*dt-Se*Oe)*lr,f[15]=(W*dt-G*Fe+X*Oe)*lr,f):null}function T(f,c,u){var g=c[0],v=c[1],k=c[2],N=c[3],I=c[4],R=c[5],$=c[6],W=c[7],G=c[8],X=c[9],te=c[10],se=c[11],me=c[12],Se=c[13],Ne=c[14],Oe=c[15],Fe=u[0],He=u[1],dt=u[2],it=u[3];return f[0]=Fe*g+He*I+dt*G+it*me,f[1]=Fe*v+He*R+dt*X+it*Se,f[2]=Fe*k+He*$+dt*te+it*Ne,f[3]=Fe*N+He*W+dt*se+it*Oe,f[4]=(Fe=u[4])*g+(He=u[5])*I+(dt=u[6])*G+(it=u[7])*me,f[5]=Fe*v+He*R+dt*X+it*Se,f[6]=Fe*k+He*$+dt*te+it*Ne,f[7]=Fe*N+He*W+dt*se+it*Oe,f[8]=(Fe=u[8])*g+(He=u[9])*I+(dt=u[10])*G+(it=u[11])*me,f[9]=Fe*v+He*R+dt*X+it*Se,f[10]=Fe*k+He*$+dt*te+it*Ne,f[11]=Fe*N+He*W+dt*se+it*Oe,f[12]=(Fe=u[12])*g+(He=u[13])*I+(dt=u[14])*G+(it=u[15])*me,f[13]=Fe*v+He*R+dt*X+it*Se,f[14]=Fe*k+He*$+dt*te+it*Ne,f[15]=Fe*N+He*W+dt*se+it*Oe,f}function O(f,c,u){var g,v,k,N,I,R,$,W,G,X,te,se,me=u[0],Se=u[1],Ne=u[2];return c===f?(f[12]=c[0]*me+c[4]*Se+c[8]*Ne+c[12],f[13]=c[1]*me+c[5]*Se+c[9]*Ne+c[13],f[14]=c[2]*me+c[6]*Se+c[10]*Ne+c[14],f[15]=c[3]*me+c[7]*Se+c[11]*Ne+c[15]):(v=c[1],k=c[2],N=c[3],I=c[4],R=c[5],$=c[6],W=c[7],G=c[8],X=c[9],te=c[10],se=c[11],f[0]=g=c[0],f[1]=v,f[2]=k,f[3]=N,f[4]=I,f[5]=R,f[6]=$,f[7]=W,f[8]=G,f[9]=X,f[10]=te,f[11]=se,f[12]=g*me+I*Se+G*Ne+c[12],f[13]=v*me+R*Se+X*Ne+c[13],f[14]=k*me+$*Se+te*Ne+c[14],f[15]=N*me+W*Se+se*Ne+c[15]),f}function z(f,c,u){var g=u[0],v=u[1],k=u[2];return f[0]=c[0]*g,f[1]=c[1]*g,f[2]=c[2]*g,f[3]=c[3]*g,f[4]=c[4]*v,f[5]=c[5]*v,f[6]=c[6]*v,f[7]=c[7]*v,f[8]=c[8]*k,f[9]=c[9]*k,f[10]=c[10]*k,f[11]=c[11]*k,f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15],f}function F(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[4],N=c[5],I=c[6],R=c[7],$=c[8],W=c[9],G=c[10],X=c[11];return c!==f&&(f[0]=c[0],f[1]=c[1],f[2]=c[2],f[3]=c[3],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[4]=k*v+$*g,f[5]=N*v+W*g,f[6]=I*v+G*g,f[7]=R*v+X*g,f[8]=$*v-k*g,f[9]=W*v-N*g,f[10]=G*v-I*g,f[11]=X*v-R*g,f}function q(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],N=c[1],I=c[2],R=c[3],$=c[8],W=c[9],G=c[10],X=c[11];return c!==f&&(f[4]=c[4],f[5]=c[5],f[6]=c[6],f[7]=c[7],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v-$*g,f[1]=N*v-W*g,f[2]=I*v-G*g,f[3]=R*v-X*g,f[8]=k*g+$*v,f[9]=N*g+W*v,f[10]=I*g+G*v,f[11]=R*g+X*v,f}function H(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],N=c[1],I=c[2],R=c[3],$=c[4],W=c[5],G=c[6],X=c[7];return c!==f&&(f[8]=c[8],f[9]=c[9],f[10]=c[10],f[11]=c[11],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v+$*g,f[1]=N*v+W*g,f[2]=I*v+G*g,f[3]=R*v+X*g,f[4]=$*v-k*g,f[5]=W*v-N*g,f[6]=G*v-I*g,f[7]=X*v-R*g,f}function K(f,c){return f[0]=c[0],f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=c[1],f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=c[2],f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function Z(f,c,u){var g,v,k,N=u[0],I=u[1],R=u[2],$=Math.sqrt(N*N+I*I+R*R);return $0&&(k=1/Math.sqrt(k)),f[0]=c[0]*k,f[1]=c[1]*k,f[2]=c[2]*k,f}function Ce(f,c){return f[0]*c[0]+f[1]*c[1]+f[2]*c[2]}function Je(f,c,u){var g=c[0],v=c[1],k=c[2],N=u[0],I=u[1],R=u[2];return f[0]=v*R-k*I,f[1]=k*N-g*R,f[2]=g*I-v*N,f}function Te(f,c,u,g){var v=c[0],k=c[1],N=c[2];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=N+g*(u[2]-N),f}function Ye(f,c,u){var g=c[0],v=c[1],k=c[2],N=u[3]*g+u[7]*v+u[11]*k+u[15];return f[0]=(u[0]*g+u[4]*v+u[8]*k+u[12])/(N=N||1),f[1]=(u[1]*g+u[5]*v+u[9]*k+u[13])/N,f[2]=(u[2]*g+u[6]*v+u[10]*k+u[14])/N,f}function xe(f,c,u){var g=c[0],v=c[1],k=c[2];return f[0]=g*u[0]+v*u[3]+k*u[6],f[1]=g*u[1]+v*u[4]+k*u[7],f[2]=g*u[2]+v*u[5]+k*u[8],f}function mt(f,c,u){var g=u[0],v=u[1],k=u[2],N=u[3],I=c[0],R=c[1],$=c[2],W=v*$-k*R,G=k*I-g*$,X=g*R-v*I;return f[0]=I+N*(W+=W)+v*(X+=X)-k*(G+=G),f[1]=R+N*G+k*W-g*X,f[2]=$+N*X+g*G-v*W,f}function et(f){return f[0]=0,f[1]=0,f[2]=0,f}function nt(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var Ae=_e,pt=Ee,Be=ye;function Qe(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function tt(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f[2]=c[2]*u,f[3]=c[3]*u,f}function ht(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],N=u*u+g*g+v*v+k*k;return N>0&&(N=1/Math.sqrt(N)),f[0]=u*N,f[1]=g*N,f[2]=v*N,f[3]=k*N,f}function wt(f,c,u){var g=c[0],v=c[1],k=c[2],N=c[3];return f[0]=u[0]*g+u[4]*v+u[8]*k+u[12]*N,f[1]=u[1]*g+u[5]*v+u[9]*k+u[13]*N,f[2]=u[2]*g+u[6]*v+u[10]*k+u[14]*N,f[3]=u[3]*g+u[7]*v+u[11]*k+u[15]*N,f}function Ct(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),f[3]=1,f}function It(f){return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f}function jt(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],N=c[3],I=Math.sin(u),R=Math.cos(u);return f[0]=g*R+N*I,f[1]=v*R+k*I,f[2]=k*R-v*I,f[3]=N*R-g*I,f}function rr(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],N=c[3],I=Math.sin(u),R=Math.cos(u);return f[0]=g*R-k*I,f[1]=v*R+N*I,f[2]=k*R+g*I,f[3]=N*R-v*I,f}be(),Qe();var Ar,gn,kn,Jr=ht,zn=(Ar=be(),gn=ie(1,0,0),kn=ie(0,1,0),function(f,c,u){var g=Ce(c,u);return g<-.999999?(Je(Ar,gn,c),Be(Ar)<1e-6&&Je(Ar,kn,c),Re(Ar,Ar),function(v,k,N){N*=.5;var I=Math.sin(N);v[0]=I*k[0],v[1]=I*k[1],v[2]=I*k[2],v[3]=Math.cos(N)}(f,Ar,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(Je(Ar,c,u),f[0]=Ar[0],f[1]=Ar[1],f[2]=Ar[2],f[3]=1+g,Jr(f,f))});function js(){var f=new p(2);return p!=Float32Array&&(f[0]=0,f[1]=0),f}function fr(f,c){var u=new p(2);return u[0]=f,u[1]=c,u}function xs(f,c,u){return f[0]=c,f[1]=u,f}function bi(f,c,u){return f[0]=c[0]+u[0],f[1]=c[1]+u[1],f}function mi(f,c,u){return f[0]=c[0]-u[0],f[1]=c[1]-u[1],f}function La(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f}function da(f){var c=f[0],u=f[1];return Math.sqrt(c*c+u*u)}function tl(f,c){var u=c[0],g=c[1],v=u*u+g*g;return v>0&&(v=1/Math.sqrt(v)),f[0]=c[0]*v,f[1]=c[1]*v,f}function rl(f,c){return f[0]*c[0]+f[1]*c[1]}Ct(),Ct(),y();var Ws,Zi,ks=mi;function Ei(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}js();var Ii=function(){if(Zi)return Ws;function f(c,u,g,v){this.cx=3*c,this.bx=3*(g-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*u,this.by=3*(v-u)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=u,this.p2x=g,this.p2y=v}return Zi=1,Ws=f,f.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,u){if(u===void 0&&(u=1e-6),c<0)return 0;if(c>1)return 1;for(var g=c,v=0;v<8;v++){var k=this.sampleCurveX(g)-c;if(Math.abs(k)k?I=g:R=g,g=.5*(R-I)+I;return g},solve:function(c,u){return this.sampleCurveY(this.solveCurveX(c,u))}},Ws}(),Oo=Ei(Ii);function ir(f,c){this.x=f,this.y=c}function xo(f,c){if(Array.isArray(f)){if(!Array.isArray(c)||f.length!==c.length)return!1;for(let u=0;u=1)return 1;const c=f*f,u=c*f;return 4*(f<.5?u:3*(f-c)+u-.75)}function Vn(f,c,u,g){const v=new Oo(f,c,u,g);return function(k){return v.solve(k)}}const kt=Vn(.25,.1,.25,1);function we(f,c,u){return Math.min(u,Math.max(c,f))}function De(f,c,u){return(u=we((u-f)/(c-f),0,1))*u*(3-2*u)}function Ge(f,c,u){const g=u-c,v=((f-c)%g+g)%g+c;return v===c?u:v}function _t(f,c,u){if(!f.length)return u(null,[]);let g=f.length;const v=new Array(f.length);let k=null;f.forEach((N,I)=>{c(N,(R,$)=>{R&&(k=R),v[I]=$,--g==0&&u(k,v)})})}let yt=1;function At(){return yt++}function Bt(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log2(f)))}function Lt(f,c){f.forEach(u=>{c[u]&&(c[u]=c[u].bind(c))})}function Ut(f,c,u){const g={};for(const v in f)g[v]=c.call(this,f[v],v,f);return g}function gr(f,c,u){const g={};for(const v in f)c.call(this,f[v],v,f)&&(g[v]=f[v]);return g}function ar(f){return Array.isArray(f)?f.map(ar):typeof f=="object"&&f?Ut(f,ar):f}function Xr(f,c){for(let u=0;u=0)return!0;return!1}const tn={};function Vr(f){tn[f]||(typeof console<"u"&&console.warn(f),tn[f]=!0)}function ts(f,c,u){return(u.y-f.y)*(c.x-f.x)>(c.y-f.y)*(u.x-f.x)}function Xn(f){let c=0;for(let u,g,v=0,k=f.length,N=k-1;v@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(u,g,v,k)=>{const N=v||k;return c[g]=!N||N.toLowerCase(),""}),c["max-age"]){const u=parseInt(c["max-age"],10);isNaN(u)?delete c["max-age"]:c["max-age"]=u}return c}let Ka=null;function Oa(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function ho(f,c,u,g){for(;c>1;f[v]>1;f[v]<=g?c=v+1:u=v}return c}function Gs(f){return f>0?1/(1.001-f):1+f}function ma(f){return f>0?1-1/(1.001-f):-f}function zi(f,c,u){return(f-c.min)*(u.max-u.min)/(c.max-c.min)+u.min}const Cs={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Cs.API_URL)return null;try{const f=new URL(Cs.API_URL);return f.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":f.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Ba(f){return Cs.API_URL_REGEX.test(f)}function Nl(f){return Cs.API_SPRITE_REGEX.test(f)}let Rl,Ac,dp,nl,yd,sl;function iu(){return Rl==null&&(Rl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Rl}const zo={now:()=>nl!==void 0?nl:performance.now(),setNow(f){nl=f},restoreNow(){nl=void 0},frame(f){const c=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(f,c=0){const{width:u,height:g}=f;yd||(yd=document.createElement("canvas"));const v=yd.getContext("2d",{willReadFrequently:!0});if(!v)throw new Error("failed to create canvas 2d context");return(u>yd.width||g>yd.height)&&(yd.width=u,yd.height=g),v.clearRect(-c,-c,u+2*c,g+2*c),v.drawImage(f,0,0,u,g),v.getImageData(-c,-c,u+2*c,g+2*c)},resolveURL:f=>(Ac||(Ac=document.createElement("a")),Ac.href=f,Ac.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(dp==null&&(dp=window.matchMedia("(prefers-reduced-motion: reduce)")),dp.matches)},hasCanvasFingerprintNoise(){if(sl!==void 0)return sl;if(!iu())return sl=!1,!1;const f=new OffscreenCanvas(85,1),c=f.getContext("2d",{willReadFrequently:!0});let u=0;for(let v=0;v0?`?${k}`:""}`}const Jl="mapbox-tiles";let up=500,Am=50;const Kc=["language","worldview","jobid"];let qu,Ec;function Zc(){try{return caches}catch{}}function vd(){const f=Zc();f&&qu==null&&(qu=f.open(Jl))}let $d=1/0;const au={supported:!1,testSupport:function(f){!vy&&hp&&(fp?uk(f):Vu=f)}};let Vu,hp,vy=!1,fp=!1;const pp=typeof self<"u"?self:{};function uk(f){const c=f.createTexture();f.bindTexture(f.TEXTURE_2D,c);try{if(f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,hp),f.isContextLost())return;au.supported=!0}catch{}f.deleteTexture(c),vy=!0}pp.document&&(hp=pp.document.createElement("img"),hp.onload=function(){Vu&&uk(Vu),Vu=null,fp=!0},hp.onerror=function(){vy=!0,Vu=null},hp.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const qg={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(qg);class Yc extends Error{constructor(c,u,g){u===401&&Ba(g)&&(c+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(c),this.status=u,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const _y=Fs()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,mp=function(f,c){if(!(/^file:/.test(u=f.url)||/^file:/.test(_y())&&!/^\w+:/.test(u))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,v){const k=new AbortController,N=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:_y(),referrerPolicy:g.referrerPolicy,signal:k.signal});let I=!1,R=!1;const $=(W=N.url).indexOf("sku=")>0&&Ba(W);var W;g.type==="json"&&N.headers.set("Accept","application/json");const G=(te,se,me)=>{if(R)return;if(te&&te.message!=="SecurityError"&&Vr(te.toString()),se&&me)return X(se);const Se=Date.now();fetch(N).then(Ne=>{if(Ne.ok){const Oe=$?Ne.clone():null;return X(Ne,Oe,Se)}return v(new Yc(Ne.statusText,Ne.status,g.url))}).catch(Ne=>{Ne.name!=="AbortError"&&v(new Error(`${Ne.message} ${g.url}`))})},X=(te,se,me)=>{(g.type==="arrayBuffer"?te.arrayBuffer():g.type==="json"?te.json():te.text()).then(Se=>{R||(se&&me&&function(Ne,Oe,Fe){if(vd(),qu==null)return;const He=Ta(Oe.headers.get("Cache-Control")||"");if(He["no-store"])return;const dt={status:Oe.status,statusText:Oe.statusText,headers:new Headers};Oe.headers.forEach((Nt,Tt)=>dt.headers.set(Tt,Nt)),He["max-age"]&&dt.headers.set("Expires",new Date(Fe+1e3*He["max-age"]).toUTCString());const it=dt.headers.get("Expires");if(!it||new Date(it).getTime()-Fe<42e4)return;let gt=Uu(Ne.url,{persistentParams:Kc});if(Oe.status===206){const Nt=Ne.headers.get("Range");if(!Nt)return;dt.status=200,gt=df(gt,{range:Nt})}(function(Nt,Tt){if(Ec===void 0)try{new Response(new ReadableStream),Ec=!0}catch{Ec=!1}Ec?Tt(Nt.body):Nt.blob().then(Tt).catch(Gt=>Vr(Gt.message))})(Oe,Nt=>{const Tt=new Response((Gt=Oe.status)!==200&&Gt!==404&&[101,103,204,205,304].includes(Gt)?null:Nt,dt);var Gt;vd(),qu!=null&&qu.then(Dt=>Dt.put(gt,Tt)).catch(Dt=>Vr(Dt.message))})}(N,se,me),I=!0,v(null,Se,te.headers))}).catch(Se=>{R||v(new Error(Se.message))})};return $?function(te,se){if(vd(),qu==null)return se(null);qu.then(me=>{let Se=Uu(te.url,{persistentParams:Kc});const Ne=te.headers.get("Range");Ne&&(Se=df(Se,{range:Ne})),me.match(Se).then(Oe=>{const Fe=function(He){if(!He)return!1;const dt=new Date(He.headers.get("Expires")||0),it=Ta(He.headers.get("Cache-Control")||"");return Number(dt)>Date.now()&&!it["no-cache"]}(Oe);me.delete(Se).catch(se),Fe&&me.put(Se,Oe.clone()).catch(se),se(null,Oe,Fe)}).catch(se)}).catch(se)}(N,G):G(null,null),{cancel:()=>{R=!0,I||k.abort()}}}(f,c);if(Fs(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,c,void 0,!0)}var u;return function(g,v){const k=new XMLHttpRequest;k.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(k.responseType="arraybuffer");for(const N in g.headers)k.setRequestHeader(N,g.headers[N]);return g.type==="json"&&(k.responseType="text",k.setRequestHeader("Accept","application/json")),k.withCredentials=g.credentials==="include",k.onerror=()=>{v(new Error(k.statusText))},k.onload=()=>{if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let N=k.response;if(g.type==="json")try{N=JSON.parse(k.response)}catch(R){return v(R)}const I=new Headers;k.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(R=>{const $=R.split(": "),W=$.shift(),G=$.join(": ");I.append(W,G)}),v(null,N,I)}else v(new Yc(k.statusText,k.status,g.url))},k.send(g.body),{cancel:()=>k.abort()}}(f,c)},Hu=function(f,c){return mp(Object.assign(f,{type:"arrayBuffer"}),c)};function M3(f){const c=document.createElement("a");return c.href=f,c.protocol===location.protocol&&c.host===location.host}const St="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Cr,dr;Cr=[],dr=0;const bs=function(f,c){if(au.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),dr>=Cs.MAX_PARALLEL_IMAGE_REQUESTS){const k={requestParameters:f,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return Cr.push(k),k}dr++;let u=!1;const g=()=>{if(!u)for(u=!0,dr--;Cr.length&&dr{g(),k?c(k):N&&(self.createImageBitmap?function(R,$){const W=new Blob([new Uint8Array(R)],{type:"image/png"});createImageBitmap(W).then(G=>{$(null,G)}).catch(G=>{$(new Error(`Could not load image because of ${G.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(N,(R,$)=>c(R,$,I)):function(R,$){const W=new Image;W.onload=()=>{$(null,W),URL.revokeObjectURL(W.src),W.onload=null,requestAnimationFrame(()=>{W.src=St})},W.onerror=()=>$(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const G=new Blob([new Uint8Array(R)],{type:"image/png"});W.src=R.byteLength?URL.createObjectURL(G):St}(N,(R,$)=>c(R,$,I)))});return{cancel:()=>{v.cancel(),g()}}};var zs,Mo,so,io={exports:{}},Vg={exports:{}},hv={exports:{}},T3=function(){if(so)return io.exports;so=1;var f=(zs||(zs=1,Vg.exports=function(u,g){var v,k,N,I,R,$,W,G;for(k=u.length-(v=3&u.length),N=g,R=3432918353,$=461845907,G=0;G>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295)<<13|N>>>19))+((5*(N>>>16)&65535)<<16)&4294967295))+((58964+(I>>>16)&65535)<<16);switch(W=0,v){case 3:W^=(255&u.charCodeAt(G+2))<<16;case 2:W^=(255&u.charCodeAt(G+1))<<8;case 1:N^=W=(65535&(W=(W=(65535&(W^=255&u.charCodeAt(G)))*R+(((W>>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295}return N^=u.length,N=2246822507*(65535&(N^=N>>>16))+((2246822507*(N>>>16)&65535)<<16)&4294967295,N=3266489909*(65535&(N^=N>>>13))+((3266489909*(N>>>16)&65535)<<16)&4294967295,(N^=N>>>16)>>>0}),Vg.exports),c=(Mo||(Mo=1,hv.exports=function(u,g){for(var v,k=u.length,N=g^k,I=0;k>=4;)v=1540483477*(65535&(v=255&u.charCodeAt(I)|(255&u.charCodeAt(++I))<<8|(255&u.charCodeAt(++I))<<16|(255&u.charCodeAt(++I))<<24))+((1540483477*(v>>>16)&65535)<<16),N=1540483477*(65535&N)+((1540483477*(N>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),k-=4,++I;switch(k){case 3:N^=(255&u.charCodeAt(I+2))<<16;case 2:N^=(255&u.charCodeAt(I+1))<<8;case 1:N=1540483477*(65535&(N^=255&u.charCodeAt(I)))+((1540483477*(N>>>16)&65535)<<16)}return N=1540483477*(65535&(N^=N>>>13))+((1540483477*(N>>>16)&65535)<<16),(N^=N>>>15)>>>0}),hv.exports);return io.exports=f,io.exports.murmur3=f,io.exports.murmur2=c,io.exports}(),hk=Ei(T3);class uf{constructor(c,...u){Object.assign(this,u[0]||{}),this.type=c}}class fv extends uf{constructor(c,u={}){super("error",Object.assign({error:c},u))}}function A3(f,c,u){u[f]&&u[f].indexOf(c)!==-1||(u[f]=u[f]||[],u[f].push(c))}function Em(f,c,u){if(u&&u[f]){const g=u[f].indexOf(c);g!==-1&&u[f].splice(g,1)}}class Hg{on(c,u){return this._listeners=this._listeners||{},A3(c,u,this._listeners),this}off(c,u){return Em(c,u,this._listeners),Em(c,u,this._oneTimeListeners),this}once(c,u){return u?(this._oneTimeListeners=this._oneTimeListeners||{},A3(c,u,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,u){const g=typeof c=="string"?new uf(c,u):c,v=g.type;if(this.listens(v)){g.target=this;const k=this._listeners&&this._listeners[v]?this._listeners[v].slice():[];for(const R of k)R.call(this,g);const N=this._oneTimeListeners&&this._oneTimeListeners[v]?this._oneTimeListeners[v].slice():[];for(const R of N)Em(v,R,this._oneTimeListeners),R.call(this,g);const I=this._eventedParent;if(I){const R=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,R),I.fire(g)}}else g instanceof fv&&console.error(g.error);return this}listens(c){return!!(this._listeners&&this._listeners[c]&&this._listeners[c].length>0||this._oneTimeListeners&&this._oneTimeListeners[c]&&this._oneTimeListeners[c].length>0||this._eventedParent&&this._eventedParent.listens(c))}setEventedParent(c,u){return this._eventedParent=c,this._eventedParentData=u,this}}class Ic{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new Ic(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[u,g]=c.split("");return new Ic({name:u,iconsetId:g})}static isEqual(c,u){return c.name===u.name&&c.iconsetId===u.iconsetId}toString(){return Ic.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var fk,pv={},Wu=function(){if(fk)return pv;fk=1;var f={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function c(k){return(k=Math.round(k))<0?0:k>255?255:k}function u(k){return c(k[k.length-1]==="%"?parseFloat(k)/100*255:parseInt(k))}function g(k){return(N=k[k.length-1]==="%"?parseFloat(k)/100:parseFloat(k))<0?0:N>1?1:N;var N}function v(k,N,I){return I<0?I+=1:I>1&&(I-=1),6*I<1?k+(N-k)*I*6:2*I<1?N:3*I<2?k+(N-k)*(2/3-I)*6:k}try{pv.parseCSSColor=function(k){var N,I=k.replace(/ /g,"").toLowerCase();if(I in f)return f[I].slice();if(I[0]==="#")return I.length===4?(N=parseInt(I.substr(1),16))>=0&&N<=4095?[(3840&N)>>4|(3840&N)>>8,240&N|(240&N)>>4,15&N|(15&N)<<4,1]:null:I.length===7&&(N=parseInt(I.substr(1),16))>=0&&N<=16777215?[(16711680&N)>>16,(65280&N)>>8,255&N,1]:null;var R=I.indexOf("("),$=I.indexOf(")");if(R!==-1&&$+1===I.length){var W=I.substr(0,R),G=I.substr(R+1,$-(R+1)).split(","),X=1;switch(W){case"rgba":if(G.length!==4)return null;X=g(G.pop());case"rgb":return G.length!==3?null:[u(G[0]),u(G[1]),u(G[2]),X];case"hsla":if(G.length!==4)return null;X=g(G.pop());case"hsl":if(G.length!==3)return null;var te=(parseFloat(G[0])%360+360)%360/360,se=g(G[1]),me=g(G[2]),Se=me<=.5?me*(se+1):me+se-me*se,Ne=2*me-Se;return[c(255*v(Ne,Se,te+1/3)),c(255*v(Ne,Se,te)),c(255*v(Ne,Se,te-1/3)),X];default:return null}}return null}}catch{}return pv}();class wi{constructor(c,u,g,v=1){this.r=c,this.g=u,this.b=g,this.a=v}static parse(c){if(!c)return;if(c instanceof wi)return c;if(typeof c!="string")return;const u=Wu.parseCSSColor(c);return u?new wi(u[0]/255,u[1]/255,u[2]/255,u[3]):void 0}toString(){const[c,u,g,v]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*u)},${Math.round(255*g)},${v})`}toNonPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new HI(c,u,g,v,k)}toPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new WI(c,u*k,g*k,v*k,k)}clone(){return new wi(this.r,this.g,this.b,this.a)}}class VI{constructor(c,u,g,v,k,N=!1){if(this.premultiplied=!1,this.premultiplied=N,c){const I=c.image.height,R=I*I;this.premultiplied?(u=k===0?0:u/k*(I-1),g=k===0?0:g/k*(I-1),v=k===0?0:v/k*(I-1)):(u*=I-1,g*=I-1,v*=I-1);const $=Math.floor(u),W=Math.floor(g),G=Math.floor(v),X=Math.ceil(u),te=Math.ceil(g),se=Math.ceil(v),me=u-$,Se=g-W,Ne=v-G,Oe=c.image.data,Fe=4*($+W*R+G*I),He=4*($+W*R+se*I),dt=4*($+te*R+G*I),it=4*($+te*R+se*I),gt=4*(X+W*R+G*I),Nt=4*(X+W*R+se*I),Tt=4*(X+te*R+G*I),Gt=4*(X+te*R+se*I);if(Fe<0||Gt>=Oe.length)throw new Error("out of range");this.r=Fn(Fn(Fn(Oe[Fe],Oe[He],Ne),Fn(Oe[dt],Oe[it],Ne),Se),Fn(Fn(Oe[gt],Oe[Nt],Ne),Fn(Oe[Tt],Oe[Gt],Ne),Se),me)/255*(this.premultiplied?k:1),this.g=Fn(Fn(Fn(Oe[Fe+1],Oe[He+1],Ne),Fn(Oe[dt+1],Oe[it+1],Ne),Se),Fn(Fn(Oe[gt+1],Oe[Nt+1],Ne),Fn(Oe[Tt+1],Oe[Gt+1],Ne),Se),me)/255*(this.premultiplied?k:1),this.b=Fn(Fn(Fn(Oe[Fe+2],Oe[He+2],Ne),Fn(Oe[dt+2],Oe[it+2],Ne),Se),Fn(Fn(Oe[gt+2],Oe[Nt+2],Ne),Fn(Oe[Tt+2],Oe[Gt+2],Ne),Se),me)/255*(this.premultiplied?k:1),this.a=k}else this.r=u,this.g=g,this.b=v,this.a=k}toArray(){const{r:c,g:u,b:g,a:v}=this;return[255*c,255*u,255*g,v]}toHslaArray(){let{r:c,g:u,b:g,a:v}=this;if(this.premultiplied){if(v===0)return[0,0,0,0];const se=1/v;c*=se,u*=se,g*=se}const k=Math.min(Math.max(c,0),1),N=Math.min(Math.max(u,0),1),I=Math.min(Math.max(g,0),1),R=Math.min(k,N,I),$=Math.max(k,N,I),W=$-R,G=.5*(R+$);if(W===0)return[0,0,100*G,v];const X=G>.5?W/(2-$-R):W/($+R);let te;switch($){case k:te=60*((N-I)/W+(NFn(g,c[v],u))}wi.black=new wi(0,0,0,1),wi.white=new wi(1,1,1,1),wi.transparent=new wi(0,0,0,0),wi.red=new wi(1,0,0,1),wi.blue=new wi(0,0,1,1);var mv=Object.freeze({__proto__:null,array:E3,color:function(f,c,u){return new wi(Fn(f.r,c.r,u),Fn(f.g,c.g,u),Fn(f.b,c.b,u),Fn(f.a,c.a,u))},number:Fn});class Gu extends Error{constructor(c,u){super(u),this.message=u,this.key=c}}class by{constructor(c,u=[]){this.parent=c,this.bindings={};for(const[g,v]of u)this.bindings[g]=v}concat(c){return new by(this,c)}get(c){if(this.bindings[c])return this.bindings[c];if(this.parent)return this.parent.get(c);throw new Error(`${c} not found in scope.`)}has(c){return!!this.bindings[c]||!!this.parent&&this.parent.has(c)}}const kh={kind:"null"},mn={kind:"number"},Ks={kind:"string"},Pi={kind:"boolean"},_d={kind:"color"},hf={kind:"object"},_i={kind:"value"},pk={kind:"collator"},gv={kind:"formatted"},xv={kind:"resolvedImage"};function pc(f,c){return{kind:"array",itemType:f,N:c}}function To(f){if(f.kind==="array"){const c=To(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const Hie=[kh,mn,Ks,Pi,_d,gv,hf,pc(_i),xv];function Im(f,c){if(c.kind==="error")return null;if(f.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Im(f.itemType,c.itemType))&&(typeof f.N!="number"||f.N===c.N))return null}else{if(f.kind===c.kind)return null;if(f.kind==="value"){for(const u of Hie)if(!Im(u,c))return null}}return`Expected ${To(f)} but found ${To(c)} instead.`}function I3(f,c){return c.some(u=>u.kind===f.kind)}function yv(f,c){return c.some(u=>u==="null"?f===null:u==="array"?Array.isArray(f):u==="object"?f&&!Array.isArray(f)&&typeof f=="object":u===typeof f)}function mk(f,c){return f.kind==="array"&&c.kind==="array"?f.N===c.N&&mk(f.itemType,c.itemType):f.kind===c.kind}class P3{constructor(c,u,g){this.sensitivity=c?u?"variant":"case":u?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(c,u){return this.collator.compare(c,u)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class gk{constructor(c,u,g,v,k){this.text=c.normalize?c.normalize():c,this.image=u,this.scale=g,this.fontStack=v,this.textColor=k}}class Xc{constructor(c){this.sections=c}static fromString(c){return new Xc([new gk(c,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(c=>c.text.length!==0||!!c.image&&c.image.hasPrimary())}static factory(c){return c instanceof Xc?c:Xc.fromString(c)}toString(){return this.sections.length===0?"":this.sections.map(c=>c.text).join("")}serialize(){const c=["format"];for(const u of this.sections){if(u.image){const v=u.image.getPrimary().id.toString();c.push(["image",v]);continue}c.push(u.text);const g={};u.fontStack&&(g["text-font"]=["literal",u.fontStack.split(",")]),u.scale&&(g["font-scale"]=u.scale),u.textColor&&(g["text-color"]=["rgba"].concat(u.textColor.toNonPremultipliedRenderColor(null).toArray())),c.push(g)}return c}}class gp{constructor(c,u={}){this.id=Ic.from(c),this.params=u.params,this.sx=u.sx||1,this.sy=u.sy||1}toString(){return JSON.stringify(this)}static parse(c){let u,g,v,k;try{({id:u,params:g,sx:v,sy:k}=JSON.parse(c)||{})}catch{return null}return u?new gp(u,{params:g,sx:v,sy:k}):null}scaleSelf(c,u=c){return this.sx*=c,this.sy*=u,this}}class Qc{constructor(c,u,g,v,k=!1){this.primaryId=Ic.from(c),this.primaryOptions=u,g&&(this.secondaryId=Ic.from(g)),this.secondaryOptions=v,this.available=k}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new gp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new gp(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?Qc.build({name:c}):c}static build(c,u,g,v){return!c||typeof c=="object"&&!("name"in c)?null:new Qc(c,g,u,v)}}function Wg(f,c,u,g){return typeof f=="number"&&f>=0&&f<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof u=="number"&&u>=0&&u<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,c,u,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,c,u,g]:[f,c,u]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function wy(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof wi||f instanceof P3||f instanceof Xc||f instanceof Qc)return!0;if(Array.isArray(f)){for(const c of f)if(!wy(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!wy(f[c]))return!1;return!0}return!1}function ml(f){if(f===null)return kh;if(typeof f=="string")return Ks;if(typeof f=="boolean")return Pi;if(typeof f=="number")return mn;if(f instanceof wi)return _d;if(f instanceof P3)return pk;if(f instanceof Xc)return gv;if(f instanceof Qc)return xv;if(Array.isArray(f)){const c=f.length;let u;for(const g of f){const v=ml(g);if(u){if(u===v)continue;u=_i;break}u=v}return pc(u||_i,c)}return hf}function Ku(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof Xc||f instanceof Qc||f instanceof wi?f.toString():JSON.stringify(f)}class xp{constructor(c,u){this.type=c,this.value=u}static parse(c,u){if(c.length!==2)return u.error(`'literal' expression requires exactly one argument, but found ${c.length-1} instead.`);if(!wy(c[1]))return u.error("invalid value");const g=c[1];let v=ml(g);const k=u.expectedType;return v.kind!=="array"||v.N!==0||!k||k.kind!=="array"||typeof k.N=="number"&&k.N!==0||(v=k),new xp(v,g)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof wi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Xc?this.value.serialize():this.value}}class il{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const L3={string:Ks,number:mn,boolean:Pi,object:hf};class Nh{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");let g,v=1;const k=c[0];if(k==="array"){let I,R;if(c.length>2){const $=c[1];if(typeof $!="string"||!($ in L3)||$==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);I=L3[$],v++}else I=_i;if(c.length>3){if(c[2]!==null&&(typeof c[2]!="number"||c[2]<0||c[2]!==Math.floor(c[2])))return u.error('The length argument to "array" must be a positive integer literal',2);R=c[2],v++}g=pc(I,R)}else g=L3[k];const N=[];for(;vc.outputDefined())}serialize(){const c=this.type,u=[c.kind];if(c.kind==="array"){const g=c.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){u.push(g.kind);const v=c.N;(typeof v=="number"||this.args.length>1)&&u.push(v)}}return u.concat(this.args.map(g=>g.serialize()))}}class ff{constructor(c){this.type=gv,this.sections=c}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[1];if(!Array.isArray(g)&&typeof g=="object")return u.error("First argument must be an image or text section.");const v=[];let k=!1;for(let N=1;N<=c.length-1;++N){const I=c[N];if(k&&typeof I=="object"&&!Array.isArray(I)){k=!1;let R=null;if(I["font-scale"]&&(R=u.parseObjectValue(I["font-scale"],N,"font-scale",mn),!R))return null;let $=null;if(I["text-font"]&&($=u.parseObjectValue(I["text-font"],N,"text-font",pc(Ks)),!$))return null;let W=null;if(I["text-color"]&&(W=u.parseObjectValue(I["text-color"],N,"text-color",_d),!W))return null;const G=v[v.length-1];G.scale=R,G.font=$,G.textColor=W}else{const R=u.parse(c[N],N,_i);if(!R)return null;const $=R.type.kind;if($!=="string"&&$!=="value"&&$!=="null"&&$!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");k=!0,v.push({content:R,scale:null,font:null,textColor:null})}}return new ff(v)}evaluate(c){return new Xc(this.sections.map(u=>{const g=u.content.evaluate(c);return mk(ml(g),xv)?new gk("",g,null,null,null):new gk(Ku(g),null,u.scale?u.scale.evaluate(c):null,u.font?u.font.evaluate(c).join(","):null,u.textColor?u.textColor.evaluate(c):null)}))}eachChild(c){for(const u of this.sections)c(u.content),u.scale&&c(u.scale),u.font&&c(u.font),u.textColor&&c(u.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const u of this.sections){c.push(u.content.serialize());const g={};u.scale&&(g["font-scale"]=u.scale.serialize()),u.font&&(g["text-font"]=u.font.serialize()),u.textColor&&(g["text-color"]=u.textColor.serialize()),c.push(g)}return c}}class is{constructor(c,u,g,v){this._imageWarnHistory={},this.type=xv,this.namePrimary=c,this.nameSecondary=u,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),v&&(this.paramsSecondary=v.params,this.iconsetIdSecondary=v.iconset?v.iconset.id:void 0)}static parse(c,u){if(c.length<2)return u.error("Expected two or more arguments.");let g=1;const v=[];function k(){if(gIc.isEqual(N,k)),v.available){const N=v.getSecondary()?v.getSecondary().id:null;N&&(v.available=c.availableImages.some(I=>Ic.isEqual(I,N)))}}return v}eachChild(c){if(c(this.namePrimary),this.paramsPrimary)for(const u in this.paramsPrimary)this.paramsPrimary[u]&&c(this.paramsPrimary[u]);if(this.nameSecondary&&(c(this.nameSecondary),this.paramsSecondary))for(const u in this.paramsSecondary)this.paramsSecondary[u]&&c(this.paramsSecondary[u])}outputDefined(){return!1}serializeOptions(c,u){const g={};if(u&&(g.iconset={id:u}),c){g.params={};for(const v in c)c[v]&&(g.params[v]=c[v].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const c=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const u=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);u&&c.push(u)}if(this.nameSecondary&&(c.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const u=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);u&&c.push(u)}return c}}function un(f){return $n(f)?"string":jy(f)?"number":yk(f)?"boolean":Array.isArray(f)?"array":f===null?"null":xk(f)?"object":typeof f}function xk(f){return f!=null&&!Array.isArray(f)&&typeof f!="function"&&!(f instanceof String||f instanceof Number||f instanceof Boolean)&&typeof f=="object"}function $n(f){return typeof f=="string"||f instanceof String}function jy(f){return typeof f=="number"||f instanceof Number}function yk(f){return typeof f=="boolean"||f instanceof Boolean}const Bn={"to-boolean":Pi,"to-color":_d,"to-number":mn,"to-string":Ks};class pf{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[0],v=[];let k=kh;if(g==="to-array"){if(!Array.isArray(c[1]))return null;const N=c[1].length;if(u.expectedType){if(u.expectedType.kind!=="array")return u.error(`Expected ${u.expectedType.kind} but found array.`);k=pc(u.expectedType.itemType,N)}else{if(!(N>0&&wy(c[1][0])))return null;k=pc(ml(c[1][0]),N)}for(let I=0;I4?`Invalid rbga value ${JSON.stringify(u)}: expected an array containing either three or four numeric values.`:Wg(u[0],u[1],u[2],u[3]),!g))return new wi(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new il(g||`Could not parse color from value '${typeof u=="string"?u:String(JSON.stringify(u))}'`)}if(this.type.kind==="number"){let u=null;for(const g of this.args){if(u=g.evaluate(c),u===null)return 0;const v=Number(u);if(!isNaN(v))return v}throw new il(`Could not convert ${JSON.stringify(u)} to number.`)}return this.type.kind==="formatted"?Xc.fromString(Ku(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?Qc.build(Ku(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(u=>u.evaluate(c)):Ku(this.args[0].evaluate(c))}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){if(this.type.kind==="formatted")return new ff([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new is(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(u=>{c.push(u.serialize())}),c}}const O3=["Unknown","Point","LineString","Polygon"];class vk{constructor(c,u,g){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=c,this.options=u,this.iconImageUseTheme=g}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?O3[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(c){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const c=this.featureDistanceData.center,u=this.featureDistanceData.scale,{x:g,y:v}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*u-c[0])+this.featureDistanceData.bearing[1]*(v*u-c[1])}return 0}parseColor(c){let u=this._parseColorCache[c];return u||(u=this._parseColorCache[c]=wi.parse(c)),u}getConfig(c){return this.options?this.options.get(c):null}}class Jc{constructor(c,u,g,v,k){this.name=c,this.type=u,this._evaluate=g,this.args=v,this._overloadIndex=k}evaluate(c){if(!this._evaluate){const u=Jc.definitions[this.name];this._evaluate=Array.isArray(u)?u[2]:u.overloads[this._overloadIndex][1]}return this._evaluate(c,this.args)}eachChild(c){this.args.forEach(c)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(c=>c.serialize()))}static parse(c,u){const g=c[0],v=Jc.definitions[g];if(!v)return u.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const k=Array.isArray(v)?v[0]:v.type,N=Array.isArray(v)?[[v[1],v[2]]]:v.overloads,I=[];let R=null,$=-1;for(const[W,G]of N){if(Array.isArray(W)&&W.length!==c.length-1)continue;I.push(W),$++,R=new Ek(u.registry,u.path,null,u.scope,void 0,u._scope,u.options,u.iconImageUseTheme);const X=[];let te=!1;for(let se=1;seX)).map(_k).join(" | "),G=[];for(let X=1;Xu;){if(g-u>600){const R=g-u+1,$=c-u+1,W=Math.log(R),G=.5*Math.exp(2*W/3),X=.5*Math.sqrt(W*G*(R-G)/R)*($-R/2<0?-1:1);bk(f,c,Math.max(u,Math.floor(c-$*G/R+X)),Math.min(g,Math.floor(c+(R-$)*G/R+X)),v)}const k=f[c];let N=u,I=g;for(Sh(f,u,c),v(f[g],k)>0&&Sh(f,u,g);N0;)I--}v(f[u],k)===0?Sh(f,u,I):(I++,Sh(f,I,g)),I<=c&&(u=I+1),c<=I&&(g=I-1)}}function Sh(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function D3(f,c){return fc?1:0}function Pm(f){let c=0;for(let u,g,v=0,k=f.length,N=k-1;v=c[2]||f[1]<=c[1]||f[3]>=c[3])}function Wie(f,c,u){const g=f[0]-c[0],v=f[1]-c[1],k=f[0]-u[0],N=f[1]-u[1];return g*N-k*v==0&&g*k<=0&&v*N<=0}function ky(f,c,u=!1){let g=!1;for(let I=0,R=c.length;I(v=f)[1]!=(N=se)[1]>v[1]&&v[0]<(N[0]-k[0])*(v[1]-k[1])/(N[1]-k[1])+k[0]&&(g=!g)}}var v,k,N;return g}function _v(f,c,u,g){const v=g[0]-u[0],k=g[1]-u[1],N=(f[0]-u[0])*k-v*(f[1]-u[1]),I=(c[0]-u[0])*k-v*(c[1]-u[1]);return N>0&&I<0||N<0&&I>0}function bv(f,c,u,g){return(v=[g[0]-u[0],g[1]-u[1]])[0]*(k=[c[0]-f[0],c[1]-f[1]])[1]-v[1]*k[0]!=0&&!(!_v(f,c,u,g)||!_v(u,g,f,c));var v,k}function yp(f){const c=new ir(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),u=new ir(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of f[0])c.x>g.x&&(c.x=g.x),c.y>g.y&&(c.y=g.y),u.xu[2]){const v=.5*g;let k=f[0]-u[0]>v?-g:u[0]-f[0]>v?g:0;k===0&&(k=f[0]-u[2]>v?-g:u[2]-f[0]>v?g:0),f[0]+=k}Zu(c,f)}function YI(f,c,u,g){const v=Math.pow(2,g.z)*Lm,k=[g.x*Lm,g.y*Lm],N=[];if(!f)return N;for(const I of f)for(const R of I){const $=[R.x+k[0],R.y+k[1]];ZI($,c,u,v),N.push($)}return N}function wk(f,c,u,g){const v=Math.pow(2,g.z)*Lm,k=[g.x*Lm,g.y*Lm],N=[];if(!f)return N;for(const R of f){const $=[];for(const W of R){const G=[W.x+k[0],W.y+k[1]];Zu(c,G),$.push(G)}N.push($)}if(c[2]-c[0]<=v/2){(I=c)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const R of N)for(const $ of R)ZI($,c,u,v)}var I;return N}class Dm{constructor(c,u){this.type=Pi,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${c.length-1} instead.`);if(wy(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let v=0;vu)return jk(k,N,(u-(g-I))/I)}return c[c.length-1]}pointToSegmentDistance(c,u,g){let[v,k]=u,N=ou(g[0]-v)*this.kx,I=(g[1]-k)*this.ky;if(N!==0||I!==0){const R=(ou(c[0]-v)*this.kx*N+(c[1]-k)*this.ky*I)/(N*N+I*I);R>1?(v=g[0],k=g[1]):R>0&&(v+=N/this.kx*R,k+=I/this.ky*R)}return N=ou(c[0]-v)*this.kx,I=(c[1]-k)*this.ky,Math.sqrt(N*N+I*I)}pointOnLine(c,u){let g=1/0,v=c[0][0],k=c[0][1],N=0,I=0;for(let R=0;R1?($=c[R+1][0],W=c[R+1][1]):te>0&&($+=G/this.kx*te,W+=X/this.ky*te)),G=ou(u[0]-$)*this.kx,X=(u[1]-W)*this.ky;const se=G*G+X*X;sek.index||v.index===k.index&&v.t>k.t){const $=v;v=k,k=$}const N=[v.point],I=v.index+1,R=k.index;!z3(g[I],N[0])&&I<=R&&N.push(g[I]);for(let $=I+1;$<=R;$++)N.push(g[$]);return z3(g[R],k.point)||N.push(k.point),N}lineSliceAlong(c,u,g){let v=0;const k=[];for(let N=0;Nc&&k.length===0&&k.push(jk(I,R,(c-(v-$))/$)),v>=u)return k.push(jk(I,R,(u-(v-$))/$)),k;v>c&&k.push(R)}return k}bufferPoint(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[0]+v,c[1]+g]}bufferBBox(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[2]+v,c[3]+g]}insideBBox(c,u){return ou(c[0]-u[0])>=0&&ou(c[0]-u[2])<=0&&c[1]>=u[1]&&c[1]<=u[3]}}function z3(f,c){return f[0]===c[0]&&f[1]===c[1]}function jk(f,c,u){const g=ou(c[0]-f[0]);return[f[0]+g*u,f[1]+(c[1]-f[1])*u]}function ou(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class kk{constructor(c=[],u=(g,v)=>gv?1:0){if(this.data=c,this.length=this.data.length,this.compare=u,this.length>0)for(let g=(this.length>>1)-1;g>=0;g--)this._down(g)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:u,compare:g}=this,v=u[c];for(;c>0;){const k=c-1>>1,N=u[k];if(g(v,N)>=0)break;u[c]=N,c=k}u[c]=v}_down(c){const{data:u,compare:g}=this,v=this.length>>1,k=u[c];for(;c=0)break;u[c]=u[N],c=N}u[c]=k}}var Mr=8192;function B3(f,c){return c.dist-f.dist}const Nk=100,Sk=50;function $3(f){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==f.length)return!1;for(let u=0;u=f[0]&&f[1]f[1])return[null,null];const u=jv(f);if(c){if(u===2)return[f,null];const g=Math.floor(u/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(u===1)return[f,null];const g=Math.floor(u/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function Gg(f,c){const u=[1/0,1/0,-1/0,-1/0];if(!mf(c,f.length))return u;for(let g=c[0];g<=c[1];++g)Zu(u,f[g]);return u}function Kg(f){const c=[1/0,1/0,-1/0,-1/0];for(let u=0;uc[2]&&(g=f[0]-c[2]),f[1]>c[3]&&(v=f[1]-c[3]),f[3]=g)return g;if(vv(v,k)){if(V3(f,c))return 0}else if(V3(c,f))return 0;let N=g;for(const I of f)for(let R=0,$=I.length,W=$-1;R<$;W=R++)for(const G of c)for(let X=0,te=G.length,se=te-1;X=k)continue;const W=$.range1;if(jv(W)<=I){if(!mf(W,f.length))return NaN;if(c){const G=Qie(f,W,u,g);if((k=Math.min(k,G))===0)return k}else for(let G=W[0];G<=W[1];++G){const X=Xie(f[G],u,g);if((k=Math.min(k,X))===0)return k}}else{const G=U3(W,c);if(G[0]!==null){const X=Rm(Gg(f,G[0]),R,g);X=N)continue;const G=W.range1,X=W.range2;if(jv(G)<=R&&jv(X)<=$){if(!mf(G,f.length)||!mf(X,u.length))return NaN;if(c&&g?N=Math.min(N,Xs(f,G,u,X,v)):c||g?c&&!g?N=Math.min(N,q3(u,X,f,G,v)):!c&&g&&(N=Math.min(N,q3(f,G,u,X,v))):N=Math.min(N,Yie(f,G,u,X,v)),N===0)return N}else{const te=U3(G,c),se=U3(X,g);ja(I,N,v,f,u,te[0],se[0]),ja(I,N,v,f,u,te[0],se[1]),ja(I,N,v,f,u,te[1],se[0]),ja(I,N,v,f,u,te[1],se[1])}}return N}function H3(f,c,u,g,v=1/0){let k=v;const N=Gg(f,[0,f.length-1]);for(const I of u)if(!(k!==1/0&&Rm(N,Gg(I,[0,I.length-1]),g)>=k)&&(k=Math.min(k,eP(f,c,I,!0,g,k)),k===0))return k;return k}function Tk(f,c,u,g,v=1/0){let k=v;const N=Gg(f,[0,f.length-1]);for(const I of u){if(k!==1/0&&Rm(N,Kg(I),g)>=k)continue;const R=eae(f,c,I,g,k);if(isNaN(R))return R;if((k=Math.min(k,R))===0)return k}return k}function W3(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class Zg{constructor(c,u){this.type=mn,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'distance' expression requires either one argument, but found ' ${c.length-1} instead.`);if(wy(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let v=0;v{c&&!Cy(u)&&(c=!1)}),c}function kv(f){if(f instanceof Jc&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(u=>{c&&!kv(u)&&(c=!1)}),c}function My(f,c){if(f instanceof Jc&&c.indexOf(f.name)>=0)return!1;let u=!0;return f.eachChild(g=>{u&&!My(g,c)&&(u=!1)}),u}function tP(f,c,u){return[f,c,u].filter(Boolean).join("")}function G3(f,c){switch(f){case"string":return Ku(c);case"number":return+c;case"boolean":return!!c;case"color":return wi.parse(c);case"formatted":return Xc.fromString(Ku(c));case"resolvedImage":return Qc.build(Ku(c))}return c}function rP(f,c,u,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fu&&(f=u),f}class Ty{constructor(c,u,g,v=!1){this.type=c,this.key=u,this.scope=g,this.featureConstant=v}static parse(c,u){let g=u.expectedType;if(g==null&&(g=_i),c.length<2||c.length>3)return u.error("Invalid number of arguments for 'config' expression.");const v=u.parse(c[1],1);if(!(v instanceof xp))return u.error("Key name of 'config' expression must be a string literal.");let k,N=!0;const I=Ku(v.value);if(c.length>=3){const R=u.parse(c[2],2);if(!(R instanceof xp))return u.error("Scope of 'config' expression must be a string literal.");k=Ku(R.value)}if(u.options){const R=tP(I,k,u._scope),$=u.options.get(R);$&&(N=Cy($.value||$.default))}return new Ty(g,I,k,N)}evaluate(c){const u=tP(this.key,this.scope,c.scope),g=c.getConfig(u);if(!g)return null;const{type:v,value:k,values:N,minValue:I,maxValue:R,stepValue:$}=g,W=g.default.evaluate(c);let G=W;if(k){const X=c.scope;c.scope=(X||"").split("").slice(1).join(""),G=k.evaluate(c),c.scope=X}return v&&(G=G3(v,G)),G===void 0||I===void 0&&R===void 0&&$===void 0||(typeof G=="number"?G=rP(G,I,R,$):Array.isArray(G)&&(G=G.map(X=>typeof X=="number"?rP(X,I,R,$):X))),k!==void 0&&G!==void 0&&N&&!N.includes(G)&&(G=W,v&&(G=G3(v,G))),(v&&v!==this.type||G!==void 0&&!mk(ml(G),this.type))&&(G=G3(this.type.kind,G)),G}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class Ak{constructor(c,u){this.type=u.type,this.name=c,this.boundExpression=u}static parse(c,u){if(c.length!==2||typeof c[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");const g=c[1];return u.scope.has(g)?new Ak(g,u.scope.get(g)):u.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(c){return this.boundExpression.evaluate(c)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ek{constructor(c,u=[],g,v=new by,k=[],N,I,R){this.registry=c,this.path=u,this.key=u.map($=>typeof $=="string"?`['${$}']`:`[${$}]`).join(""),this.scope=v,this.errors=k,this.expectedType=g,this._scope=N,this.options=I,this.iconImageUseTheme=R}parse(c,u,g,v,k={}){return u||g?this.concat(u,null,g,v)._parse(c,k):this._parse(c,k)}parseObjectValue(c,u,g,v,k,N={}){return this.concat(u,g,v,k)._parse(c,N)}_parse(c,u){function g(v,k,N){return N==="assert"?new Nh(k,[v]):N==="coerce"?new pf(k,[v]):v}if(c!==null&&typeof c!="string"&&typeof c!="boolean"&&typeof c!="number"||(c=["literal",c]),Array.isArray(c)){if(c.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const v=typeof c[0]=="string"?this.registry[c[0]]:void 0;if(v){let k=v.parse(c,this);if(!k)return null;if(this.expectedType){const N=this.expectedType,I=k.type;if(N.kind!=="string"&&N.kind!=="number"&&N.kind!=="boolean"&&N.kind!=="object"&&N.kind!=="array"||I.kind!=="value")if(N.kind!=="color"&&N.kind!=="formatted"&&N.kind!=="resolvedImage"||I.kind!=="value"&&I.kind!=="string"){if(this.checkSubtype(N,I))return null}else k=g(k,N,u.typeAnnotation||"coerce");else k=g(k,N,u.typeAnnotation||"assert")}if(!(k instanceof xp)&&k.type.kind!=="resolvedImage"&&K3(k)){const N=new vk(this._scope,this.options,this.iconImageUseTheme);try{k=new xp(k.type,k.evaluate(N))}catch(I){return this.error(I.message),null}}return k}return pf.parse(["to-array",c],this)}return this.error(c===void 0?"'undefined' value invalid. Use null instead.":typeof c=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof c} instead.`)}concat(c,u,g,v){let k=typeof c=="number"?this.path.concat(c):this.path;k=typeof u=="string"?k.concat(u):k;const N=v?this.scope.concat(v):this.scope;return new Ek(this.registry,k,g||null,N,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...u){const g=`${this.key}${u.map(v=>`[${v}]`).join("")}`;this.errors.push(new Gu(g,c))}checkSubtype(c,u){const g=Im(c,u);return g&&this.error(g),g}}function K3(f){if(f instanceof Ak)return K3(f.boundExpression);if(f instanceof Jc&&f.name==="error"||f instanceof Sl||f instanceof Dm||f instanceof Zg||f instanceof Ty)return!1;const c=f instanceof pf||f instanceof Nh;let u=!0;return f.eachChild(g=>{u=c?u&&K3(g):u&&g instanceof xp}),!!u&&Cy(f)&&My(f,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Ik(f,c){const u=f.length-1;let g,v,k=0,N=u,I=0;for(;k<=N;)if(I=Math.floor((k+N)/2),g=f[I],v=f[I+1],g<=c){if(I===u||cc))throw new il("Input is not a number.");N=I-1}return 0}class Nv{constructor(c,u,g){this.type=c,this.input=u,this.labels=[],this.outputs=[];for(const[v,k]of g)this.labels.push(v),this.outputs.push(k)}static parse(c,u){if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if((c.length-1)%2!=0)return u.error("Expected an even number of arguments.");const g=u.parse(c[1],1,mn);if(!g)return null;const v=[];let k=null;u.expectedType&&u.expectedType.kind!=="value"&&(k=u.expectedType);for(let N=1;N=I)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',$);const G=u.parse(R,W,k);if(!G)return null;k=k||G.type,v.push([I,G])}return new Nv(k,g,v)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;return v>=u[k-1]?g[k-1].evaluate(c):g[Ik(u,v)].evaluate(c)}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){const c=["step",this.input.serialize()];for(let u=0;u0&&c.push(this.labels[u]),c.push(this.outputs[u].serialize());return c}}const nP=.95047,sP=1.08883,iP=4/29,Ay=6/29,aP=3*Ay*Ay,tae=Ay*Ay*Ay,rae=Math.PI/180,nae=180/Math.PI;function Z3(f){return f>tae?Math.pow(f,1/3):f/aP+iP}function Y3(f){return f>Ay?f*f*f:aP*(f-iP)}function X3(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function Q3(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function oP(f){const c=Q3(f.r),u=Q3(f.g),g=Q3(f.b),v=Z3((.4124564*c+.3575761*u+.1804375*g)/nP),k=Z3((.2126729*c+.7151522*u+.072175*g)/1);return{l:116*k-16,a:500*(v-k),b:200*(k-Z3((.0193339*c+.119192*u+.9503041*g)/sP)),alpha:f.a}}function Pk(f){let c=(f.l+16)/116,u=isNaN(f.a)?c:c+f.a/500,g=isNaN(f.b)?c:c-f.b/200;return c=1*Y3(c),u=nP*Y3(u),g=sP*Y3(g),new wi(X3(3.2404542*u-1.5371385*c-.4985314*g),X3(-.969266*u+1.8760108*c+.041556*g),X3(.0556434*u-.2040259*c+1.0572252*g),f.alpha)}function Lk(f,c,u){const g=c-f;return f+u*(g>180||g<-180?g-360*Math.round(g/360):g)}const Ey={forward:oP,reverse:Pk,interpolate:function(f,c,u){return{l:Fn(f.l,c.l,u),a:Fn(f.a,c.a,u),b:Fn(f.b,c.b,u),alpha:Fn(f.alpha,c.alpha,u)}}},Sv={forward:function(f){const{l:c,a:u,b:g}=oP(f),v=Math.atan2(g,u)*nae;return{h:v<0?v+360:v,c:Math.sqrt(u*u+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*rae,u=f.c;return Pk({l:f.l,a:Math.cos(c)*u,b:Math.sin(c)*u,alpha:f.alpha})},interpolate:function(f,c,u){return{h:Lk(f.h,c.h,u),c:Fn(f.c,c.c,u),l:Fn(f.l,c.l,u),alpha:Fn(f.alpha,c.alpha,u)}}};var lP=Object.freeze({__proto__:null,hcl:Sv,lab:Ey});class lu{constructor(c,u,g,v,k){this.type=c,this.operator=u,this.interpolation=g,this.input=v,this.labels=[],this.outputs=[];for(const[N,I]of k)this.labels.push(N),this.outputs.push(I)}static interpolationFactor(c,u,g,v){let k=0;if(c.name==="exponential")k=Ok(u,c.base,g,v);else if(c.name==="linear")k=Ok(u,1,g,v);else if(c.name==="cubic-bezier"){const N=c.controlPoints;k=new Oo(N[0],N[1],N[2],N[3]).solve(Ok(u,1,g,v))}return k}static parse(c,u){let[g,v,k,...N]=c;if(!Array.isArray(v)||v.length===0)return u.error("Expected an interpolation type expression.",1);if(v[0]==="linear")v={name:"linear"};else if(v[0]==="exponential"){const $=v[1];if(typeof $!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);v={name:"exponential",base:$}}else{if(v[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(v[0])}`,1,0);{const $=v.slice(1);if($.length!==4||$.some(W=>typeof W!="number"||W<0||W>1))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);v={name:"cubic-bezier",controlPoints:$}}}if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length-1>3&&(c.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(k=u.parse(k,2,mn),!k)return null;const I=[];let R=null;g==="interpolate-hcl"||g==="interpolate-lab"?R=_d:u.expectedType&&u.expectedType.kind!=="value"&&(R=u.expectedType);for(let $=0;$=W)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const se=u.parse(G,te,R);if(!se)return null;R=R||se.type,I.push([W,se])}return R.kind==="number"||R.kind==="color"||R.kind==="array"&&R.itemType.kind==="number"&&typeof R.N=="number"?new lu(R,g,v,k,I):u.error(`Type ${To(R)} is not interpolatable.`)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;if(v>=u[k-1])return g[k-1].evaluate(c);const N=Ik(u,v),I=lu.interpolationFactor(this.interpolation,v,u[N],u[N+1]),R=g[N].evaluate(c),$=g[N+1].evaluate(c);return this.operator==="interpolate"?mv[this.type.kind.toLowerCase()](R,$,I):this.operator==="interpolate-hcl"?Sv.reverse(Sv.interpolate(Sv.forward(R),Sv.forward($),I)):Ey.reverse(Ey.interpolate(Ey.forward(R),Ey.forward($),I))}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){let c;c=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const u=[this.operator,c,this.input.serialize()];for(let g=0;gIm(v,I.type));return new Cv(N?_i:g,k)}evaluate(c){let u,g=null,v=0;for(const k of this.args){if(v++,g=k.evaluate(c),g&&g instanceof Qc&&!g.available&&(u||(u=g),g=null,v===this.args.length))return u;if(g!==null)break}return g}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){const c=["coalesce"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class vp{constructor(c,u){this.type=u.type,this.bindings=[].concat(c),this.result=u}evaluate(c){return this.result.evaluate(c)}eachChild(c){for(const u of this.bindings)c(u[1]);c(this.result)}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found ${c.length-1} instead.`);const g=[];for(let k=1;k=g.length)throw new il("Array index out of bounds: index exceeds array size");if(u!==Math.floor(u))throw new il("Array index must be an integer. Use at-interpolated for fractional indices");return g[u]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Rk{constructor(c,u,g){this.type=c,this.index=u,this.input=g}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,mn),v=u.parse(c[2],2,pc(u.expectedType||_i));return g&&v?new Rk(v.type.itemType,g,v):null}evaluate(c){const u=this.index.evaluate(c),g=this.input.evaluate(c);if(u<0)throw new il(`Array index out of bounds: ${u} < 0.`);if(u>g.length-1)throw new il(`Array index out of bounds: ${u} > ${g.length-1}.`);if(u===Math.floor(u))return g[u];const v=Math.floor(u),k=Math.ceil(u),N=g[v],I=g[k];if(typeof N!="number"||typeof I!="number")throw new il(`Cannot interpolate between non-number values at index ${u}.`);const R=u-v;return N*(1-R)+I*R}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class J3{constructor(c,u){this.type=Pi,this.needle=c,this.haystack=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,_i),v=u.parse(c[2],2,_i);return g&&v?I3(g.type,[Pi,Ks,mn,kh,_i])?new J3(g,v):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${To(g.type)} instead`):null}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!yv(u,["boolean","string","number","null"]))throw new il(`Expected first argument to be of type boolean, string, number or null, but found ${To(ml(u))} instead.`);if(!yv(g,["string","array"]))throw new il(`Expected second argument to be of type array or string, but found ${To(ml(g))} instead.`);return g.indexOf(u)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Iy{constructor(c,u,g){this.type=mn,this.needle=c,this.haystack=u,this.fromIndex=g}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,_i),v=u.parse(c[2],2,_i);if(!g||!v)return null;if(!I3(g.type,[Pi,Ks,mn,kh,_i]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${To(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,mn);return k?new Iy(g,v,k):null}return new Iy(g,v)}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(!yv(u,["boolean","string","number","null"]))throw new il(`Expected first argument to be of type boolean, string, number or null, but found ${To(ml(u))} instead.`);if(!yv(g,["string","array"]))throw new il(`Expected second argument to be of type array or string, but found ${To(ml(g))} instead.`);if(this.fromIndex){const v=this.fromIndex.evaluate(c);return g.indexOf(u,v)}return g.indexOf(u)}eachChild(c){c(this.needle),c(this.haystack),this.fromIndex&&c(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const c=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),c]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Mv{constructor(c,u,g,v,k,N){this.inputType=c,this.type=u,this.input=g,this.cases=v,this.outputs=k,this.otherwise=N}static parse(c,u){if(c.length<5)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length%2!=1)return u.error("Expected an even number of arguments.");let g,v;u.expectedType&&u.expectedType.kind!=="value"&&(v=u.expectedType);const k={},N=[];for(let $=2;$Number.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof se=="number"&&Math.floor(se)!==se)return X.error("Numeric branch labels must be integer values.");if(g){if(X.checkSubtype(g,ml(se)))return null}else g=ml(se);if(k[String(se)]!==void 0)return X.error("Branch labels must be unique.");k[String(se)]=N.length}const te=u.parse(G,$,v);if(!te)return null;v=v||te.type,N.push(te)}const I=u.parse(c[1],1,_i);if(!I)return null;const R=u.parse(c[c.length-1],c.length-1,v);return R?I.type.kind!=="value"&&u.concat(1).checkSubtype(g,I.type)?null:new Mv(g,v,I,k,N,R):null}evaluate(c){const u=this.input.evaluate(c);return(mk(ml(u),this.inputType)&&this.outputs[this.cases[u]]||this.otherwise).evaluate(c)}eachChild(c){c(this.input),this.outputs.forEach(c),c(this.otherwise)}outputDefined(){return this.outputs.every(c=>c.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["match",this.input.serialize()],u=Object.keys(this.cases).sort(),g=[],v={};for(const N of u){const I=v[this.cases[N]];I===void 0?(v[this.cases[N]]=g.length,g.push([this.cases[N],[N]])):g[I][1].push(N)}const k=N=>this.inputType.kind==="number"?Number(N):N;for(const[N,I]of g)c.push(I.length===1?k(I[0]):I.map(k)),c.push(this.outputs[N].serialize());return c.push(this.otherwise.serialize()),c}}class Tv{constructor(c,u,g){this.type=c,this.branches=u,this.otherwise=g}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found only ${c.length-1}.`);if(c.length%2!=0)return u.error("Expected an odd number of arguments.");let g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);const v=[];for(let N=1;Nu.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class Fk{constructor(c,u,g,v){this.type=c,this.input=u,this.beginIndex=g,this.endIndex=v}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,_i),v=u.parse(c[2],2,mn);if(!g||!v)return null;if(!I3(g.type,[pc(_i),Ks,_i]))return u.error(`Expected first argument to be of type array or string, but found ${To(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,mn);return k?new Fk(g.type,g,v,k):null}return new Fk(g.type,g,v)}evaluate(c){const u=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!yv(u,["string","array"]))throw new il(`Expected first argument to be of type array or string, but found ${To(ml(u))} instead.`);if(this.endIndex){const v=this.endIndex.evaluate(c);return u.slice(g,v)}return u.slice(g)}eachChild(c){c(this.input),c(this.beginIndex),this.endIndex&&c(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const c=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),c]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class e5{constructor(c,u){this.type=pc(Ks),this.str=c,this.delimiter=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,Ks),v=u.parse(c[2],2,Ks);return g&&v?new e5(g,v):void 0}evaluate(c){const u=this.str.evaluate(c),g=this.delimiter.evaluate(c);return u.split(g)}eachChild(c){c(this.str),c(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function t5(f,c){return f==="=="||f==="!="?c.kind==="boolean"||c.kind==="string"||c.kind==="number"||c.kind==="null"||c.kind==="value":c.kind==="string"||c.kind==="number"||c.kind==="value"}function r5(f,c,u,g){return g.compare(c,u)===0}function Py(f,c,u){const g=f!=="=="&&f!=="!=";return class Dze{constructor(k,N,I){this.type=Pi,this.lhs=k,this.rhs=N,this.collator=I,this.hasUntypedArgument=k.type.kind==="value"||N.type.kind==="value"}static parse(k,N){if(k.length!==3&&k.length!==4)return N.error("Expected two or three arguments.");const I=k[0];let R=N.parse(k[1],1,_i);if(!R)return null;if(!t5(I,R.type))return N.concat(1).error(`"${I}" comparisons are not supported for type '${To(R.type)}'.`);let $=N.parse(k[2],2,_i);if(!$)return null;if(!t5(I,$.type))return N.concat(2).error(`"${I}" comparisons are not supported for type '${To($.type)}'.`);if(R.type.kind!==$.type.kind&&R.type.kind!=="value"&&$.type.kind!=="value")return N.error(`Cannot compare types '${To(R.type)}' and '${To($.type)}'.`);g&&(R.type.kind==="value"&&$.type.kind!=="value"?R=new Nh($.type,[R]):R.type.kind!=="value"&&$.type.kind==="value"&&($=new Nh(R.type,[$])));let W=null;if(k.length===4){if(R.type.kind!=="string"&&$.type.kind!=="string"&&R.type.kind!=="value"&&$.type.kind!=="value")return N.error("Cannot use collator to compare non-string types.");if(W=N.parse(k[3],3,pk),!W)return null}return new Dze(R,$,W)}evaluate(k){const N=this.lhs.evaluate(k),I=this.rhs.evaluate(k);if(g&&this.hasUntypedArgument){const R=ml(N),$=ml(I);if(R.kind!==$.kind||R.kind!=="string"&&R.kind!=="number")throw new il(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${R.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const R=ml(N),$=ml(I);if(R.kind!=="string"||$.kind!=="string")return c(k,N,I)}return this.collator?u(k,N,I,this.collator.evaluate(k)):c(k,N,I)}eachChild(k){k(this.lhs),k(this.rhs),this.collator&&k(this.collator)}outputDefined(){return!0}serialize(){const k=[f];return this.eachChild(N=>{k.push(N.serialize())}),k}}}const sae=Py("==",function(f,c,u){return c===u},r5),iae=Py("!=",function(f,c,u){return c!==u},function(f,c,u,g){return!r5(0,c,u,g)}),cP=Py("<",function(f,c,u){return c",function(f,c,u){return c>u},function(f,c,u,g){return g.compare(c,u)>0}),zk=Py("<=",function(f,c,u){return c<=u},function(f,c,u,g){return g.compare(c,u)<=0}),aae=Py(">=",function(f,c,u){return c>=u},function(f,c,u,g){return g.compare(c,u)>=0});class Bk{constructor(c,u,g,v,k,N){this.type=Ks,this.number=c,this.locale=u,this.currency=g,this.unit=v,this.minFractionDigits=k,this.maxFractionDigits=N}static parse(c,u){if(c.length!==3)return u.error("Expected two arguments.");const g=u.parse(c[1],1,mn);if(!g)return null;const v=c[2];if(typeof v!="object"||Array.isArray(v))return u.error("NumberFormat options argument must be an object.");let k=null;if(v.locale&&(k=u.parseObjectValue(v.locale,2,"locale",Ks),!k))return null;let N=null;if(v.currency&&(N=u.parseObjectValue(v.currency,2,"currency",Ks),!N))return null;let I=null;if(v.unit&&(I=u.parseObjectValue(v.unit,2,"unit",Ks),!I))return null;let R=null;if(v["min-fraction-digits"]&&(R=u.parseObjectValue(v["min-fraction-digits"],2,"min-fraction-digits",mn),!R))return null;let $=null;return v["max-fraction-digits"]&&($=u.parseObjectValue(v["max-fraction-digits"],2,"max-fraction-digits",mn),!$)?null:new Bk(g,k,N,I,R,$)}evaluate(c){return new Intl.NumberFormat(this.locale?this.locale.evaluate(c):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(c):void 0,unit:this.unit?this.unit.evaluate(c):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(c):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(c):void 0}).format(this.number.evaluate(c))}eachChild(c){c(this.number),this.locale&&c(this.locale),this.currency&&c(this.currency),this.unit&&c(this.unit),this.minFractionDigits&&c(this.minFractionDigits),this.maxFractionDigits&&c(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const c={};return this.locale&&(c.locale=this.locale.serialize()),this.currency&&(c.currency=this.currency.serialize()),this.unit&&(c.unit=this.unit.serialize()),this.minFractionDigits&&(c["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(c["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),c]}}class n5{constructor(c){this.type=mn,this.input=c}static parse(c,u){if(c.length!==2)return u.error(`Expected 1 argument, but found ${c.length-1} instead.`);const g=u.parse(c[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?u.error(`Expected argument of type string or array, but found ${To(g.type)} instead.`):new n5(g):null}evaluate(c){const u=this.input.evaluate(c);if(typeof u=="string"||Array.isArray(u))return u.length;throw new il(`Expected value to be of type string or array, but found ${To(ml(u))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(u=>{c.push(u.serialize())}),c}}function uP(f){return function(){f=1831565813+(f|=0)|0;let c=Math.imul(f^f>>>15,1|f);return c=c+Math.imul(c^c>>>7,61|c)^c,((c^c>>>14)>>>0)/4294967296}}const Ly={"==":sae,"!=":iae,">":dP,"<":cP,">=":aae,"<=":zk,array:Nh,at:Dk,"at-interpolated":Rk,boolean:Nh,case:Tv,coalesce:Cv,collator:Sl,format:ff,image:is,in:J3,"index-of":Iy,interpolate:lu,"interpolate-hcl":lu,"interpolate-lab":lu,length:n5,let:vp,literal:xp,match:Mv,number:Nh,"number-format":Bk,object:Nh,slice:Fk,step:Nv,string:Nh,"to-boolean":pf,"to-color":pf,"to-number":pf,"to-string":pf,var:Ak,within:Dm,distance:Zg,config:Ty,split:e5};function s5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,N=Wg(c,u,g,k);if(N)throw new il(N);return new wi(c/255,u/255,g/255,k)}function i5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,N=function($,W,G,X){return typeof $=="number"&&$>=0&&$<=360?typeof W=="number"&&W>=0&&W<=100&&typeof G=="number"&&G>=0&&G<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[$,W,G,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[$,W,G,X]:[$,W,G]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[$,W,G,X]:[$,W,G]).join(", ")}]: 'h' must be between 0 and 360.`}(c,u,g,k);if(N)throw new il(N);const I=`hsla(${c}, ${u}%, ${g}%, ${k})`,R=wi.parse(I);if(!R)throw new il(`Failed to parse HSLA color: ${I}`);return R}function hP(f,c){return f in c}function a5(f,c){const u=c[f];return u===void 0?null:u}function zm(f){return{type:f}}function Yg(f){if(f instanceof Ty)return new Set([f.key]);let c=new Set;return f.eachChild(u=>{c=new Set([...c,...Yg(u)])}),c}function $k(f){if(f instanceof Jc&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(u=>{!c&&$k(u)&&(c=!0)}),c}function fP(f){return{result:"success",value:f}}function Bm(f){return{result:"error",value:f}}function o5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Av(f){return f["property-type"]==="data-driven"}function pP(f){return o5(f.expression,"measure-light")}function mP(f){return o5(f.expression,"zoom")}function Uk(f){return!!f.expression&&f.expression.interpolated}function qk(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function gP(f){return f}function xP(f,c){const u=c.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",v=g||!(g||f.property!==void 0),k=f.type||(Uk(c)?"exponential":"interval");if(u&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map($=>[$[0],wi.parse($[1])])),f.default=wi.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!lP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let N,I,R;if(k==="exponential")N=yP;else if(k==="interval")N=lae;else if(k==="categorical"){N=oae,I=Object.create(null);for(const $ of f.stops)I[$[0]]=$[1];R=typeof f.stops[0][0]}else{if(k!=="identity")throw new Error(`Unknown function type "${k}"`);N=vP}if(g){const $={},W=[];for(let te=0;tete[0]),evaluate:({zoom:te},se)=>yP({stops:G,base:f.base},c,te).evaluate(te,se)}}if(v){const $=k==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:$,interpolationFactor:lu.interpolationFactor.bind(void 0,$),zoomStops:f.stops.map(W=>W[0]),evaluate:({zoom:W})=>N(f,c,W,I,R)}}return{kind:"source",evaluate($,W){const G=W&&W.properties?W.properties[f.property]:void 0;return G===void 0?gf(f.default,c.default):N(f,c,G,I,R)}}}function gf(f,c,u){return f!==void 0?f:c!==void 0?c:u!==void 0?u:void 0}function oae(f,c,u,g,v){return gf(typeof u===v?g[u]:void 0,f.default,c.default)}function lae(f,c,u){if(!jy(u))return gf(f.default,c.default);const g=f.stops.length;if(g===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[g-1][0])return f.stops[g-1][1];const v=Ik(f.stops.map(k=>k[0]),u);return f.stops[v][1]}function yP(f,c,u){const g=f.base!==void 0?f.base:1;if(!jy(u))return gf(f.default,c.default);const v=f.stops.length;if(v===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[v-1][0])return f.stops[v-1][1];const k=Ik(f.stops.map(W=>W[0]),u),N=function(W,G,X,te){const se=te-X,me=W-X;return se===0?0:G===1?me/se:(Math.pow(G,me)-1)/(Math.pow(G,se)-1)}(u,g,f.stops[k][0],f.stops[k+1][0]),I=f.stops[k][1],R=f.stops[k+1][1];let $=mv[c.type]||gP;if(f.colorSpace&&f.colorSpace!=="rgb"){const W=lP[f.colorSpace];$=(G,X)=>W.reverse(W.interpolate(W.forward(G),W.forward(X),N))}return typeof I.evaluate=="function"?{evaluate(...W){const G=I.evaluate.apply(void 0,W),X=R.evaluate.apply(void 0,W);if(G!==void 0&&X!==void 0)return $(G,X,N)}}:$(I,R,N)}function vP(f,c,u){return c.type==="color"?u=wi.parse(u):c.type==="formatted"?u=Xc.fromString(u.toString()):c.type==="resolvedImage"?u=Qc.build(u.toString()):un(u)===c.type||c.type==="enum"&&c.values[u]||(u=void 0),gf(u,f.default,c.default)}Jc.register(Ly,{error:[{kind:"error"},[Ks],(f,[c])=>{throw new il(c.evaluate(f))}],typeof:[Ks,[_i],(f,[c])=>To(ml(c.evaluate(f)))],"to-rgba":[pc(mn,4),[_d],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[pc(mn,4),[_d],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[_d,[mn,mn,mn],s5],rgba:[_d,[mn,mn,mn,mn],s5],hsl:[_d,[mn,mn,mn],i5],hsla:[_d,[mn,mn,mn,mn],i5],has:{type:Pi,overloads:[[[Ks],(f,[c])=>hP(c.evaluate(f),f.properties())],[[Ks,hf],(f,[c,u])=>hP(c.evaluate(f),u.evaluate(f))]]},get:{type:_i,overloads:[[[Ks],(f,[c])=>a5(c.evaluate(f),f.properties())],[[Ks,hf],(f,[c,u])=>a5(c.evaluate(f),u.evaluate(f))]]},"feature-state":[_i,[Ks],(f,[c])=>a5(c.evaluate(f),f.featureState||{})],properties:[hf,[],f=>f.properties()],"geometry-type":[Ks,[],f=>f.geometryType()],worldview:[Ks,[],f=>f.globals.worldview||""],"is-active-floor":[Pi,zm(Ks),(f,c)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const u=f.globals.activeFloors;return c.some(g=>{const v=g.evaluate(f);return u.has(v)})}],id:[_i,[],f=>f.id()],zoom:[mn,[],f=>f.globals.zoom],pitch:[mn,[],f=>f.globals.pitch||0],"distance-from-center":[mn,[],f=>f.distanceFromCenter()],"measure-light":[mn,[Ks],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[mn,[],f=>f.globals.heatmapDensity||0],"line-progress":[mn,[],f=>f.globals.lineProgress||0],"raster-value":[mn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[mn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[mn,[],f=>f.globals.skyRadialProgress||0],accumulated:[_i,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[mn,zm(mn),(f,c)=>{let u=0;for(const g of c)u+=g.evaluate(f);return u}],"*":[mn,zm(mn),(f,c)=>{let u=1;for(const g of c)u*=g.evaluate(f);return u}],"-":{type:mn,overloads:[[[mn,mn],(f,[c,u])=>c.evaluate(f)-u.evaluate(f)],[[mn],(f,[c])=>-c.evaluate(f)]]},"/":[mn,[mn,mn],(f,[c,u])=>c.evaluate(f)/u.evaluate(f)],"%":[mn,[mn,mn],(f,[c,u])=>c.evaluate(f)%u.evaluate(f)],ln2:[mn,[],()=>Math.LN2],pi:[mn,[],()=>Math.PI],e:[mn,[],()=>Math.E],"^":[mn,[mn,mn],(f,[c,u])=>Math.pow(c.evaluate(f),u.evaluate(f))],sqrt:[mn,[mn],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[mn,[mn],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[mn,[mn],(f,[c])=>Math.log(c.evaluate(f))],log2:[mn,[mn],(f,[c])=>Math.log2(c.evaluate(f))],sin:[mn,[mn],(f,[c])=>Math.sin(c.evaluate(f))],cos:[mn,[mn],(f,[c])=>Math.cos(c.evaluate(f))],tan:[mn,[mn],(f,[c])=>Math.tan(c.evaluate(f))],asin:[mn,[mn],(f,[c])=>Math.asin(c.evaluate(f))],acos:[mn,[mn],(f,[c])=>Math.acos(c.evaluate(f))],atan:[mn,[mn],(f,[c])=>Math.atan(c.evaluate(f))],min:[mn,zm(mn),(f,c)=>Math.min(...c.map(u=>u.evaluate(f)))],max:[mn,zm(mn),(f,c)=>Math.max(...c.map(u=>u.evaluate(f)))],abs:[mn,[mn],(f,[c])=>Math.abs(c.evaluate(f))],round:[mn,[mn],(f,[c])=>{const u=c.evaluate(f);return u<0?-Math.round(-u):Math.round(u)}],floor:[mn,[mn],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[mn,[mn],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[Pi,[Ks,_i],(f,[c,u])=>f.properties()[c.value]===u.value],"filter-id-==":[Pi,[_i],(f,[c])=>f.id()===c.value],"filter-type-==":[Pi,[Ks],(f,[c])=>f.geometryType()===c.value],"filter-<":[Pi,[Ks,_i],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g{const u=f.id(),g=c.value;return typeof u==typeof g&&u":[Pi,[Ks,_i],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>v}],"filter-id->":[Pi,[_i],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>g}],"filter-<=":[Pi,[Ks,_i],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g<=v}],"filter-id-<=":[Pi,[_i],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u<=g}],"filter->=":[Pi,[Ks,_i],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>=v}],"filter-id->=":[Pi,[_i],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>=g}],"filter-has":[Pi,[_i],(f,[c])=>c.value in f.properties()],"filter-has-id":[Pi,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Pi,[pc(Ks)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[Pi,[pc(_i)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[Pi,[Ks,pc(_i)],(f,[c,u])=>u.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[Pi,[Ks,pc(_i)],(f,[c,u])=>function(g,v,k,N){for(;k<=N;){const I=k+N>>1;if(v[I]===g)return!0;v[I]>g?N=I-1:k=I+1}return!1}(f.properties()[c.value],u.value,0,u.value.length-1)],all:{type:Pi,overloads:[[[Pi,Pi],(f,[c,u])=>c.evaluate(f)&&u.evaluate(f)],[zm(Pi),(f,c)=>{for(const u of c)if(!u.evaluate(f))return!1;return!0}]]},any:{type:Pi,overloads:[[[Pi,Pi],(f,[c,u])=>c.evaluate(f)||u.evaluate(f)],[zm(Pi),(f,c)=>{for(const u of c)if(u.evaluate(f))return!0;return!1}]]},"!":[Pi,[Pi],(f,[c])=>!c.evaluate(f)],"is-supported-script":[Pi,[Ks],(f,[c])=>{const u=f.globals&&f.globals.isSupportedScript;return!u||u(c.evaluate(f))}],upcase:[Ks,[Ks],(f,[c])=>c.evaluate(f).toUpperCase()],downcase:[Ks,[Ks],(f,[c])=>c.evaluate(f).toLowerCase()],concat:[Ks,zm(_i),(f,c)=>c.map(u=>Ku(u.evaluate(f))).join("")],"resolved-locale":[Ks,[pk],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[mn,[mn,mn,_i],(f,c)=>{const[u,g,v]=c.map(N=>N.evaluate(f));if(u>g||u===g)return u;let k;if(typeof v=="string")k=function(N){let I=0;if(N.length===0)return I;for(let R=0;RJSON.stringify(G)).join(", ")}, but found ${JSON.stringify(W)} instead.`);return W}catch(W){const G=W;return this._warningHistory[G.message]||(this._warningHistory[G.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${G.message}`)),this._defaultValue}}}function Ev(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in Ly}function $m(f,c,u,g,v){const k=new Ek(Ly,[],c?function(I){const R={color:_d,string:Ks,number:mn,enum:Ks,boolean:Pi,formatted:gv,resolvedImage:xv};return I.type==="array"?pc(R[I.value]||_i,I.length):R[I.type]}(c):void 0,void 0,void 0,u,g,v),N=k.parse(f,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return N?fP(new Vk(N,c,u,g,v)):Bm(k.errors)}class Oy{constructor(c,u,g,v){this.kind=c,this._styleExpression=u,this.isLightConstant=g,this.isLineProgressConstant=v,this.isStateDependent=c!=="constant"&&!kv(u.expression),this.configDependencies=Yg(u.expression),this.isIndoorDependent=$k(u.expression)}evaluateWithoutErrorHandling(c,u,g,v,k,N){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,N)}evaluate(c,u,g,v,k,N,I){return this._styleExpression.evaluate(c,u,g,v,k,N,void 0,void 0,I)}}class Xg{constructor(c,u,g,v,k,N){this.kind=c,this.zoomStops=g,this._styleExpression=u,this.isStateDependent=c!=="camera"&&!kv(u.expression),this.isIndoorDependent=$k(u.expression),this.isLightConstant=k,this.isLineProgressConstant=N,this.configDependencies=Yg(u.expression),this.interpolationType=v}evaluateWithoutErrorHandling(c,u,g,v,k,N){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,N)}evaluate(c,u,g,v,k,N){return this._styleExpression.evaluate(c,u,g,v,k,N)}interpolationFactor(c,u,g){return this.interpolationType?lu.interpolationFactor(this.interpolationType,c,u,g):0}}function l5(f,c,u,g,v){if((f=$m(f,c,u,g,v)).result==="error")return f;const k=f.value.expression,N=Cy(k);if(!N&&!Av(c))return Bm([new Gu("","data expressions not supported")]);const I=My(k,["zoom","pitch","distance-from-center"]);if(!I&&!mP(c))return Bm([new Gu("","zoom expressions not supported")]);const R=My(k,["measure-light"]);if(!R&&!pP(c))return Bm([new Gu("","measure-light expression not supported")]);const $=My(k,["line-progress"]);if(!$&&!function(X){return o5(X.expression,"line-progress")}(c))return Bm([new Gu("","line-progress expression not supported")]);const W=c.expression&&c.expression.relaxZoomRestriction,G=Ch(k);return G||I||W?G instanceof Gu?Bm([G]):G instanceof lu&&!Uk(c)?Bm([new Gu("",'"interpolate" expressions cannot be used with this property')]):fP(G?new Xg(N&&$?"camera":"composite",f.value,G.labels,G instanceof lu?G.interpolation:void 0,R,$):new Oy(N&&$?"constant":"source",f.value,R,$)):Bm([new Gu("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Hk{constructor(c,u){this._parameters=c,this._specification=u,Object.assign(this,xP(this._parameters,this._specification))}static deserialize(c){return new Hk(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Ch(f){let c=null;if(f instanceof vp)c=Ch(f.result);else if(f instanceof Cv){for(const u of f.args)if(c=Ch(u),c)break}else(f instanceof Nv||f instanceof lu)&&f.input instanceof Jc&&f.input.name==="zoom"&&(c=f);return c instanceof Gu||f.eachChild(u=>{const g=Ch(u);g instanceof Gu?c=g:c&&g&&c!==g&&(c=new Gu("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var c5,_P,bP=function(){if(_P)return c5;_P=1,c5=c;var f=3;function c(u,g,v){var k=this.cells=[];if(u instanceof ArrayBuffer){this.arrayBuffer=u;var N=new Int32Array(this.arrayBuffer);u=N[0],this.d=(g=N[1])+2*(v=N[2]);for(var I=0;I=X[me+0]&&k>=X[me+1])?(R[se]=!0,I.push(G[se])):R[se]=!1}}},c.prototype._forEachCell=function(u,g,v,k,N,I,R,$){for(var W=this._convertToCellCoord(u),G=this._convertToCellCoord(g),X=this._convertToCellCoord(v),te=this._convertToCellCoord(k),se=W;se<=X;se++)for(var me=G;me<=te;me++){var Se=this.d*me+se;if((!$||$(this._convertFromCellCoord(se),this._convertFromCellCoord(me),this._convertFromCellCoord(se+1),this._convertFromCellCoord(me+1)))&&N.call(this,u,g,v,k,Se,I,R,$))return}},c.prototype._convertFromCellCoord=function(u){return(u-this.padding)/this.scale},c.prototype._convertToCellCoord=function(u){return Math.max(0,Math.min(this.d-1,Math.floor(u*this.scale)+this.padding))},c.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var u=this.cells,g=f+this.cells.length+1+1,v=0,k=0;k=0||(v[k]=_p(f[k],c)));f instanceof Error&&(v.message=f.message)}if(v.$name)throw new Error("$name property is reserved for worker serialization logic.");return g!=="Object"&&(v.$name=g),v}throw new Error("can't serialize object of type "+typeof f)}function Um(f){if(f==null||typeof f=="boolean"||typeof f=="number"||typeof f=="string"||f instanceof Boolean||f instanceof Number||f instanceof String||f instanceof Date||f instanceof RegExp||Iv(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(Um);if(typeof f=="object"){const c=f.$name||"Object";if(c==="Map"){const v=f.entries||[],k=new Map;for(let N=0;Nf>=128&&f<=255,Arabic:f=>f>=1536&&f<=1791,"Arabic Supplement":f=>f>=1872&&f<=1919,"Arabic Extended-A":f=>f>=2208&&f<=2303,"Hangul Jamo":f=>f>=4352&&f<=4607,"Unified Canadian Aboriginal Syllabics":f=>f>=5120&&f<=5759,Khmer:f=>f>=6016&&f<=6143,"Unified Canadian Aboriginal Syllabics Extended":f=>f>=6320&&f<=6399,"General Punctuation":f=>f>=8192&&f<=8303,"Letterlike Symbols":f=>f>=8448&&f<=8527,"Number Forms":f=>f>=8528&&f<=8591,"Miscellaneous Technical":f=>f>=8960&&f<=9215,"Control Pictures":f=>f>=9216&&f<=9279,"Optical Character Recognition":f=>f>=9280&&f<=9311,"Enclosed Alphanumerics":f=>f>=9312&&f<=9471,"Geometric Shapes":f=>f>=9632&&f<=9727,"Miscellaneous Symbols":f=>f>=9728&&f<=9983,"Miscellaneous Symbols and Arrows":f=>f>=11008&&f<=11263,"CJK Radicals Supplement":f=>f>=11904&&f<=12031,"Kangxi Radicals":f=>f>=12032&&f<=12255,"Ideographic Description Characters":f=>f>=12272&&f<=12287,"CJK Symbols and Punctuation":f=>f>=12288&&f<=12351,Hiragana:f=>f>=12352&&f<=12447,Katakana:f=>f>=12448&&f<=12543,Bopomofo:f=>f>=12544&&f<=12591,"Hangul Compatibility Jamo":f=>f>=12592&&f<=12687,Kanbun:f=>f>=12688&&f<=12703,"Bopomofo Extended":f=>f>=12704&&f<=12735,"CJK Strokes":f=>f>=12736&&f<=12783,"Katakana Phonetic Extensions":f=>f>=12784&&f<=12799,"Enclosed CJK Letters and Months":f=>f>=12800&&f<=13055,"CJK Compatibility":f=>f>=13056&&f<=13311,"CJK Unified Ideographs Extension A":f=>f>=13312&&f<=19903,"Yijing Hexagram Symbols":f=>f>=19904&&f<=19967,"CJK Unified Ideographs":f=>f>=19968&&f<=40959,"Yi Syllables":f=>f>=40960&&f<=42127,"Yi Radicals":f=>f>=42128&&f<=42191,"Hangul Jamo Extended-A":f=>f>=43360&&f<=43391,"Hangul Syllables":f=>f>=44032&&f<=55215,"Hangul Jamo Extended-B":f=>f>=55216&&f<=55295,"Private Use Area":f=>f>=57344&&f<=63743,"CJK Compatibility Ideographs":f=>f>=63744&&f<=64255,"Arabic Presentation Forms-A":f=>f>=64336&&f<=65023,"Vertical Forms":f=>f>=65040&&f<=65055,"CJK Compatibility Forms":f=>f>=65072&&f<=65103,"Small Form Variants":f=>f>=65104&&f<=65135,"Arabic Presentation Forms-B":f=>f>=65136&&f<=65279,"Halfwidth and Fullwidth Forms":f=>f>=65280&&f<=65519,Osage:f=>f>=66736&&f<=66815,"CJK Unified Ideographs Extension B":f=>f>=131072&&f<=173791};function Pv(f){for(const c of f)if(Wk(c.charCodeAt(0)))return!0;return!1}function d5(f){for(const c of f)if(!wP(c.charCodeAt(0)))return!1;return!0}function wP(f){return!(Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f))}function Wk(f){return!(f!==746&&f!==747&&(f<4352||!(Tn["Bopomofo Extended"](f)||Tn.Bopomofo(f)||Tn["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||Tn["CJK Compatibility Ideographs"](f)||Tn["CJK Compatibility"](f)||Tn["CJK Radicals Supplement"](f)||Tn["CJK Strokes"](f)||!(!Tn["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||Tn["CJK Unified Ideographs Extension A"](f)||Tn["CJK Unified Ideographs"](f)||Tn["Enclosed CJK Letters and Months"](f)||Tn["Hangul Compatibility Jamo"](f)||Tn["Hangul Jamo Extended-A"](f)||Tn["Hangul Jamo Extended-B"](f)||Tn["Hangul Jamo"](f)||Tn["Hangul Syllables"](f)||Tn.Hiragana(f)||Tn["Ideographic Description Characters"](f)||Tn.Kanbun(f)||Tn["Kangxi Radicals"](f)||Tn["Katakana Phonetic Extensions"](f)||Tn.Katakana(f)&&f!==12540||!(!Tn["Halfwidth and Fullwidth Forms"](f)||f===65288||f===65289||f===65293||f>=65306&&f<=65310||f===65339||f===65341||f===65343||f>=65371&&f<=65503||f===65507||f>=65512&&f<=65519)||!(!Tn["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||Tn["Unified Canadian Aboriginal Syllabics"](f)||Tn["Unified Canadian Aboriginal Syllabics Extended"](f)||Tn["Vertical Forms"](f)||Tn["Yijing Hexagram Symbols"](f)||Tn["Yi Syllables"](f)||Tn["Yi Radicals"](f))))}function Gk(f){return!(Wk(f)||function(c){return!!(Tn["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||Tn["General Punctuation"](c)&&(c===8214||c===8224||c===8225||c===8240||c===8241||c===8251||c===8252||c===8258||c===8263||c===8264||c===8265||c===8273)||Tn["Letterlike Symbols"](c)||Tn["Number Forms"](c)||Tn["Miscellaneous Technical"](c)&&(c>=8960&&c<=8967||c>=8972&&c<=8991||c>=8996&&c<=9e3||c===9003||c>=9085&&c<=9114||c>=9150&&c<=9165||c===9167||c>=9169&&c<=9179||c>=9186&&c<=9215)||Tn["Control Pictures"](c)&&c!==9251||Tn["Optical Character Recognition"](c)||Tn["Enclosed Alphanumerics"](c)||Tn["Geometric Shapes"](c)||Tn["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||Tn["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||Tn["CJK Symbols and Punctuation"](c)||Tn.Katakana(c)||Tn["Private Use Area"](c)||Tn["CJK Compatibility Forms"](c)||Tn["Small Form Variants"](c)||Tn["Halfwidth and Fullwidth Forms"](c)||c===8734||c===8756||c===8757||c>=9984&&c<=10087||c>=10102&&c<=10131||c===65532||c===65533)}(f))}function Kk(f){return Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function u5(f){return f>=1424&&f<=2303||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function bp(f,c){return!(!c&&u5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||Tn.Khmer(f))}function cae(f){for(const c of f)if(u5(c.charCodeAt(0)))return!0;return!1}const Ud={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let h5=null,ed=Ud.unavailable,wp=null;const Lv=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(ed=Ud.error),h5&&h5(f)};function Zk(){Yk.fire(new uf("pluginStateChange",{pluginStatus:ed,pluginURL:wp}))}const Yk=new Hg,Ov=function(){return ed},jP=function(){if(ed!==Ud.deferred||!wp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ed=Ud.loading,Zk(),wp&&Hu({url:wp},f=>{f?Lv(f):(ed=Ud.loaded,Zk())})},jp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ed===Ud.loaded||jp.applyArabicShaping!=null,isLoading:()=>ed===Ud.loading,setState(f){ed=f.pluginStatus,wp=f.pluginURL},isParsing:()=>ed===Ud.parsing,isParsed:()=>ed===Ud.parsed,getPluginURL:()=>wp};class Ji{constructor(c,u){this.zoom=c,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.transition=u.transition,this.pitch=u.pitch,this.brightness=u.brightness,this.worldview=u.worldview,this.activeFloors=u.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(c){return function(u,g){for(const v of u)if(!bp(v.charCodeAt(0),g))return!1;return!0}(c,jp.isLoaded())}}class Xk{constructor(c,u,g,v,k){this.property=c,this.value=u,this.expression=function(N,I,R,$,W){if(qk(N))return new Hk(N,I);if(Ev(N)||Array.isArray(N)&&N.length>0){const G=l5(N,I,R,$,W);if(G.result==="error")throw new Error(G.value.map(X=>`${X.key}: ${X.message}`).join(", "));return G.value}{let G=N;return typeof N=="string"&&I.type==="color"&&(G=wi.parse(N)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>G}}}(u===void 0?c.specification.default:u,c.specification,g,v,k)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,u,g,v){return this.property.possiblyEvaluate(this,c,u,g,v)}}class f5{constructor(c,u,g,v){this.property=c,this.value=new Xk(c,void 0,u,g,v)}transitioned(c,u){return new NP(this.property,this.value,u,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new NP(this.property,this.value,null,{},0)}}class kP{constructor(c,u,g,v){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=u,this._options=g,this._iconImageUseTheme=v,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return ar(this._values[c].value.value)}setValue(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new f5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new Xk(this._values[c].property,u===null?void 0:ar(u),this._scope,this._options,this._iconImageUseTheme),this._values[c].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[c].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[c].value.isIndoorDependent())}setTransitionOrValue(c,u){u&&(this._options=u);const g=this._properties.properties;if(c)for(const v in c){const k=c[v];if(v.endsWith("-transition")){const N=v.slice(0,-11);g[N]&&this.setTransition(N,k)}else g.hasOwnProperty(v)&&this.setValue(v,k)}}getTransition(c){return ar(this._values[c].transition)}setTransition(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new f5(this._values[c].property)),this._values[c].transition=ar(u)||void 0}serialize(){const c={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(c[u]=g);const v=this.getTransition(u);v!==void 0&&(c[`${u}-transition`]=v)}return c}transitioned(c,u){const g=new SP(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].transitioned(c,u._values[v]);return g}untransitioned(){const c=new SP(this._properties);for(const u of Object.keys(this._values))c._values[u]=this._values[u].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class NP{constructor(c,u,g,v,k){const N=v.delay||0,I=v.duration||0;k=k||0,this.property=c,this.value=u,this.begin=k+N,this.end=this.begin+I,c.specification.transition&&(v.delay||v.duration)&&(this.prior=g)}possiblyEvaluate(c,u,g){const v=c.now||0,k=this.value.possiblyEvaluate(c,u,g),N=this.prior;if(N){if(v>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(v":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function MP(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function Qk(f){if(Array.isArray(f))return f.map(Qk);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const c={};for(const u in f)c[u]=Qk(f[u]);return c}return MP(f)}function xf(f){if(f===!0||f===!1)return!0;if(!Array.isArray(f)||f.length===0)return!1;switch(f[0]){case"has":return f.length>=2&&f[1]!=="$id"&&f[1]!=="$type";case"in":return f.length>=3&&(typeof f[1]!="string"||Array.isArray(f[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return f.length!==3||Array.isArray(f[1])||Array.isArray(f[2]);case"any":case"all":for(const c of f.slice(1))if(!xf(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function Jk(f,c="",u=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};xf(f)||(f=eN(f));const v=f;let k=!0;try{k=function(W){if(!Ry(W))return W;let G=Qk(W);return TP(G),G=rx(G),G}(v)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(v,null,2)} `)}let N=null,I=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){I=Rt[`filter_${g}`];const W=$m(k,I,c,u);if(W.result==="error")throw new Error(W.value.map(G=>`${G.key}: ${G.message}`).join(", "));N=(G,X,te)=>W.value.evaluate(G,X,{},te)}let R=null,$=null;if(k!==v){const W=$m(v,I,c,u);if(W.result==="error")throw new Error(W.value.map(G=>`${G.key}: ${G.message}`).join(", "));R=(G,X,te,se,me)=>W.value.evaluate(G,X,{},te,void 0,void 0,se,me),$=!Cy(W.value.expression)}return{filter:N,dynamicFilter:R||void 0,needGeometry:AP(k),needFeature:!!$}}function rx(f){if(!Array.isArray(f))return f;const c=function(u){if(dae.has(u[0])){for(let g=1;grx(u))}function TP(f){let c=!1;const u=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function uae(f,c){return fc?1:0}function AP(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?tN(f[1],f[2],c):c==="any"?(u=f.slice(1),["any"].concat(u.map(eN))):c==="all"?["all"].concat(f.slice(1).map(eN)):c==="none"?["all"].concat(f.slice(1).map(eN).map(Dv)):c==="in"?rN(f[1],f.slice(2)):c==="!in"?Dv(rN(f[1],f.slice(2))):c==="has"?nN(f[1]):c!=="!has"||Dv(nN(f[1]));var u}function tN(f,c,u){switch(f){case"$type":return[`filter-type-${u}`,c];case"$id":return[`filter-id-${u}`,c];default:return[`filter-${u}`,f,c]}}function rN(f,c){if(c.length===0)return!1;switch(f){case"$type":return["filter-type-in",["literal",c]];case"$id":return["filter-id-in",["literal",c]];default:return c.length>200&&!c.some(u=>typeof u!=typeof c[0])?["filter-in-large",f,["literal",c.sort(uae)]]:["filter-in-small",f,["literal",c]]}}function nN(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function Dv(f){return["!",f]}const nx="";function Mh(f,c){return c?`${f}${nx}${c}`:f}let EP;const IP=()=>EP||(EP=new $a({"icon-size":new Lr(Rt.layout_symbol["icon-size"]),"icon-image":new Lr(Rt.layout_symbol["icon-image"]),"icon-rotate":new Lr(Rt.layout_symbol["icon-rotate"]),"icon-offset":new Lr(Rt.layout_symbol["icon-offset"]),"text-size":new Lr(Rt.layout_symbol["text-size"]),"text-rotate":new Lr(Rt.layout_symbol["text-rotate"]),"text-offset":new Lr(Rt.layout_symbol["text-offset"])}));class PP{constructor(c,u,g,v,k,N){const I=$m(c,Rt.appearance.condition);if(I.result==="success"&&(this.condition=I.value),this.name=u,g){this.properties=new ex(IP()),this.unevaluatedLayout=new CP(IP(),v,k,N);for(const R in g)this.unevaluatedLayout.setValue(R,g[R])}}isActive(c){return!(this.condition||!c.isHidden||this.name!=="hidden")||this.condition.evaluate(c.globals,c.feature,c.featureState,c.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(c){return this.properties.get(c)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(c){return this.unevaluatedLayout._values[c]}recalculate(c,u,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,u,g))}serialize(){const c={};return c.condition=this.condition.expression.serialize(),this.name&&(c.name=this.name),this.unevaluatedLayout&&(c.properties=this.unevaluatedLayout.serialize()),c}hasIconProperties(){const c=this.hasProperty("icon-image"),u=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),v=this.hasProperty("icon-rotate");return c||u||g||v}hasTextProperties(){const c=this.hasProperty("text-size"),u=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return c||u||g}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const LP="-transition",yf=new Set(["fill","line","background","hillshade","raster"]);class td extends Hg{constructor(c,u,g,v,k,N){if(super(),this.id=c.id,this.fqid=Mh(this.id,g),this.type=c.type,this.scope=g,this.lut=v,this.options=k,this.iconImageUseTheme=N,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},c.type!=="custom"){if(this.metadata=c.metadata,this.minzoom=c.minzoom,this.maxzoom=c.maxzoom,c.type&&c.type!=="background"&&c.type!=="sky"&&c.type!=="slot"){this.source=c.source,this.sourceLayer=c["source-layer"],this.filter=c.filter;const I=$m(this.filter,Rt[`filter_${c.type}`]);I.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...I.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||I.value.isIndoorDependent)}if(c.slot&&(this.slot=c.slot),c.appearances&&this.setAppearances(c.appearances),u.layout&&(this._unevaluatedLayout=new CP(u.layout,this.scope,k,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),u.paint){this._transitionablePaint=new kP(u.paint,this.scope,k);for(const I in c.paint)this.setPaintProperty(I,c.paint[I]);for(const I in c.layout)this.setLayoutProperty(I,c.layout[I]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ex(u.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&yf.has(this.type)}getLayoutProperty(c){return c==="visibility"?this.visibility:this._unevaluatedLayout.getValue(c)}setLayoutProperty(c,u){if(this.type==="custom"&&c==="visibility")return void(this.visibility=u);const g=this._unevaluatedLayout;g._properties.properties[c]&&(g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),c==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(c){this.appearances=[],c.forEach(u=>{this.appearances.push(new PP(u.condition,u.name,u.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(c){return c.endsWith(LP)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,u){const g=this._transitionablePaint,v=g._properties.properties;if(c.endsWith(LP)){const G=c.slice(0,-11);return v[G]&&g.setTransition(G,u||void 0),!1}if(!v[c])return!1;const k=g._values[c],N=k.value.isDataDriven(),I=k.value;g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const R=g._values[c].value,$=R.isDataDriven(),W=c.endsWith("pattern")||c==="line-dasharray";return $||N||W||this._handleOverridablePaintPropertyUpdate(c,I,R)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,u,g){return null}_handleOverridablePaintPropertyUpdate(c,u,g){return!1}isHidden(c){return!!(this.minzoom&&c=this.maxzoom)||this.visibility==="none"}updateTransitions(c){this._transitioningPaint=this._transitionablePaint.transitioned(c,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(c,u){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,u,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,u)}serialize(){const c={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(c.appearances=this.appearances.map(u=>u.serialize())),gr(c,(u,g)=>!(u===void 0||g==="layout"&&!Object.keys(u).length||g==="paint"&&!Object.keys(u).length))}is3D(c){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const c in this.paint._values){const u=this.paint.get(c);if(u instanceof Jg&&Av(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}for(const c of this.appearances)if(!kv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=Jk(this.filter,this.scope,c),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(c){this._stats&&(c.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(c,u,g){return{}}queryRadius(c){}queryIntersectsFeature(c,u,g,v,k,N,I,R,$){}}const OP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Rv{constructor(c,u){this._structArray=c,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const hae=new ArrayBuffer(0);class ga{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(c,u){return c._trim(),u&&c.arrayBuffer&&u.add(c.arrayBuffer),{length:c.length,arrayBuffer:c.arrayBuffer}}static deserialize(c){const u=Object.create(this.prototype);return u.arrayBuffer=c.arrayBuffer,u.length=c.length,c.arrayBuffer?u.capacity=c.arrayBuffer.byteLength/u.bytesPerElement:(u.capacity=0,u.arrayBuffer=hae),u._refreshViews(),u}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(c){this.reserve(c),this.length=c}reserve(c){if(c>this.capacity){this._reallocCount++,this.capacity=Math.max(c,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}}reserveForAdditional(c){this.reserve(this.length+c)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...c){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...c){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function As(f,c=1){let u=0,g=0;return{members:f.map(v=>{const k=OP[v.type].BYTES_PER_ELEMENT,N=u=DP(u,Math.max(c,k)),I=v.components||1;return g=Math.max(g,k),u+=k*I,{name:v.name,type:v.type,components:I,offset:N}}),size:DP(u,Math.max(g,c)),alignment:c}}function DP(f,c){return Math.ceil(f/c)*c}class qm extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.int16[v+0]=u,this.int16[v+1]=g,c}}qm.prototype.bytesPerElement=4,Qr(qm,"StructArrayLayout2i4");class Fy extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}Fy.prototype.bytesPerElement=6,Qr(Fy,"StructArrayLayout3i6");class zy extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const N=4*c;return this.int16[N+0]=u,this.int16[N+1]=g,this.int16[N+2]=v,this.int16[N+3]=k,c}}zy.prototype.bytesPerElement=8,Qr(zy,"StructArrayLayout4i8");class kp extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.float32[1*c+0]=u,c}}kp.prototype.bytesPerElement=4,Qr(kp,"StructArrayLayout1f4");class p5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c,N=2*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.float32[N+1]=v,c}}p5.prototype.bytesPerElement=8,Qr(p5,"StructArrayLayout2i1f8");class m5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}m5.prototype.bytesPerElement=8,Qr(m5,"StructArrayLayout3i8");class g5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const N=this.length;return this.resize(N+1),this.emplace(N,c,u,g,v,k)}emplace(c,u,g,v,k,N){const I=5*c;return this.int16[I+0]=u,this.int16[I+1]=g,this.int16[I+2]=v,this.int16[I+3]=k,this.int16[I+4]=N,c}}g5.prototype.bytesPerElement=10,Qr(g5,"StructArrayLayout5i10");class sN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,N,I)}emplace(c,u,g,v,k,N,I,R){const $=6*c,W=12*c,G=3*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.uint8[W+4]=v,this.uint8[W+5]=k,this.uint8[W+6]=N,this.uint8[W+7]=I,this.float32[G+2]=R,c}}sN.prototype.bytesPerElement=12,Qr(sN,"StructArrayLayout2i4ub1f12");class cu extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.float32[k+0]=u,this.float32[k+1]=g,this.float32[k+2]=v,c}}cu.prototype.bytesPerElement=12,Qr(cu,"StructArrayLayout3f12");class bd extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const N=this.length;return this.resize(N+1),this.emplace(N,c,u,g,v,k)}emplace(c,u,g,v,k,N){const I=6*c,R=3*c;return this.uint16[I+0]=u,this.uint16[I+1]=g,this.uint16[I+2]=v,this.uint16[I+3]=k,this.float32[R+2]=N,c}}bd.prototype.bytesPerElement=12,Qr(bd,"StructArrayLayout4ui1f12");class sx extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const N=4*c;return this.uint16[N+0]=u,this.uint16[N+1]=g,this.uint16[N+2]=v,this.uint16[N+3]=k,c}}sx.prototype.bytesPerElement=8,Qr(sx,"StructArrayLayout4ui8");class iN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N){const I=this.length;return this.resize(I+1),this.emplace(I,c,u,g,v,k,N)}emplace(c,u,g,v,k,N,I){const R=6*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.int16[R+3]=k,this.int16[R+4]=N,this.int16[R+5]=I,c}}iN.prototype.bytesPerElement=12,Qr(iN,"StructArrayLayout6i12");class x5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I,R,$,W,G,X){const te=this.length;return this.resize(te+1),this.emplace(te,c,u,g,v,k,N,I,R,$,W,G,X)}emplace(c,u,g,v,k,N,I,R,$,W,G,X,te){const se=12*c;return this.int16[se+0]=u,this.int16[se+1]=g,this.int16[se+2]=v,this.int16[se+3]=k,this.uint16[se+4]=N,this.uint16[se+5]=I,this.uint16[se+6]=R,this.uint16[se+7]=$,this.int16[se+8]=W,this.int16[se+9]=G,this.int16[se+10]=X,this.int16[se+11]=te,c}}x5.prototype.bytesPerElement=24,Qr(x5,"StructArrayLayout4i4ui4i24");class y5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N){const I=this.length;return this.resize(I+1),this.emplace(I,c,u,g,v,k,N)}emplace(c,u,g,v,k,N,I){const R=10*c,$=5*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.float32[$+2]=k,this.float32[$+3]=N,this.float32[$+4]=I,c}}y5.prototype.bytesPerElement=20,Qr(y5,"StructArrayLayout3i3f20");class Vm extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const N=4*c;return this.float32[N+0]=u,this.float32[N+1]=g,this.float32[N+2]=v,this.float32[N+3]=k,c}}Vm.prototype.bytesPerElement=16,Qr(Vm,"StructArrayLayout4f16");class aN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint32[1*c+0]=u,c}}aN.prototype.bytesPerElement=4,Qr(aN,"StructArrayLayout1ul4");class du extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.uint16[v+0]=u,this.uint16[v+1]=g,c}}du.prototype.bytesPerElement=4,Qr(du,"StructArrayLayout2ui4");class oN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I,R,$,W,G,X,te){const se=this.length;return this.resize(se+1),this.emplace(se,c,u,g,v,k,N,I,R,$,W,G,X,te)}emplace(c,u,g,v,k,N,I,R,$,W,G,X,te,se){const me=20*c,Se=10*c;return this.int16[me+0]=u,this.int16[me+1]=g,this.int16[me+2]=v,this.int16[me+3]=k,this.int16[me+4]=N,this.float32[Se+3]=I,this.float32[Se+4]=R,this.float32[Se+5]=$,this.float32[Se+6]=W,this.int16[me+14]=G,this.uint32[Se+8]=X,this.uint16[me+18]=te,this.uint16[me+19]=se,c}}oN.prototype.bytesPerElement=40,Qr(oN,"StructArrayLayout5i4f1i1ul2ui40");class lN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,N,I)}emplace(c,u,g,v,k,N,I,R){const $=8*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.int16[$+2]=v,this.int16[$+4]=k,this.int16[$+5]=N,this.int16[$+6]=I,this.int16[$+7]=R,c}}lN.prototype.bytesPerElement=16,Qr(lN,"StructArrayLayout3i2i2i16");class cN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const N=this.length;return this.resize(N+1),this.emplace(N,c,u,g,v,k)}emplace(c,u,g,v,k,N){const I=4*c,R=8*c;return this.float32[I+0]=u,this.float32[I+1]=g,this.float32[I+2]=v,this.int16[R+6]=k,this.int16[R+7]=N,c}}cN.prototype.bytesPerElement=16,Qr(cN,"StructArrayLayout2f1f2i16");class v5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N){const I=this.length;return this.resize(I+1),this.emplace(I,c,u,g,v,k,N)}emplace(c,u,g,v,k,N,I){const R=20*c,$=5*c;return this.uint8[R+0]=u,this.uint8[R+1]=g,this.float32[$+1]=v,this.float32[$+2]=k,this.float32[$+3]=N,this.float32[$+4]=I,c}}v5.prototype.bytesPerElement=20,Qr(v5,"StructArrayLayout2ub4f20");class Bo extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.uint16[k+0]=u,this.uint16[k+1]=g,this.uint16[k+2]=v,c}}Bo.prototype.bytesPerElement=6,Qr(Bo,"StructArrayLayout3ui6");class By extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe,Fe,He,dt){const it=this.length;return this.resize(it+1),this.emplace(it,c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe,Fe,He,dt)}emplace(c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe,Fe,He,dt,it){const gt=30*c,Nt=15*c,Tt=60*c;return this.int16[gt+0]=u,this.int16[gt+1]=g,this.int16[gt+2]=v,this.float32[Nt+2]=k,this.float32[Nt+3]=N,this.uint16[gt+8]=I,this.uint16[gt+9]=R,this.uint32[Nt+5]=$,this.uint32[Nt+6]=W,this.uint32[Nt+7]=G,this.uint16[gt+16]=X,this.uint16[gt+17]=te,this.uint16[gt+18]=se,this.float32[Nt+10]=me,this.float32[Nt+11]=Se,this.uint8[Tt+48]=Ne,this.uint8[Tt+49]=Oe,this.uint8[Tt+50]=Fe,this.uint32[Nt+13]=He,this.int16[gt+28]=dt,this.uint8[Tt+58]=it,c}}By.prototype.bytesPerElement=60,Qr(By,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class _5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe,Fe,He,dt,it,gt,Nt,Tt,Gt,Dt,tr,or,lr,xr,vr,hr){const pr=this.length;return this.resize(pr+1),this.emplace(pr,c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe,Fe,He,dt,it,gt,Nt,Tt,Gt,Dt,tr,or,lr,xr,vr,hr)}emplace(c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe,Fe,He,dt,it,gt,Nt,Tt,Gt,Dt,tr,or,lr,xr,vr,hr,pr){const er=20*c,Zt=40*c,mr=80*c;return this.float32[er+0]=u,this.float32[er+1]=g,this.int16[Zt+4]=v,this.int16[Zt+5]=k,this.int16[Zt+6]=N,this.int16[Zt+7]=I,this.int16[Zt+8]=R,this.int16[Zt+9]=$,this.int16[Zt+10]=W,this.int16[Zt+11]=G,this.int16[Zt+12]=X,this.uint16[Zt+13]=te,this.uint16[Zt+14]=se,this.uint16[Zt+15]=me,this.uint16[Zt+16]=Se,this.uint16[Zt+17]=Ne,this.uint16[Zt+18]=Oe,this.uint16[Zt+19]=Fe,this.uint16[Zt+20]=He,this.uint16[Zt+21]=dt,this.uint16[Zt+22]=it,this.uint16[Zt+23]=gt,this.uint16[Zt+24]=Nt,this.uint16[Zt+25]=Tt,this.uint16[Zt+26]=Gt,this.uint16[Zt+27]=Dt,this.uint32[er+14]=tr,this.float32[er+15]=or,this.float32[er+16]=lr,this.float32[er+17]=xr,this.float32[er+18]=vr,this.uint8[mr+76]=hr,this.uint16[Zt+39]=pr,c}}_5.prototype.bytesPerElement=80,Qr(_5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class b5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N){const I=this.length;return this.resize(I+1),this.emplace(I,c,u,g,v,k,N)}emplace(c,u,g,v,k,N,I){const R=6*c;return this.float32[R+0]=u,this.float32[R+1]=g,this.float32[R+2]=v,this.float32[R+3]=k,this.float32[R+4]=N,this.float32[R+5]=I,c}}b5.prototype.bytesPerElement=24,Qr(b5,"StructArrayLayout6f24");class ix extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const N=this.length;return this.resize(N+1),this.emplace(N,c,u,g,v,k)}emplace(c,u,g,v,k,N){const I=5*c;return this.float32[I+0]=u,this.float32[I+1]=g,this.float32[I+2]=v,this.float32[I+3]=k,this.float32[I+4]=N,c}}ix.prototype.bytesPerElement=20,Qr(ix,"StructArrayLayout5f20");class w5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,N,I)}emplace(c,u,g,v,k,N,I,R){const $=7*c;return this.float32[$+0]=u,this.float32[$+1]=g,this.float32[$+2]=v,this.float32[$+3]=k,this.float32[$+4]=N,this.float32[$+5]=I,this.float32[$+6]=R,c}}w5.prototype.bytesPerElement=28,Qr(w5,"StructArrayLayout7f28");class j5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I,R,$,W,G){const X=this.length;return this.resize(X+1),this.emplace(X,c,u,g,v,k,N,I,R,$,W,G)}emplace(c,u,g,v,k,N,I,R,$,W,G,X){const te=11*c;return this.float32[te+0]=u,this.float32[te+1]=g,this.float32[te+2]=v,this.float32[te+3]=k,this.float32[te+4]=N,this.float32[te+5]=I,this.float32[te+6]=R,this.float32[te+7]=$,this.float32[te+8]=W,this.float32[te+9]=G,this.float32[te+10]=X,c}}j5.prototype.bytesPerElement=44,Qr(j5,"StructArrayLayout11f44");class $y extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I,R,$){const W=this.length;return this.resize(W+1),this.emplace(W,c,u,g,v,k,N,I,R,$)}emplace(c,u,g,v,k,N,I,R,$,W){const G=9*c;return this.float32[G+0]=u,this.float32[G+1]=g,this.float32[G+2]=v,this.float32[G+3]=k,this.float32[G+4]=N,this.float32[G+5]=I,this.float32[G+6]=R,this.float32[G+7]=$,this.float32[G+8]=W,c}}$y.prototype.bytesPerElement=36,Qr($y,"StructArrayLayout9f36");class vf extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.float32[v+0]=u,this.float32[v+1]=g,c}}vf.prototype.bytesPerElement=8,Qr(vf,"StructArrayLayout2f8");class wd extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const N=6*c;return this.uint32[3*c+0]=u,this.uint16[N+2]=g,this.uint16[N+3]=v,this.uint16[N+4]=k,c}}wd.prototype.bytesPerElement=12,Qr(wd,"StructArrayLayout1ul3ui12");class Hm extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint16[1*c+0]=u,c}}Hm.prototype.bytesPerElement=2,Qr(Hm,"StructArrayLayout1ui2");class k5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se){const Ne=this.length;return this.resize(Ne+1),this.emplace(Ne,c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se)}emplace(c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne){const Oe=16*c;return this.float32[Oe+0]=u,this.float32[Oe+1]=g,this.float32[Oe+2]=v,this.float32[Oe+3]=k,this.float32[Oe+4]=N,this.float32[Oe+5]=I,this.float32[Oe+6]=R,this.float32[Oe+7]=$,this.float32[Oe+8]=W,this.float32[Oe+9]=G,this.float32[Oe+10]=X,this.float32[Oe+11]=te,this.float32[Oe+12]=se,this.float32[Oe+13]=me,this.float32[Oe+14]=Se,this.float32[Oe+15]=Ne,c}}k5.prototype.bytesPerElement=64,Qr(k5,"StructArrayLayout16f64");class dN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,N,I){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,N,I)}emplace(c,u,g,v,k,N,I,R){const $=10*c,W=5*c;return this.uint16[$+0]=u,this.uint16[$+1]=g,this.uint16[$+2]=v,this.uint16[$+3]=k,this.float32[W+2]=N,this.float32[W+3]=I,this.float32[W+4]=R,c}}dN.prototype.bytesPerElement=20,Qr(dN,"StructArrayLayout4ui3f20");class N5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.int16[1*c+0]=u,c}}N5.prototype.bytesPerElement=2,Qr(N5,"StructArrayLayout1i2");class uN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint8[1*c+0]=u,c}}uN.prototype.bytesPerElement=1,Qr(uN,"StructArrayLayout1ub1");class hN extends Rv{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}hN.prototype.size=40;class RP extends oN{get(c){return new hN(this,c)}}Qr(RP,"CollisionBoxArray");class fN extends Rv{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(c){this._structArray.uint8[this._pos1+49]=c}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(c){this._structArray.uint8[this._pos1+50]=c}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(c){this._structArray.uint32[this._pos4+13]=c}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(c){this._structArray.uint8[this._pos1+58]=c}}fN.prototype.size=60;class FP extends By{get(c){return new fN(this,c)}}Qr(FP,"PlacedSymbolArray");class zP extends Rv{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(c){this._structArray.uint32[this._pos4+14]=c}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(c){this._structArray.float32[this._pos4+18]=c}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}zP.prototype.size=80;class S5 extends _5{get(c){return new zP(this,c)}}Qr(S5,"SymbolInstanceArray");class pN extends kp{getoffsetX(c){return this.float32[1*c+0]}}Qr(pN,"GlyphOffsetArray");class BP extends qm{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}Qr(BP,"SymbolLineVertexArray");class C5 extends Rv{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}C5.prototype.size=12;class M5 extends wd{get(c){return new C5(this,c)}}Qr(M5,"FeatureIndexArray");class $P extends du{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}Qr($P,"FillExtrusionCentroidArray");class mN extends Rv{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}mN.prototype.size=6;class Fv extends Fy{get(c){return new mN(this,c)}}Qr(Fv,"FillExtrusionWallArray");const UP=As([{name:"a_pos",components:2,type:"Int16"}],4),fae=As([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),qP=As([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Aa{constructor(c=[]){this.segments=c}_prepareSegment(c,u,g,v){let k=this.segments[this.segments.length-1];return c>Aa.MAX_VERTEX_ARRAY_LENGTH&&Vr(`Max vertices per segment is ${Aa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!k||k.vertexLength+c>Aa.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==v)&&(k={vertexOffset:u,primitiveOffset:g,vertexLength:0,primitiveLength:0},v!==void 0&&(k.sortKey=v),this.segments.push(k)),k}prepareSegment(c,u,g,v){return this._prepareSegment(c,u.length,g.length,v)}get(){return this.segments}destroy(){for(const c of this.segments)for(const u in c.vaos)c.vaos[u].destroy()}static simpleSegment(c,u,g,v){return new Aa([{vertexOffset:c,primitiveOffset:u,vertexLength:g,primitiveLength:v,vaos:{},sortKey:0}])}}function gN(f,c){return 256*(f=we(Math.floor(f),0,255))+we(Math.floor(c),0,255)}Aa.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qr(Aa,"SegmentVector");const pae=As([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),mae=As([{name:"a_pattern_b",components:4,type:"Uint16"}]),gae=As([{name:"a_dash",components:4,type:"Uint16"}]);class zv{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,u,g,v){this.ids.push(T5(c)),this.positions.push(u,g,v)}eachPosition(c,u){const g=T5(c);let v=0,k=this.ids.length-1;for(;v>1;this.ids[N]>=g?k=N:v=N+1}for(;this.ids[v]===g;)u(this.positions[3*v],this.positions[3*v+1],this.positions[3*v+2]),v++}static serialize(c,u){const g=new Float64Array(c.ids),v=new Uint32Array(c.positions);return A5(g,v,0,g.length-1),u&&(u.add(g.buffer),u.add(v.buffer)),{ids:g,positions:v}}static deserialize(c){const u=new zv;let g;u.ids=c.ids,u.positions=c.positions;for(const v of u.ids)v!==g&&u.uniqueIds.push(v),g=v;return u.indexed=!0,u}}function T5(f){const c=+f;return Number.isSafeInteger(c)?c:hk(String(f))}function A5(f,c,u,g){for(;u>1];let k=u-1,N=g+1;for(;;){do k++;while(f[k]v);if(k>=N)break;xN(f,k,N),xN(c,3*k,3*N),xN(c,3*k+1,3*N+1),xN(c,3*k+2,3*N+2)}N-u`u_${k}`),this.type=g,this.context=v}setUniform(c,u,g,v,k){const N=v.constantOr(this.value);u.set(c,k,N instanceof wi?N.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):N)}getBinding(c,u){return this.type==="color"?new $v(c):new $o(c)}}class Uy{constructor(c,u){this.uniformNames=u.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(c,u){this.pixelRatio=c.pixelRatio||1,this.pattern=c.tl.concat(c.br),this.patternTransition=u?u.tl.concat(u.br):this.pattern}setUniform(c,u,g,v,k){let N=null;k!=="u_pattern"&&k!=="u_dash"||(N=this.pattern),k==="u_pattern_b"&&(N=this.patternTransition),k==="u_pixel_ratio"&&(N=this.pixelRatio),N&&u.set(c,k,N)}getBinding(c,u){return u==="u_pattern"||u==="u_pattern_b"||u==="u_dash"?new vN(c):new $o(c)}}class Sp{constructor(c,u,g,v){this.expression=c,this.type=g,this.maxValue=0,this.paintVertexAttributes=u.map(k=>({name:`a_${k}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new v}populatePaintArray(c,u,g,v,k,N,I,R){const $=this.paintVertexArray.length,W=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Ji(0,{brightness:N,worldview:R}),u,{},k,v,I):this.expression.kind==="constant"&&this.expression.value,G=qv(this.lutExpression,u,{},v,k,N,I,R);this.paintVertexArray.resize(c),this._setPaintValue($,c,W,G?null:this.context.lut)}updatePaintArray(c,u,g,v,k,N,I,R){const $=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:I,worldview:R},g,v,void 0,k):this.expression.kind==="constant"&&this.expression.value,W=qv(this.lutExpression,g,v,k,void 0,I,void 0,R);this._setPaintValue(c,u,$,W?null:this.context.lut)}_setPaintValue(c,u,g,v){if(this.type==="color"){const k=E5(g.toPremultipliedRenderColor(v));for(let N=c;N`u_${I}_t`),this.type=g,this.useIntegerZoom=v,this.context=k,this.maxValue=0,this.paintVertexAttributes=u.map(I=>({name:`a_${I}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new N}populatePaintArray(c,u,g,v,k,N,I,R){const $=this.expression.evaluate(new Ji(this.context.zoom,{brightness:N,worldview:R}),u,{},k,v,I),W=this.expression.evaluate(new Ji(this.context.zoom+1,{brightness:N,worldview:R}),u,{},k,v,I),G=qv(this.lutExpression,u,{},v,k,N,I,R),X=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(X,c,$,W,G?null:this.context.lut)}updatePaintArray(c,u,g,v,k,N,I,R){const $=this.expression.evaluate({zoom:this.context.zoom,brightness:I,worldview:R},g,v,void 0,k),W=this.expression.evaluate({zoom:this.context.zoom+1,brightness:I,worldview:R},g,v,void 0,k),G=qv(this.lutExpression,g,v,k,void 0,I,void 0,R);this._setPaintValue(c,u,$,W,G?null:this.context.lut)}_setPaintValue(c,u,g,v,k){if(this.type==="color"){const N=E5(g.toPremultipliedRenderColor(k)),I=E5(g.toPremultipliedRenderColor(k));for(let R=c;R!0){this.binders={},this._buffers=[],this.context=u;const v=[];for(const k in c.paint._values){const N=c.paint.get(k);if(k.endsWith("-use-theme")||!g(k)||!(N instanceof Jg&&Av(N.property.specification)))continue;const I=_ae(k,c.type),R=N.value,$=N.property.specification.type,W=!!N.property.useIntegerZoom,G=k==="line-dasharray"||k.endsWith("pattern"),X=c.paint.get(`${k}-use-theme`),te=k==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||X&&X.value.kind!=="constant";if(R.kind!=="constant"||te)if(R.kind==="source"||te||G){const se=I5(k,$,"source");this.binders[k]=G?new Mp(R,I,$,se,c.id):new Sp(R,I,$,se),v.push(`/a_${k}`)}else{const se=I5(k,$,"composite");this.binders[k]=new Cp(R,I,$,W,u,se),v.push(`/z_${k}`)}else this.binders[k]=G?new Uy(R.value,I):new Vv(R.value,I,$,u),v.push(`/u_${k}`);X&&(this.binders[k].lutExpression=X.value)}this.cacheKey=v.sort().join("")}getMaxValue(c){const u=this.binders[c];return u instanceof Sp||u instanceof Cp?u.maxValue:0}populatePaintArrays(c,u,g,v,k,N,I,R){for(const $ in this.binders){const W=this.binders[$];W.context=this.context,(W instanceof Sp||W instanceof Cp||W instanceof Mp)&&W.populatePaintArray(c,u,g,v,k,N,I,R)}}setConstantPatternPositions(c,u){for(const g in this.binders){const v=this.binders[g];v instanceof Uy&&v.setConstantPatternPositions(c,u)}}getPatternTransitionVertexBuffer(c){const u=this.binders[c];return u instanceof Mp?u.paintTransitionVertexBuffer:null}updatePaintArrays(c,u,g,v,k,N,I,R,$,W){let G=!1;const X=Object.keys(c),te=X.length!==0&&!R,se=te?X:u.uniqueIds;this.context.lut=k.lut;for(const me in this.binders){const Se=this.binders[me];if(Se.context=this.context,(Se instanceof Sp||Se instanceof Cp||Se instanceof Mp)&&Se.expression&&Se.expression.kind&&Se.expression.kind!=="constant"&&(Se.expression.isStateDependent===!0||Se.expression.isLightConstant===!1)){const Ne=k.paint.get(me);Se.expression=Ne.value;for(const Oe of se){const Fe=c[Oe.toString()];u.eachPosition(Oe,(He,dt,it)=>{const gt=v.feature(He);Se.updatePaintArray(dt,it,gt,Fe,N,I,$,W)})}if(!te)for(const Oe of g.uniqueIds){const Fe=c[Oe.toString()];g.eachPosition(Oe,(He,dt,it)=>{const gt=v.feature(He);Se.updatePaintArray(dt,it,gt,Fe,N,I,$,W)})}G=!0}}return G}defines(){const c=[];for(const u in this.binders){const g=this.binders[u];(g instanceof Vv||g instanceof Uy)&&c.push(...g.uniformNames.map(v=>`#define HAS_UNIFORM_${v}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const u=[];for(const g in this.binders){const v=this.binders[g];if(v instanceof Vv||v instanceof Uy||v instanceof Cp)for(const k of v.uniformNames)u.push({name:k,property:g,binding:v.getBinding(c,k)})}return u}setUniforms(c,u,g,v,k){for(const{name:N,property:I,binding:R}of g)this.binders[I].setUniform(c,R,k,v.get(I),N)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const u=this.binders[c];(u instanceof Sp||u instanceof Cp||u instanceof Mp)&&u.paintVertexBuffer&&this._buffers.push(u.paintVertexBuffer),u instanceof Mp&&u.paintTransitionVertexBuffer&&this._buffers.push(u.paintTransitionVertexBuffer)}}upload(c){for(const u in this.binders){const g=this.binders[u];(g instanceof Sp||g instanceof Cp||g instanceof Mp)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const u=this.binders[c];(u instanceof Sp||u instanceof Cp||u instanceof Mp)&&u.destroy()}}}class Th{constructor(c,u,g=()=>!0){this.programConfigurations={};for(const v of c)this.programConfigurations[v.id]=new Wm(v,u,g);this.needsUpload=!1,this._featureMap=new zv,this._featureMapWithoutIds=new zv,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,u,g,v,k,N,I,R,$){for(const W in this.programConfigurations)this.programConfigurations[W].populatePaintArrays(c,u,v,k,N,I,R,$);u.id!==void 0?this._featureMap.add(u.id,g,this._bufferOffset,c):(this._featureMapWithoutIds.add(this._idlessCounter,g,this._bufferOffset,c),this._idlessCounter+=1),this._bufferOffset=c,this.needsUpload=!0}updatePaintArrays(c,u,g,v,k,N,I,R){for(const $ of g)this.needsUpload=this.programConfigurations[$.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,u,$,v,k,N,I||0,R)||this.needsUpload}get(c){return this.programConfigurations[c]}upload(c){if(this.needsUpload){for(const u in this.programConfigurations)this.programConfigurations[u].upload(c);this.needsUpload=!1}}destroy(){for(const c in this.programConfigurations)this.programConfigurations[c].destroy()}}const vae={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function _ae(f,c){return vae[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const bae={"line-pattern":{source:bd,composite:bd},"fill-pattern":{source:bd,composite:bd},"fill-extrusion-pattern":{source:bd,composite:bd},"line-dasharray":{source:sx,composite:sx}},wae={color:{source:vf,composite:Vm},number:{source:kp,composite:vf}};function I5(f,c,u){const g=bae[f];return g&&g[u]||wae[c][u]}Qr(Vv,"ConstantBinder"),Qr(Uy,"PatternConstantBinder"),Qr(Sp,"SourceExpressionBinder"),Qr(Mp,"PatternCompositeBinder"),Qr(Cp,"CompositeExpressionBinder"),Qr(Wm,"ProgramConfiguration",{omit:["_buffers"]}),Qr(Th,"ProgramConfigurationSet");const mc=Mr/Math.PI/2,Xu=5,wN=6,jae=16383,qy=64,P5=[qy,32,16],Qu=-mc,Ju=mc;function ax(f,c,u,g=mc){return u=ss(u),[f*Math.sin(u)*g,-c*g,f*Math.cos(u)*g]}function Vy(f,c,u){return ax(Math.cos(ss(f)),Math.sin(ss(f)),c,u)}const _=63710088e-1,d=2*Math.PI*_;class m{constructor(c,u){if(isNaN(c)||isNaN(u))throw new Error(`Invalid LngLat object: (${c}, ${u})`);if(this.lng=+c,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new m(Ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const u=Math.PI/180,g=this.lat*u,v=c.lat*u,k=Math.sin(g)*Math.sin(v)+Math.cos(g)*Math.cos(v)*Math.cos((c.lng-this.lng)*u);return _*Math.acos(Math.min(k,1))}toBounds(c=0){const u=360*c/40075017,g=u/Math.cos(Math.PI/180*this.lat);return new b({lng:this.lng-g,lat:this.lat-u},{lng:this.lng+g,lat:this.lat+u})}toEcef(c){return Vy(this.lat,this.lng,mc+c*mc/_)}static convert(c){if(c instanceof m)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new m(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new m(Number("lng"in c?c.lng:c.lon),Number(c.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class b{constructor(c,u){c&&(u?this.setSouthWest(c).setNorthEast(u):Array.isArray(c)&&c.length===4?this.setSouthWest([c[0],c[1]]).setNorthEast([c[2],c[3]]):this.setSouthWest(c[0]).setNorthEast(c[1]))}setNorthEast(c){return this._ne=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}setSouthWest(c){return this._sw=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}extend(c){const u=this._sw,g=this._ne;let v,k;if(c instanceof m)v=c,k=c;else{if(!(c instanceof b))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(b.convert(c)):this.extend(m.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(m.convert(c)):this;if(v=c._sw,k=c._ne,!v||!k)return this}return u||g?(u.lng=Math.min(v.lng,u.lng),u.lat=Math.min(v.lat,u.lat),g.lng=Math.max(k.lng,g.lng),g.lat=Math.max(k.lat,g.lat)):(this._sw=new m(v.lng,v.lat),this._ne=new m(k.lng,k.lat)),this}getCenter(){return new m((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new m(this.getWest(),this.getNorth())}getSouthEast(){return new m(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(c){const{lng:u,lat:g}=m.convert(c);let v=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(v=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&v}static convert(c){if(c)return c instanceof b?c:new b(c)}}const M=0,L=25.5;function D(f){return d*Math.cos(f*Math.PI/180)}function B(f){return(180+f)/360}function V(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function Y(f,c){return f/D(c)}function Q(f){return 360*f-180}function le(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function oe(f,c){return f*D(le(c))}const ce=85.051129;function je(f){return Math.cos(ss(we(f,-ce,ce)))}function ve(f,c){const u=we(c,M,L),g=Math.pow(2,u);return je(f)*d/(512*g)}function Le(f){return 1/Math.cos(f*Math.PI/180)}function Pe(f,c=0){const u=Math.exp(Math.PI*(1-(f.y+c/Mr)/(1<=R?(Ze(f,c,u,$,W,k,G,I,R),Ze(f,$,W,g,v,G,N,I,R)):f.push(N)}function qe(f,c,u){let g=f[0],v=g.x,k=g.y;c(g);const N=[g];for(let I=1;If.x+1||gf.y+1)&&Vr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function bt(f,c,u){const g=f.loadGeometry(),v=f.extent,k=Mr/v;if(c&&u&&u.projection.isReprojectedInTileSpace){const N=1<{const te=Q((c.x+X.x/v)/N),se=le((c.y+X.y/v)/N),me=W.project(te,se);X.x=(me.x*I-R)*v,X.y=(me.y*I-$)*v};for(let X=0;X=v||se.y<0||se.y>=v||(G(se),te.push(se));g[X]=te}}for(const N of g)for(const I of N)st(I,k);return g}function Ot(f,c){return{type:f.type,id:f.id,properties:f.properties,geometry:c?bt(f):[]}}class Pt{constructor(c,u,g,v,k){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=c,this._geometry=-1,this._keys=v,this._values=k,c.readFields(Vt,this,u)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos,g=[];let v,k=1,N=0,I=0,R=0;for(;c.pos>3}if(N--,k===1||k===2)I+=c.readSVarint(),R+=c.readSVarint(),k===1&&(v&&g.push(v),v=[]),v&&v.push(new ir(I,R));else{if(k!==7)throw new Error(`unknown command ${k}`);v&&v.push(v[0].clone())}}return v&&g.push(v),g}bbox(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos;let g=1,v=0,k=0,N=0,I=1/0,R=-1/0,$=1/0,W=-1/0;for(;c.pos>3}if(v--,g===1||g===2)k+=c.readSVarint(),N+=c.readSVarint(),kR&&(R=k),N<$&&($=N),N>W&&(W=N);else if(g!==7)throw new Error(`unknown command ${g}`)}return[I,$,R,W]}toGeoJSON(c,u,g){const v=this.extent*Math.pow(2,g),k=this.extent*c,N=this.extent*u,I=this.loadGeometry();function R(X){return[360*(X.x+k)/v-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+N)/v)*Math.PI))-90]}function $(X){return X.map(R)}let W;if(this.type===1){const X=[];for(const se of I)X.push(se[0]);const te=$(X);W=X.length===1?{type:"Point",coordinates:te[0]}:{type:"MultiPoint",coordinates:te}}else if(this.type===2){const X=I.map($);W=X.length===1?{type:"LineString",coordinates:X[0]}:{type:"MultiLineString",coordinates:X}}else{if(this.type!==3)throw new Error("unknown feature type");{const X=function(se){const me=se.length;if(me<=1)return[se];const Se=[];let Ne,Oe;for(let Fe=0;Fe=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];const u=this._pbf.readVarint()+this._pbf.pos;return new Pt(this._pbf,u,this.extent,this._keys,this._values)}}function br(f,c,u){f===15?c.version=u.readVarint():f===1?c.name=u.readString():f===5?c.extent=u.readVarint():f===2?c._features.push(u.pos):f===3?c._keys.push(u.readString()):f===4&&c._values.push(function(g){let v=null;const k=g.readVarint()+g.pos;for(;g.pos>3;v=N===1?g.readString():N===2?g.readFloat():N===3?g.readDouble():N===4?g.readVarint64():N===5?g.readVarint():N===6?g.readSVarint():N===7?g.readBoolean():null}if(v==null)throw new Error("unknown feature value");return v}(u))}class zt{constructor(c,u){this.layers=c.readFields(Mt,{},u)}}function Mt(f,c,u){if(f===3){const g=new sr(u,u.readVarint()+u.pos);g.length&&(c[g.name]=g)}}const Yt="3d_elevation_id",qt="level";class ur{constructor(){this._valid=!1}reset(c){return this.feature=c,this._valid=!0,this._geometry=c.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(c,u){return this._valid&&c(u(this._geometry)),this}require(c,u,g){return this.get(c,!0,u,g)}optional(c,u,g){return this.get(c,!1,u,g)}success(){return this._valid}get(c,u,g,v){const k=this.feature.properties.hasOwnProperty(c)?+this.feature.properties[c]:void 0;return this._valid&&k!==void 0&&!Number.isNaN(k)?g(v?v(k):k):u&&(this._valid=!1),this}}class Er{constructor(c,u){this.featureFunc=c,this.vertexFunc=u}parseFeature(c,u,g){return this.featureFunc(c,u,g)}parseVertex(c,u,g){return this.vertexFunc(c,u,g)}}const Gr=new Er((f,c,u)=>f.reset(c).require(Yt,g=>{u.id=g}).optional("fixed_height_relative",g=>{u.constantHeight=g},wr.decodeRelativeHeight).geometry(g=>{u.bounds=g},yp).success(),(f,c,u)=>f.reset(c).require(Yt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height_relative",g=>{u.height=g},wr.decodeRelativeHeight).geometry(g=>{u.position=g},wr.getPoint).success()),Sr=new Er((f,c,u)=>f.reset(c).require(Yt,g=>{u.id=g}).optional("fixed_height",g=>{u.constantHeight=g},wr.decodeMetricHeight).geometry(g=>{u.bounds=g},yp).success(),(f,c,u)=>f.reset(c).require(Yt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height",g=>{u.height=g},wr.decodeMetricHeight).geometry(g=>{u.position=g},wr.getPoint).success());class wr{static getPoint(c){return fr(c[0][0].x,c[0][0].y)}static decodeRelativeHeight(c){return 1e-4*c*5}static decodeMetricHeight(c){return 1e-4*c}static getVersionSchema(c){return c?c==="1.0.1"?Sr:void 0:Gr}static parse(c){const u=[],g=[],v=c.length,k=new ur;for(let N=0;N=0);if(k===0)return 0;k!==c.length&&(u=!1)}return u?2:1}function Yn(f,c){for(const u of f.projections){const g=Kr(c,f.points[0],u.axis);if(u.projection[1]g[1])return 0}return 1}function Os(f,c){let u=0;const g=[0,0,0,0];for(let N=0;N=0&&u++;var v,k;return u}class ui{constructor(c,u){this.points=c||new Array(8).fill([0,0,0]),this.planes=u||new Array(6).fill([0,0,0,0]),this.bounds=dn.fromPoints(this.points),this.projections=[],this.frustumEdges=[Ae([],this.points[2],this.points[3]),Ae([],this.points[0],this.points[3]),Ae([],this.points[4],this.points[0]),Ae([],this.points[5],this.points[1]),Ae([],this.points[6],this.points[2]),Ae([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const v=[0,-g[2],g[1]],k=[g[2],0,-g[0]];this.projections.push({axis:v,projection:Kr(this.points,this.points[0],v)}),this.projections.push({axis:k,projection:Kr(this.points,this.points[0],k)})}}static fromInvProjectionMatrix(c,u,g,v){const k=Math.pow(2,g),N=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map($=>{const W=wt([],$,c),G=1/W[3]/u*k;return(X=W)[0]=(te=W)[0]*(se=[G,G,v?1/W[3]:G,G])[0],X[1]=te[1]*se[1],X[2]=te[2]*se[2],X[3]=te[3]*se[3],X;var X,te,se}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map($=>{const W=Re([],Je([],Ae([],N[$[0]],N[$[1]]),Ae([],N[$[2]],N[$[1]]))),G=-Ce(W,N[$[1]]);return W.concat(G)}),R=[];for(let $=0;$$[1]||$[0]>R[1])return 0}return 1}containsPoint(c){for(const u of this.planes){const g=u[3];if(Ce([u[0],u[1],u[2]],c)+g<0)return!1}return!0}}class dn{static fromPoints(c){const u=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const v of c)ke(u,u,v),pe(g,g,v);return new dn(u,g)}static fromTileIdAndHeight(c,u,g){const v=1<c.max[u]||c.min[u]>this.max[u])return!1;return!0}intersectsAabbXY(c){return!(this.min[0]>c.max[0]||c.min[0]>this.max[0]||this.min[1]>c.max[1]||c.min[1]>this.max[1])}encapsulate(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c.min[u]),this.max[u]=Math.max(this.max[u],c.max[u])}encapsulatePoint(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c[u]),this.max[u]=Math.max(this.max[u],c[u])}closestPoint(c){return[Math.max(Math.min(this.max[0],c[0]),this.min[0]),Math.max(Math.min(this.max[1],c[1]),this.min[1]),Math.max(Math.min(this.max[2],c[2]),this.min[2])]}}Qr(dn,"Aabb");class ii{constructor(c,u){this.feature=c,this.metersToTile=u,this.index=0}get(){const c=this.feature.vertices[this.index],u=this.feature.vertexProps[this.index].dir,g=u[1],v=-u[0],k=(c.extent+1)*this.metersToTile;return[new ir(Math.trunc(c.position[0]+g*k),Math.trunc(c.position[1]+v*k)),new ir(Math.trunc(c.position[0]-g*k),Math.trunc(c.position[1]-v*k))]}next(){this.index++}valid(){return this.index{return I.a0?ae(R,R,1/$):fe(R,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let u=0,g=Number.POSITIVE_INFINITY,v=0;const[k,N,I,R,$,W,G]=this._tmpVec2;xs(G,c.x,c.y);const X=new on(G,null);for(let te=0;te0?rl(R,I)/He:0,it=we(dt,0,1),gt=Math.abs((dt-it)*this.edgeProps[te].len);mi($,G,Se),xs(W,me[1],-me[0]);const Nt=gt+Math.abs(rl($,W));Nt=0;--N){const I=this.edges[N].a,R=this.edges[N].b,{position:$,height:W,extent:G}=this.vertices[I],{position:X,height:te,extent:se}=this.vertices[R],me=this.vertexProps[I].dir,Se=this.vertexProps[R].dir;if(fe(u,$[0]/c,$[1]/c,W),fe(g,X[0]/c,X[1]/c,te),fe(v,me[1],-me[0],0),ae(v,v,G),fe(k,Se[1],-Se[0],0),ae(k,k,se),this.distSqLines(ie(u[0]+.5*v[0],u[1]+.5*v[1],u[2]+.5*v[2]),ie(g[0]-.5*k[0],g[1]-.5*k[1],g[2]-.5*k[2]),ie(u[0]-.5*v[0],u[1]-.5*v[1],u[2]-.5*v[2]),ie(g[0]+.5*k[0],g[1]+.5*k[1],g[2]+.5*k[2]))<=.0025000000000000005)continue;const Ne=this.vertices.length,Oe=bi(js(),$,X);this.vertices.push({position:La(Oe,Oe,.5),height:.5*(W+te),extent:.5*(G+se)});const Fe=bi(js(),me,Se);this.vertexProps.push({dir:tl(Fe,Fe)}),this.edges.splice(N,1),this.edgeProps.splice(N,1),this.edges.push({a:I,b:Ne}),this.edges.push({a:Ne,b:R});const He=mi(js(),this.vertices[Ne].position,$),dt=da(He),it={vec:He,dir:La(js(),He,1/dt),len:dt};this.edgeProps.push(it),this.edgeProps.push(it)}}distSqLines(c,u,g,v){const k=_e(be(),u,c),N=_e(be(),v,g),I=_e(be(),c,g),R=Ce(k,k),$=Ce(k,N),W=Ce(k,I),G=Ce(N,N),X=Ce(N,I),te=R*G-$*$;if(te===0)return Ue(Te(k,g,v,Ce(I,N)/Ce(N,N)),c);const se=(R*X-$*W)/te;return Ue(Te(k,c,u,($*X-W*G)/te),Te(N,g,v,se))}}class gi{static parseFrom(c,u){const g=wr.parse(c);if(!g)return[];let{vertices:v,features:k}=g;const N=1/Pe(u);k.sort((W,G)=>W.id-G.id),v.sort((W,G)=>W.id-G.id||W.idx-G.idx),v=v.filter((W,G,X)=>G===X.findIndex(te=>te.id===W.id&&te.idx===W.idx));const I=new Array;let R=0;const $=v.length;for(const W of k){if(W.constantHeight){I.push(new Hn(W.id,W.bounds,W.constantHeight));continue}for(;R!==$&&v[R].idv.id===g)}}class Li{constructor(c,u){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(u)||(this.zScale=Math.pow(2,u.z-c.z),this.xOffset=(c.x*this.zScale-u.x)*Mr,this.yOffset=(c.y*this.zScale-u.y)*Mr)}constantElevation(c,u){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,u)}pointElevation(c,u,g){const v=this.constantElevation(u,g);return v??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(u.pointElevation(c),g))}computeBiasedHeight(c,u){return u<=0?c:c+u*De(0,u,c>=0?c:Math.abs(.5*c))}}Qr(Hn,"ElevationFeature");class ji{constructor(c){this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.projection=c.projection,this.layoutVertexArray=new qm,this.indexArray=new Bo,this.segments=new Aa,this.programConfigurations=new Th(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new kp),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=this.layers[0],N=[];let I=null;k.type==="circle"&&(I=k.layout.get("circle-sort-key"));for(const{feature:$,id:W,index:G,sourceLayerIndex:X}of c){const te=this.layers[0]._featureFilter.needGeometry,se=Ot($,te);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),se,g))continue;const me=I?I.evaluate(se,{},g):void 0,Se={id:W,properties:$.properties,type:$.type,sourceLayerIndex:X,index:G,geometry:te?se.geometry:bt($,g,v),patterns:{},sortKey:me};N.push(Se)}I&&N.sort(($,W)=>$.sortKey-W.sortKey);let R=null;v.projection.name==="globe"&&(this.globeExtVertexArray=new iN,R=v.projection);for(const $ of N){const{geometry:W,index:G,sourceLayerIndex:X}=$,te=c[G].feature;this.addFeature($,W,G,u.availableImages,g,R,u.brightness,u.elevationFeatures),u.featureIndex.insert(te,W,G,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,u,g,v,k,N,I){this.programConfigurations.updatePaintArrays(c,u,k,g,v,N,I,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,UP.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,qP.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,fae.members))),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(c,u,g,v,k,N,I,R){let $;this.elevationMode!=="none"&&($=gi.getElevationFeature(c,R));for(const W of u)for(const G of W){const X=G.x,te=G.y;if(X<0||X>=Mr||te<0||te>=Mr)continue;if(N){const Se=N.projectTilePoint(X,te,k),Ne=N.upVector(k,X,te);this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne)}const se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),me=se.vertexLength;if(this.addCircleVertex(X,te,-1,-1),this.addCircleVertex(X,te,1,-1),this.addCircleVertex(X,te,1,1),this.addCircleVertex(X,te,-1,1),this.elevationMode!=="none"){const Se=$?$.pointElevation(new ir(X,te)):0;this.hasElevation=this.hasElevation||Se!==0;for(let Ne=0;Ne<4;Ne++)this.elevatedLayoutVertexArray.emplaceBack(Se)}this.indexArray.emplaceBack(me,me+1,me+2),this.indexArray.emplaceBack(me,me+2,me+3),se.vertexLength+=4,se.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,{},v,k,I,void 0,this.worldview)}addCircleVertex(c,u,g,v){this.layoutVertexArray.emplaceBack(2*c+(g+1)/2,2*u+(v+1)/2)}addGlobeExtVertex(c,u){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}}function ni(f,c){for(let u=0;u1){if(xa(f,c))return!0;for(let g=0;g1?u:u.sub(c)._mult(v)._add(c))}function Ea(f,c){let u,g,v,k=!1;for(let N=0;Nc.y!=v.y>c.y&&c.x<(v.x-g.x)*(c.y-g.y)/(v.y-g.y)+g.x&&(k=!k)}return k}function qi(f,c){let u=!1;for(let g=0,v=f.length-1;gc.y!=N.y>c.y&&c.x<(N.x-k.x)*(c.y-k.y)/(N.y-k.y)+k.x&&(u=!u)}return u}function rd(f,c,u,g,v){for(const N of f)if(c<=N.x&&u<=N.y&&g>=N.x&&v>=N.y)return!0;const k=[new ir(c,u),new ir(c,v),new ir(g,v),new ir(g,u)];if(f.length>2){for(const N of k)if(qi(f,N))return!0}for(let N=0;Nv.x&&c.x>v.x||f.yv.y&&c.y>v.y)return!1;const k=ts(f,c,u[0]);return k!==ts(f,c,u[1])||k!==ts(f,c,u[2])||k!==ts(f,c,u[3])}function Uo(f,c,u,g,v,k){let N=c.y-f.y,I=f.x-c.x;if(k=k||0){const R=N*N+I*I;if(R===0)return!0;const $=Math.sqrt(R);N/=$,I/=$}return!((u.x-f.x)*N+(u.y-f.y)*I-k<0||(g.x-f.x)*N+(g.y-f.y)*I-k<0||(v.x-f.x)*N+(v.y-f.y)*I-k<0)}function gc(f,c,u,g,v,k,N){return!(Uo(f,c,g,v,k,N)||Uo(c,u,g,v,k,N)||Uo(u,f,g,v,k,N)||Uo(g,v,f,c,u,N)||Uo(v,k,f,c,u,N)||Uo(k,g,f,c,u,N))}function xc(f,c,u){const g=c.paint.get(f).value;return g.kind==="constant"?g.value:u.programConfigurations.get(c.id).getMaxValue(f)}function Fl(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function uu(f,c,u,g,v){if(!c[0]&&!c[1])return f;const k=ir.convert(c)._mult(v);u==="viewport"&&k._rotate(-g);const N=[];for(let I=0;I>u&&c.y===this.y>>u}url(c,u){const g=function(k,N,I){var R=ao(256*k,256*(N=Math.pow(2,I)-N-1),I),$=ao(256*(k+1),256*(N+1),I);return R[0]+","+R[1]+","+$[0]+","+$[1]}(this.x,this.y,this.z),v=function(k,N,I){let R,$="";for(let W=k;W>0;W--)R=1<this.canonical.z?new Ra(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ra(c,this.wrap,c,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(c,u=!0){if(this.overscaledZ===c&&u)return this.key;if(c>this.canonical.z)return Ia(this.wrap*+u,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Ia(this.wrap*+u,c,c,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(c){if(c.wrap!==this.wrap)return!1;const u=this.canonical.z-c.canonical.z;return c.overscaledZ===0||c.overscaledZ>u&&c.canonical.y===this.canonical.y>>u}children(c){if(this.overscaledZ>=c)return[new Ra(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const u=this.canonical.z+1,g=2*this.canonical.x,v=2*this.canonical.y;return[new Ra(u,this.wrap,u,g,v),new Ra(u,this.wrap,u,g+1,v),new Ra(u,this.wrap,u,g,v+1),new Ra(u,this.wrap,u,g+1,v+1)]}isLessThan(c){return this.wrapc.wrap)&&(this.overscaledZc.overscaledZ)&&(this.canonical.xc.canonical.x)&&this.canonical.y{let c=f.canonical.x-1,u=f.wrap;return c<0&&(c=(1<{let c=f.canonical.x+1,u=f.wrap;return c===1<new Ra(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Ra(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,v,k,N){const I=Math.sin(k);return g*(Math.sin((1-N)*k)/I)+v*(Math.sin(N*k)/I)}(f.a[c],f.b[c],f.angle,we(u,0,1))+f.center[c]}function Eh(f){if(f.z<=1)return Tp[f.z+2*f.y+f.x];const c=kae(VP(f));return dn.fromPoints(c)}function Ep(f,c,u){return ae(f,f,1-u),ge(f,f,c,u)}function R0e(f,c,u){for(const g of f)Ye(g,g,c),ae(g,g,u)}function F0e(f,c,u,g){const v=c/f.worldSize,k=f.globeMatrix;if(u.z<=1){const Tt=Eh(u).getCorners();return R0e(Tt,k,v),dn.fromPoints(Tt)}const N=VP(u,g),I=kae(N,mc+bf(f._tileCoverLift));R0e(I,k,v);const R=Number.MAX_VALUE,$=[-R,-R,-R],W=[R,R,R];if(N.contains(f.center)){for(const Dt of I)ke(W,W,Dt),pe($,$,Dt);$[2]=0;const Tt=f.point,Gt=[Tt.x*v,Tt.y*v,0];return ke(W,W,Gt),pe($,$,Gt),new dn(W,$)}if(f._tileCoverLift>0){for(const Tt of I)ke(W,W,Tt),pe($,$,Tt);return new dn(W,$)}const G=[k[12]*v,k[13]*v,k[14]*v],X=N.getCenter(),te=we(f.center.lat,-ce,ce),se=we(X.lat,-ce,ce),me=B(f.center.lng),Se=V(te);let Ne=me-B(X.lng);const Oe=Se-V(se);Ne>.5?Ne-=1:Ne<-.5&&(Ne+=1);let Fe=0;Math.abs(Ne)>Math.abs(Oe)?Fe=Ne>=0?1:3:(Fe=Oe>=0?0:2,ge(G,G,[k[4]*v,k[5]*v,k[6]*v],-Math.sin(ss(Oe>=0?N.getSouth():N.getNorth()))*mc));const He=I[Fe],dt=I[(Fe+1)%4],it=new Gm(He,dt,G),gt=[Ap(it,0)||He[0],Ap(it,1)||He[1],Ap(it,2)||He[2]],Nt=Gy(f.zoom);if(Nt>0){const Tt=function({x:Dt,y:tr,z:or},lr,xr,vr,hr){const pr=1/(1<.5?jr=-1:hn<-.5&&(jr=1),er=((er+jr)*lr-(vr*=lr))*xr+vr,Zt=((Zt+jr)*lr-vr)*xr+vr,mr=(mr*lr-(hr*=lr))*xr+hr,Tr=(Tr*lr-hr)*xr+hr,[[er,Tr,0],[Zt,Tr,0],[Zt,mr,0],[er,mr,0]]}(u,c,f._pixelsPerMercatorPixel,me,Se);for(let Dt=0;DtMath.PI/2*1.01}const q0e=ss(85),mUe=Math.cos(q0e),gUe=Math.sin(q0e),xUe=S(),V0e=f=>{const c=[];return f.paint.get("circle-pitch-alignment")==="map"&&c.push("PITCH_WITH_MAP"),f.paint.get("circle-pitch-scale")==="map"&&c.push("SCALE_WITH_MAP"),c};function H0e(f,c,u,g,v,k,N,I,R){if(k&&f.queryGeometry.isAboveHorizon)return!1;k&&(R*=f.pixelToTileUnitsFactor);const $=f.tileID.canonical,W=u.projection.upVectorScale($,u.center.lat,u.worldSize).metersToTile;for(const G of c)for(const X of G){const te=X.add(I),se=v&&u.elevation?u.elevation.exaggeration()*v.getElevationAt(te.x,te.y,!0):0,me=u.projection.projectTilePoint(te.x,te.y,$);if(se>0){const Fe=u.projection.upVector($,te.x,te.y);me.x+=Fe[0]*W*se,me.y+=Fe[1]*W*se,me.z+=Fe[2]*W*se}const Se=k?te:yUe(me.x,me.y,me.z,g),Ne=k?f.tilespaceRays.map(Fe=>_Ue(Fe,se)):f.queryGeometry.screenGeometry,Oe=wt([],[me.x,me.y,me.z,1],g);if(!N&&k?R*=Oe[3]/u.cameraToCenterDistance:N&&!k&&(R*=u.cameraToCenterDistance/Oe[3]),k){const Fe=le((X.y/Mr+$.y)/(1<<$.z));R/=u.projection.pixelsPerMeter(Fe,1)/Y(1,Fe)}if(as(Ne,Se,R))return!0}return!1}function yUe(f,c,u,g){const v=wt([],[f,c,u,1],g);return new ir(v[0]/v[3],v[1]/v[3])}const W0e=ie(0,0,0),vUe=ie(0,0,1);function _Ue(f,c){const u=be();return W0e[2]=c,f.intersectsPlane(W0e,vUe,u),new ir(u[0],u[1])}class G0e extends ji{}let K0e,Z0e,Y0e,X0e;function Q0e(f,{width:c,height:u},g,v){if(v){if(v instanceof Uint8ClampedArray)v=new Uint8Array(v.buffer);else if(v.length!==c*u*g)throw new RangeError("mismatched image size")}else v=new Uint8Array(c*u*g);return f.width=c,f.height=u,f.data=v,f}function J0e(f,c,u){const{width:g,height:v}=c;g===f.width&&v===f.height||(Mae(f,c,{x:0,y:0},{x:0,y:0},{width:Math.min(f.width,g),height:Math.min(f.height,v)},u,null),f.width=g,f.height=v,f.data=c.data)}function Mae(f,c,u,g,v,k,N,I){if(v.width===0||v.height===0)return c;if(v.width>f.width||v.height>f.height||u.x>f.width-v.width||u.y>f.height-v.height)throw new RangeError("out of range source coordinates for image copy");if(v.width>c.width||v.height>c.height||g.x>c.width-v.width||g.y>c.height-v.height)throw new RangeError("out of range destination coordinates for image copy");const R=f.data,$=c.data,W=k===4&&I;for(let G=0;G{c[f.evaluationKey]=R;const $=f.expression.evaluate(c),W=$?$.toNonPremultipliedRenderColor(null):null;W&&(v.data[N+I+0]=Math.floor(255*W.r),v.data[N+I+1]=Math.floor(255*W.g),v.data[N+I+2]=Math.floor(255*W.b),v.data[N+I+3]=Math.floor(255*W.a))};if(f.clips)for(let N=0,I=0;N80*u){I=f[0],R=f[1];let W=I,G=R;for(let X=u;XW&&(W=te),se>G&&(G=se)}$=Math.max(W-I,G-R),$=$!==0?32767/$:0}return D5(k,N,u,I,R,$,0),N}function t1e(f,c,u,g,v){let k;if(v===function(N,I,R,$){let W=0;for(let G=I,X=R-$;G0)for(let N=c;N=c;N-=g)k=i1e(N/g|0,f[N],f[N+1],k);return k&&kN(k,k.next)&&(z5(k),k=k.next),k}function Gv(f,c){if(!f)return f;c||(c=f);let u,g=f;do if(u=!1,g.steiner||!kN(g,g.next)&&Cl(g.prev,g,g.next)!==0)g=g.next;else{if(z5(g),g=c=g.prev,g===g.next)break;u=!0}while(u||g!==c);return c}function D5(f,c,u,g,v,k,N){if(!f)return;!N&&k&&function(R,$,W,G){let X=R;do X.z===0&&(X.z=Tae(X.x,X.y,$,W,G)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==R);X.prevZ.nextZ=null,X.prevZ=null,function(te){let se,me=1;do{let Se,Ne=te;te=null;let Oe=null;for(se=0;Ne;){se++;let Fe=Ne,He=0;for(let it=0;it0||dt>0&&Fe;)He!==0&&(dt===0||!Fe||Ne.z<=Fe.z)?(Se=Ne,Ne=Ne.nextZ,He--):(Se=Fe,Fe=Fe.nextZ,dt--),Oe?Oe.nextZ=Se:te=Se,Se.prevZ=Oe,Oe=Se;Ne=Fe}Oe.nextZ=null,me*=2}while(se>1)}(X)}(f,g,v,k);let I=f;for(;f.prev!==f.next;){const R=f.prev,$=f.next;if(k?SUe(f,g,v,k):NUe(f))c.push(R.i,f.i,$.i),z5(f),f=$.next,I=$.next;else if((f=$)===I){N?N===1?D5(f=CUe(Gv(f),c),c,u,g,v,k,2):N===2&&MUe(f,c,u,g,v,k):D5(Gv(f),c,u,g,v,k,1);break}}}function NUe(f){const c=f.prev,u=f,g=f.next;if(Cl(c,u,g)>=0)return!1;const v=c.x,k=u.x,N=g.x,I=c.y,R=u.y,$=g.y,W=Math.min(v,k,N),G=Math.min(I,R,$),X=Math.max(v,k,N),te=Math.max(I,R,$);let se=g.next;for(;se!==c;){if(se.x>=W&&se.x<=X&&se.y>=G&&se.y<=te&&R5(v,I,k,R,N,$,se.x,se.y)&&Cl(se.prev,se,se.next)>=0)return!1;se=se.next}return!0}function SUe(f,c,u,g){const v=f.prev,k=f,N=f.next;if(Cl(v,k,N)>=0)return!1;const I=v.x,R=k.x,$=N.x,W=v.y,G=k.y,X=N.y,te=Math.min(I,R,$),se=Math.min(W,G,X),me=Math.max(I,R,$),Se=Math.max(W,G,X),Ne=Tae(te,se,c,u,g),Oe=Tae(me,Se,c,u,g);let Fe=f.prevZ,He=f.nextZ;for(;Fe&&Fe.z>=Ne&&He&&He.z<=Oe;){if(Fe.x>=te&&Fe.x<=me&&Fe.y>=se&&Fe.y<=Se&&Fe!==v&&Fe!==N&&R5(I,W,R,G,$,X,Fe.x,Fe.y)&&Cl(Fe.prev,Fe,Fe.next)>=0||(Fe=Fe.prevZ,He.x>=te&&He.x<=me&&He.y>=se&&He.y<=Se&&He!==v&&He!==N&&R5(I,W,R,G,$,X,He.x,He.y)&&Cl(He.prev,He,He.next)>=0))return!1;He=He.nextZ}for(;Fe&&Fe.z>=Ne;){if(Fe.x>=te&&Fe.x<=me&&Fe.y>=se&&Fe.y<=Se&&Fe!==v&&Fe!==N&&R5(I,W,R,G,$,X,Fe.x,Fe.y)&&Cl(Fe.prev,Fe,Fe.next)>=0)return!1;Fe=Fe.prevZ}for(;He&&He.z<=Oe;){if(He.x>=te&&He.x<=me&&He.y>=se&&He.y<=Se&&He!==v&&He!==N&&R5(I,W,R,G,$,X,He.x,He.y)&&Cl(He.prev,He,He.next)>=0)return!1;He=He.nextZ}return!0}function CUe(f,c){let u=f;do{const g=u.prev,v=u.next.next;!kN(g,v)&&n1e(g,u,u.next,v)&&F5(g,v)&&F5(v,g)&&(c.push(g.i,u.i,v.i),z5(u),z5(u.next),u=f=v),u=u.next}while(u!==f);return Gv(u)}function MUe(f,c,u,g,v,k){let N=f;do{let I=N.next.next;for(;I!==N.prev;){if(N.i!==I.i&&PUe(N,I)){let R=s1e(N,I);return N=Gv(N,N.next),R=Gv(R,R.next),D5(N,c,u,g,v,k,0),void D5(R,c,u,g,v,k,0)}I=I.next}N=N.next}while(N!==f)}function TUe(f,c){let u=f.x-c.x;return u===0&&(u=f.y-c.y,u===0)&&(u=(f.next.y-f.y)/(f.next.x-f.x)-(c.next.y-c.y)/(c.next.x-c.x)),u}function AUe(f,c){const u=function(v,k){let N=k;const I=v.x,R=v.y;let $,W=-1/0;if(kN(v,N))return N;do{if(kN(v,N.next))return N.next;if(R<=N.y&&R>=N.next.y&&N.next.y!==N.y){const me=N.x+(R-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(me<=I&&me>W&&(W=me,$=N.x=N.x&&N.x>=X&&I!==N.x&&r1e(R$.x||N.x===$.x&&EUe($,N)))&&($=N,se=me)}N=N.next}while(N!==G);return $}(f,c);if(!u)return c;const g=s1e(u,f);return Gv(g,g.next),Gv(u,u.next)}function EUe(f,c){return Cl(f.prev,f,c.prev)<0&&Cl(c.next,f,f.next)<0}function Tae(f,c,u,g,v){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-u)*v|0)|f<<8))|f<<4))|f<<2))|f<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-g)*v|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function IUe(f){let c=f,u=f;do(c.x=(f-N)*(k-I)&&(f-N)*(g-I)>=(u-N)*(c-I)&&(u-N)*(k-I)>=(v-N)*(g-I)}function R5(f,c,u,g,v,k,N,I){return!(f===N&&c===I)&&r1e(f,c,u,g,v,k,N,I)}function PUe(f,c){return f.next.i!==c.i&&f.prev.i!==c.i&&!function(u,g){let v=u;do{if(v.i!==u.i&&v.next.i!==u.i&&v.i!==g.i&&v.next.i!==g.i&&n1e(v,v.next,u,g))return!0;v=v.next}while(v!==u);return!1}(f,c)&&(F5(f,c)&&F5(c,f)&&function(u,g){let v=u,k=!1;const N=(u.x+g.x)/2,I=(u.y+g.y)/2;do v.y>I!=v.next.y>I&&v.next.y!==v.y&&N<(v.next.x-v.x)*(I-v.y)/(v.next.y-v.y)+v.x&&(k=!k),v=v.next;while(v!==u);return k}(f,c)&&(Cl(f.prev,f,c.prev)||Cl(f,c.prev,c))||kN(f,c)&&Cl(f.prev,f,f.next)>0&&Cl(c.prev,c,c.next)>0)}function Cl(f,c,u){return(c.y-f.y)*(u.x-c.x)-(c.x-f.x)*(u.y-c.y)}function kN(f,c){return f.x===c.x&&f.y===c.y}function n1e(f,c,u,g){const v=KP(Cl(f,c,u)),k=KP(Cl(f,c,g)),N=KP(Cl(u,g,f)),I=KP(Cl(u,g,c));return v!==k&&N!==I||!(v!==0||!GP(f,u,c))||!(k!==0||!GP(f,g,c))||!(N!==0||!GP(u,f,g))||!(I!==0||!GP(u,c,g))}function GP(f,c,u){return c.x<=Math.max(f.x,u.x)&&c.x>=Math.min(f.x,u.x)&&c.y<=Math.max(f.y,u.y)&&c.y>=Math.min(f.y,u.y)}function KP(f){return f>0?1:f<0?-1:0}function F5(f,c){return Cl(f.prev,f,f.next)<0?Cl(f,c,f.next)>=0&&Cl(f,f.prev,c)>=0:Cl(f,c,f.prev)<0||Cl(f,f.next,c)<0}function s1e(f,c){const u=Aae(f.i,f.x,f.y),g=Aae(c.i,c.x,c.y),v=f.next,k=c.prev;return f.next=c,c.prev=f,u.next=v,v.prev=u,g.next=u,u.prev=g,k.next=g,g.prev=k,g}function i1e(f,c,u,g){const v=Aae(f,c,u);return g?(v.next=g.next,v.prev=g,g.next.prev=v,g.next=v):(v.prev=v,v.next=v),v}function z5(f){f.next.prev=f.prev,f.prev.next=f.next,f.prevZ&&(f.prevZ.nextZ=f.nextZ),f.nextZ&&(f.nextZ.prevZ=f.prevZ)}function Aae(f,c,u){return{i:f,x:c,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function B5(f,c){const u=f.length;if(u<=1)return[f];const g=[];let v,k;for(let N=0;N1)for(let N=0;N=Mr&&u>=Mr}static evaluate(c){if(c.length===0)return new ox;let u=[];for(const R of c)u.push(...R.portals);if(u.length===0)return new ox;for(const R of u){const $=R.va,W=R.vb;(ox.isOnBorder($.x,W.x)||ox.isOnBorder($.y,W.y))&&(R.type="border")}const g=u.filter(R=>R.type!=="unevaluated"),v=u.filter(R=>R.type==="unevaluated");if(v.length===0)return new ox;v.sort((R,$)=>R.hash===$.hash?R.isTunnel===$.isTunnel?0:R.isTunnel?-1:1:R.hash<$.hash?1:-1),u=g.concat(v);let k=g.length,N=k,I=k;do if(N++,N===u.length||u[k].hash!==u[N].hash){if(N-k==2){IR.hash<$.hash?1:-1),{portals:u}}}Qr(ox,"ElevationPortalGraph"),Qr(o1e,"ElevationPolygons");class OUe{constructor(c,u,g){this.outPositions=c,this.outNormals=u,this.outIndices=g,this.vertexLookup=new Map}addVertex(c,u,g){let v=c[2];g!=null&&(v*=g);const k=`${c[0]},${c[1]},${c[2]},${u[0]},${u[1]},${u[2]}`,N=this.vertexLookup.get(k);if(N!=null)return N;const I=this.outPositions.length;this.vertexLookup.set(k,I);const R=Math.trunc(16384*u[0]),$=Math.trunc(16384*u[1]),W=Math.trunc(16384*u[2]);return this.outPositions.emplaceBack(c[0],c[1],v),this.outNormals.emplaceBack(R,$,W),I}addTriangle(c,u,g){this.outIndices.emplaceBack(c,u,g)}addTriangles(c,u,g){if(c.length===0)return;const v=g.length===1,k=be(),N=be();for(let I=0;Ik!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Th(u,{zoom:g,lut:v},k=>k!=="fill-bridge-guard-rail-color")}addVertices(c,u){const g=this.unevalVertices.length;for(let v=0;v=k.min.x&&G.x<=k.max.x&&G.y>=k.min.y&&G.y<=k.max.y||X.x>=k.min.x&&X.x<=k.max.x&&X.y>=k.min.y&&X.y<=k.max.y||ec(G,X,I))||this.isOnBorder(G.x,X.x)||this.isOnBorder(G.y,X.y))continue;const te=hu.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[W]);let se,me=this.vertexHashLookup.get(hu.computePosHash(G));me!=null?se=me.next:(me=this.vertexHashLookup.get(hu.computePosHash(X)),se=me!=null?me.prev:te),this.unevalEdges.push({polygonIdx:c,a:$,b:W,hash:te,portalHash:se,isTunnel:v,type:"unevaluated",featureInfo:N})}}addPortalCandidates(c,u,g,v,k){if(u.length===0)return;this.portalPolygons.add(c,{geometry:u,zLevel:k});const N=u[0];this.vertexHashLookup.clear();let I=hu.computeEdgeHash(N[N.length-2],N[N.length-1]);for(let R=0;R({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},v=new OUe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const k=u(),N=u(),I=u(),R=(X,te)=>{X.sort((me,Se)=>me.type===te&&Se.type!==te?-1:me.type!==te&&Se.type===te?1:0);const se=X.findIndex(me=>me.type!==te);return se>=0?se:X.length};let $=0;this.unevalEdges.length>0&&($=R(this.unevalEdges,"none"),this.constructBridgeStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},this.tileToMeters)),g(I);const W=u(),G=u();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice($),te=R(X,"tunnel")+$;this.unevalEdges.push(...X),this.constructTunnelStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},{min:$,max:te})}g(W),v.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(G),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(N),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(k),this.maskSegments=Aa.simpleSegment(0,G.primitiveOffset,0,G.primitiveLength),this.depthSegments=Aa.simpleSegment(0,N.primitiveOffset,0,N.primitiveLength),this.renderableBridgeSegments=Aa.simpleSegment(0,I.primitiveOffset,0,I.primitiveLength),this.renderableTunnelSegments=Aa.simpleSegment(0,W.primitiveOffset,0,W.primitiveLength),this.shadowCasterSegments=Aa.simpleSegment(0,k.primitiveOffset,0,k.primitiveLength)}update(c,u,g,v,k,N,I,R){this.bridgeProgramConfigurations.updatePaintArrays(c,u,k,g,v,N,I,R),this.tunnelProgramConfigurations.updatePaintArrays(c,u,k,g,v,N,I,R)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,jUe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,kUe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(c),this.tunnelProgramConfigurations.upload(c))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(c,u,g,v,k){const N=(I,R)=>{for(let $=0;$fe(xr,u[vr].x,u[vr].y,g[vr]*R),G=be(),X=be(),te=be(),se=be(),me=be(),Se=(xr,vr)=>{const hr=I.get(hu.computePosHash(u[vr])),pr=hr.from,er=hr.to;if(!pr||!er)return;W(G,pr),W(X,vr),W(te,er),et(se),nt(G,X)||(Ae(me,X,G),Re(se,me)),nt(te,X)||(Ae(me,te,X),de(se,se,Re(me,me)));const Zt=Be(se);return Zt>0?ae(xr,se,1/Zt):void 0};let Ne=Number.POSITIVE_INFINITY;this.sortSubarray(v,k.min,k.max,(xr,vr)=>xr.featureInfo.featureIndex-vr.featureInfo.featureIndex);const Oe=be(),Fe=be(),He=be(),dt=be(),it=be(),gt=be(),Nt=be(),Tt=be(),Gt=be(),Dt=[be(),be(),be(),be()],tr=[be(),be(),be(),be()],or=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],lr=(xr,vr)=>xr>vr;for(let xr=k.min;xrNe.featureInfo.featureIndex-Oe.featureInfo.featureIndex;this.sortSubarray(v,k.min,k.max,R),this.sortSubarray(v,N.min,N.max,R);const $=Ne=>Re(Ne,Ne),W=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],G=(Ne,Oe)=>NeI.hash===R.hash?R.polygonIdx-I.polygonIdx:R.hash>I.hash?1:-1);let g=0,v=0,k=0,N=u[g].polygonIdx;do v++,(v===u.length||u[g].hash!==u[v].hash)&&((v-g==1||u[v-1].polygonIdx!==N)&&(k$.portalHashW.hash?I++:W.hash>$.portalHash?R++:($.type=W.type,I++)}}}isOnBorder(c,u){return c<=0&&u<=0||c>=Mr&&u>=Mr}addFeatureSection(c,u,g,v){return c!==u&&(u=c,g.push({featureIndex:c,vertexStart:v.getVertexCount()}),v.clearVertexLookup()),u}sortSubarray(c,u,g,v){const k=c.slice(u,g);k.sort(v),c.splice(u,k.length,...k)}static computeEdgeHash(c,u){return(c.y===u.y&&c.x>u.x||c.y>u.y)&&([c,u]=[u,c]),BigInt(hu.computePosHash(c))<<32n|BigInt(hu.computePosHash(u))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var l1e,c1e={exports:{}},d1e=(l1e||(l1e=1,function(f){function c(at,ut){return at>ut?1:at0){var pn=yr+Math.floor(Rr/2),xn={key:ut[pn],data:nr[pn],parent:at};return xn.left=v(xn,ut,nr,yr,pn),xn.right=v(xn,ut,nr,pn+1,Dr),xn}return null}function k(at,ut,nr,yr,Dr){if(!(nr>=yr)){for(var Rr=at[nr+yr>>1],pn=nr-1,xn=yr+1;;){do pn++;while(Dr(at[pn],Rr)<0);do xn--;while(Dr(at[xn],Rr)>0);if(pn>=xn)break;var Jn=at[pn];at[pn]=at[xn],at[xn]=Jn,Jn=ut[pn],ut[pn]=ut[xn],ut[xn]=Jn}k(at,ut,nr,xn,Dr),k(at,ut,xn+1,yr,Dr)}}u.prototype.rotateLeft=function(at){var ut=at.right;ut&&(at.right=ut.left,ut.left&&(ut.left.parent=at),ut.parent=at.parent),at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.left=at),at.parent=ut},u.prototype.rotateRight=function(at){var ut=at.left;ut&&(at.left=ut.right,ut.right&&(ut.right.parent=at),ut.parent=at.parent),at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.right=at),at.parent=ut},u.prototype._splay=function(at){for(;at.parent;){var ut=at.parent;ut.parent?ut.left===at&&ut.parent.left===ut?(this.rotateRight(ut.parent),this.rotateRight(ut)):ut.right===at&&ut.parent.right===ut?(this.rotateLeft(ut.parent),this.rotateLeft(ut)):ut.left===at&&ut.parent.right===ut?(this.rotateRight(ut),this.rotateLeft(ut)):(this.rotateLeft(ut),this.rotateRight(ut)):ut.left===at?this.rotateRight(ut):this.rotateLeft(ut)}},u.prototype.splay=function(at){for(var ut,nr,yr,Dr,Rr;at.parent;)(nr=(ut=at.parent).parent)&&nr.parent?((yr=nr.parent).left===nr?yr.left=at:yr.right=at,at.parent=yr):(at.parent=null,this._root=at),Dr=at.left,Rr=at.right,at===ut.left?(nr&&(nr.left===ut?(ut.right?(nr.left=ut.right,nr.left.parent=nr):nr.left=null,ut.right=nr,nr.parent=ut):(Dr?(nr.right=Dr,Dr.parent=nr):nr.right=null,at.left=nr,nr.parent=at)),Rr?(ut.left=Rr,Rr.parent=ut):ut.left=null,at.right=ut,ut.parent=at):(nr&&(nr.right===ut?(ut.left?(nr.right=ut.left,nr.right.parent=nr):nr.right=null,ut.left=nr,nr.parent=ut):(Rr?(nr.left=Rr,Rr.parent=nr):nr.left=null,at.right=nr,nr.parent=at)),Dr?(ut.right=Dr,Dr.parent=ut):ut.right=null,at.left=ut,ut.parent=at)},u.prototype.replace=function(at,ut){at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.parent=at.parent)},u.prototype.minNode=function(at){if(at===void 0&&(at=this._root),at)for(;at.left;)at=at.left;return at},u.prototype.maxNode=function(at){if(at===void 0&&(at=this._root),at)for(;at.right;)at=at.right;return at},u.prototype.insert=function(at,ut){var nr=this._root,yr=null,Dr=this._compare;if(this._noDuplicates)for(;nr;){if(yr=nr,Dr(nr.key,at)===0)return;nr=Dr(nr.key,at)<0?nr.right:nr.left}else for(;nr;)yr=nr,nr=Dr(nr.key,at)<0?nr.right:nr.left;return nr={key:at,data:ut,left:null,right:null,parent:yr},yr?Dr(yr.key,nr.key)<0?yr.right=nr:yr.left=nr:this._root=nr,this.splay(nr),this._size++,nr},u.prototype.find=function(at){for(var ut=this._root,nr=this._compare;ut;){var yr=nr(ut.key,at);if(yr<0)ut=ut.right;else{if(!(yr>0))return ut;ut=ut.left}}return null},u.prototype.contains=function(at){for(var ut=this._root,nr=this._compare;ut;){var yr=nr(at,ut.key);if(yr===0)return!0;ut=yr<0?ut.left:ut.right}return!1},u.prototype.remove=function(at){var ut=this.find(at);if(!ut)return!1;if(this.splay(ut),ut.left)if(ut.right){var nr=this.minNode(ut.right);nr.parent!==ut&&(this.replace(nr,nr.right),nr.right=ut.right,nr.right.parent=nr),this.replace(ut,nr),nr.left=ut.left,nr.left.parent=nr}else this.replace(ut,ut.left);else this.replace(ut,ut.right);return this._size--,!0},u.prototype.removeNode=function(at){if(!at)return!1;if(this.splay(at),at.left)if(at.right){var ut=this.minNode(at.right);ut.parent!==at&&(this.replace(ut,ut.right),ut.right=at.right,ut.right.parent=ut),this.replace(at,ut),ut.left=at.left,ut.left.parent=ut}else this.replace(at,at.left);else this.replace(at,at.right);return this._size--,!0},u.prototype.erase=function(at){var ut=this.find(at);if(ut){this.splay(ut);var nr=ut.left,yr=ut.right,Dr=null;nr&&(nr.parent=null,Dr=this.maxNode(nr),this.splay(Dr),this._root=Dr),yr&&(nr?Dr.right=yr:this._root=yr,yr.parent=Dr),this._size--}},u.prototype.pop=function(){var at=this._root,ut=null;if(at){for(;at.left;)at=at.left;ut={key:at.key,data:at.data},this.remove(at.key)}return ut},u.prototype.next=function(at){var ut=at;if(ut)if(ut.right)for(ut=ut.right;ut&&ut.left;)ut=ut.left;else for(ut=at.parent;ut&&ut.right===at;)at=ut,ut=ut.parent;return ut},u.prototype.prev=function(at){var ut=at;if(ut)if(ut.left)for(ut=ut.left;ut&&ut.right;)ut=ut.right;else for(ut=at.parent;ut&&ut.left===at;)at=ut,ut=ut.parent;return ut},u.prototype.forEach=function(at){for(var ut=this._root,nr=[],yr=!1,Dr=0;!yr;)ut?(nr.push(ut),ut=ut.left):nr.length>0?(at(ut=nr.pop(),Dr++),ut=ut.right):yr=!0;return this},u.prototype.range=function(at,ut,nr,yr){for(var Dr=[],Rr=this._compare,pn=this._root;Dr.length!==0||pn;)if(pn)Dr.push(pn),pn=pn.left;else{if(Rr((pn=Dr.pop()).key,ut)>0)break;if(Rr(pn.key,at)>=0&&nr.call(yr,pn))return this;pn=pn.right}return this},u.prototype.keys=function(){for(var at=this._root,ut=[],nr=[],yr=!1;!yr;)at?(ut.push(at),at=at.left):ut.length>0?(at=ut.pop(),nr.push(at.key),at=at.right):yr=!0;return nr},u.prototype.values=function(){for(var at=this._root,ut=[],nr=[],yr=!1;!yr;)at?(ut.push(at),at=at.left):ut.length>0?(at=ut.pop(),nr.push(at.data),at=at.right):yr=!0;return nr},u.prototype.at=function(at){for(var ut=this._root,nr=[],yr=!1,Dr=0;!yr;)if(ut)nr.push(ut),ut=ut.left;else if(nr.length>0){if(ut=nr.pop(),Dr===at)return ut;Dr++,ut=ut.right}else yr=!0;return null},u.prototype.load=function(at,ut,nr){if(at===void 0&&(at=[]),ut===void 0&&(ut=[]),nr===void 0&&(nr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var yr=at.length;return nr&&k(at,ut,0,yr-1,this._compare),this._root=v(null,at,ut,0,yr),this._size=yr,this},u.prototype.min=function(){var at=this.minNode(this._root);return at?at.key:null},u.prototype.max=function(){var at=this.maxNode(this._root);return at?at.key:null},u.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},u.createTree=function(at,ut,nr,yr,Dr){return new u(nr,Dr).load(at,ut,yr)},Object.defineProperties(u.prototype,g);var N=0,I=1,R=2,$=3,W=0,G=1,X=2,te=3;function se(at,ut,nr){ut===null?(at.inOut=!1,at.otherInOut=!0):(at.isSubject===ut.isSubject?(at.inOut=!ut.inOut,at.otherInOut=ut.otherInOut):(at.inOut=!ut.otherInOut,at.otherInOut=ut.isVertical()?!ut.inOut:ut.inOut),ut&&(at.prevInResult=!me(ut,nr)||ut.isVertical()?ut.prevInResult:ut));var yr=me(at,nr);at.resultTransition=yr?function(Dr,Rr){var pn,xn=!Dr.inOut,Jn=!Dr.otherInOut;switch(Rr){case W:pn=xn&&Jn;break;case G:pn=xn||Jn;break;case te:pn=xn^Jn;break;case X:pn=Dr.isSubject?xn&&!Jn:Jn&&!xn}return pn?1:-1}(at,nr):0}function me(at,ut){switch(at.type){case N:switch(ut){case W:return!at.otherInOut;case G:return at.otherInOut;case X:return at.isSubject&&at.otherInOut||!at.isSubject&&!at.otherInOut;case te:return!0}break;case R:return ut===W||ut===G;case $:return ut===X;case I:return!1}return!1}var Se=function(at,ut,nr,yr,Dr){this.left=ut,this.point=at,this.otherEvent=nr,this.isSubject=yr,this.type=Dr||N,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},Ne={inResult:{configurable:!0}};function Oe(at,ut){return at[0]===ut[0]&&at[1]===ut[1]}Se.prototype.isBelow=function(at){var ut=this.point,nr=this.otherEvent.point;return this.left?(ut[0]-at[0])*(nr[1]-at[1])-(nr[0]-at[0])*(ut[1]-at[1])>0:(nr[0]-at[0])*(ut[1]-at[1])-(ut[0]-at[0])*(nr[1]-at[1])>0},Se.prototype.isAbove=function(at){return!this.isBelow(at)},Se.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},Ne.inResult.get=function(){return this.resultTransition!==0},Se.prototype.clone=function(){var at=new Se(this.point,this.left,this.otherEvent,this.isSubject,this.type);return at.contourId=this.contourId,at.resultTransition=this.resultTransition,at.prevInResult=this.prevInResult,at.isExteriorRing=this.isExteriorRing,at.inOut=this.inOut,at.otherInOut=this.otherInOut,at},Object.defineProperties(Se.prototype,Ne);var Fe=11102230246251565e-32,He=134217729,dt=(3+8*Fe)*Fe;function it(at,ut,nr,yr,Dr){var Rr,pn,xn,Jn,cs=ut[0],ps=yr[0],Es=0,Ln=0;ps>cs==ps>-cs?(Rr=cs,cs=ut[++Es]):(Rr=ps,ps=yr[++Ln]);var Un=0;if(Escs==ps>-cs?(xn=Rr-((pn=cs+Rr)-cs),cs=ut[++Es]):(xn=Rr-((pn=ps+Rr)-ps),ps=yr[++Ln]),Rr=pn,xn!==0&&(Dr[Un++]=xn);Escs==ps>-cs?(xn=Rr-((pn=Rr+cs)-(Jn=pn-Rr))+(cs-Jn),cs=ut[++Es]):(xn=Rr-((pn=Rr+ps)-(Jn=pn-Rr))+(ps-Jn),ps=yr[++Ln]),Rr=pn,xn!==0&&(Dr[Un++]=xn);for(;Es0!=Es>0)return Ln;var Un=Math.abs(ps+Es);return Math.abs(Ln)>=Nt*Un?Ln:-function(ti,ai,oi,ki,Hi,Di,hi){var yi,ds,Bs,ka,In,Is,Bi,Yi,ea,oo,Xi,Pn,Pa,Ni,ya,qo,xl,Ao,Eo=ti-Hi,ol=oi-Hi,kd=ai-Di,Qi=ki-Di;Dt[0]=(ya=(Yi=Eo-(Bi=(Is=He*Eo)-(Is-Eo)))*(oo=Qi-(ea=(Is=He*Qi)-(Is-Qi)))-((Ni=Eo*Qi)-Bi*ea-Yi*ea-Bi*oo))-((Xi=ya-(xl=(Yi=kd-(Bi=(Is=He*kd)-(Is-kd)))*(oo=ol-(ea=(Is=He*ol)-(Is-ol)))-((qo=kd*ol)-Bi*ea-Yi*ea-Bi*oo)))+(In=ya-Xi))+(In-xl),Dt[1]=(Pa=Ni-((Pn=Ni+Xi)-(In=Pn-Ni))+(Xi-In))-((Xi=Pa-qo)+(In=Pa-Xi))+(In-qo),Dt[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),Dt[3]=Ao;var to=function(Ym,tc){for(var nd=tc[0],pu=1;pu<4;pu++)nd+=tc[pu];return nd}(0,Dt),lo=Tt*hi;if(to>=lo||-to>=lo||(yi=ti-(Eo+(In=ti-Eo))+(In-Hi),Bs=oi-(ol+(In=oi-ol))+(In-Hi),ds=ai-(kd+(In=ai-kd))+(In-Di),ka=ki-(Qi+(In=ki-Qi))+(In-Di),yi===0&&ds===0&&Bs===0&&ka===0)||(lo=Gt*hi+dt*Math.abs(to),(to+=Eo*ka+Qi*yi-(kd*Bs+ol*ds))>=lo||-to>=lo))return to;xr[0]=(ya=(Yi=yi-(Bi=(Is=He*yi)-(Is-yi)))*(oo=Qi-(ea=(Is=He*Qi)-(Is-Qi)))-((Ni=yi*Qi)-Bi*ea-Yi*ea-Bi*oo))-((Xi=ya-(xl=(Yi=ds-(Bi=(Is=He*ds)-(Is-ds)))*(oo=ol-(ea=(Is=He*ol)-(Is-ol)))-((qo=ds*ol)-Bi*ea-Yi*ea-Bi*oo)))+(In=ya-Xi))+(In-xl),xr[1]=(Pa=Ni-((Pn=Ni+Xi)-(In=Pn-Ni))+(Xi-In))-((Xi=Pa-qo)+(In=Pa-Xi))+(In-qo),xr[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),xr[3]=Ao;var qd=it(4,Dt,4,xr,tr);xr[0]=(ya=(Yi=Eo-(Bi=(Is=He*Eo)-(Is-Eo)))*(oo=ka-(ea=(Is=He*ka)-(Is-ka)))-((Ni=Eo*ka)-Bi*ea-Yi*ea-Bi*oo))-((Xi=ya-(xl=(Yi=kd-(Bi=(Is=He*kd)-(Is-kd)))*(oo=Bs-(ea=(Is=He*Bs)-(Is-Bs)))-((qo=kd*Bs)-Bi*ea-Yi*ea-Bi*oo)))+(In=ya-Xi))+(In-xl),xr[1]=(Pa=Ni-((Pn=Ni+Xi)-(In=Pn-Ni))+(Xi-In))-((Xi=Pa-qo)+(In=Pa-Xi))+(In-qo),xr[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),xr[3]=Ao;var Vo=it(qd,tr,4,xr,or);xr[0]=(ya=(Yi=yi-(Bi=(Is=He*yi)-(Is-yi)))*(oo=ka-(ea=(Is=He*ka)-(Is-ka)))-((Ni=yi*ka)-Bi*ea-Yi*ea-Bi*oo))-((Xi=ya-(xl=(Yi=ds-(Bi=(Is=He*ds)-(Is-ds)))*(oo=Bs-(ea=(Is=He*Bs)-(Is-Bs)))-((qo=ds*Bs)-Bi*ea-Yi*ea-Bi*oo)))+(In=ya-Xi))+(In-xl),xr[1]=(Pa=Ni-((Pn=Ni+Xi)-(In=Pn-Ni))+(Xi-In))-((Xi=Pa-qo)+(In=Pa-Xi))+(In-qo),xr[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),xr[3]=Ao;var jf=it(Vo,or,4,xr,lr);return lr[jf-1]}(Dr,Rr,pn,xn,Jn,cs,Un)}(at[0],at[1],ut[0],ut[1],nr[0],nr[1]);return yr>0?-1:yr<0?1:0}function hr(at,ut){var nr=at.point,yr=ut.point;return nr[0]>yr[0]?1:nr[0]yr[1]?1:-1:function(Dr,Rr,pn,xn){return Dr.left!==Rr.left?Dr.left?1:-1:vr(pn,Dr.otherEvent.point,Rr.otherEvent.point)!==0?Dr.isBelow(Rr.otherEvent.point)?-1:1:!Dr.isSubject&&Rr.isSubject?1:-1}(at,ut,nr)}function pr(at,ut,nr){var yr=new Se(ut,!1,at,at.isSubject),Dr=new Se(ut,!0,at.otherEvent,at.isSubject);return Oe(at.point,at.otherEvent.point)&&console.warn("what is that, a collapsed segment?",at),yr.contourId=Dr.contourId=at.contourId,hr(Dr,at.otherEvent)>0&&(at.otherEvent.left=!0,Dr.left=!1),at.otherEvent.otherEvent=Dr,at.otherEvent=yr,nr.push(Dr),nr.push(yr),nr}function er(at,ut){return at[0]*ut[1]-at[1]*ut[0]}function Zt(at,ut){return at[0]*ut[0]+at[1]*ut[1]}function mr(at,ut,nr){var yr=function(Jn,cs,ps,Es,Ln){var Un=[cs[0]-Jn[0],cs[1]-Jn[1]],ti=[Es[0]-ps[0],Es[1]-ps[1]];function ai(Is,Bi,Yi){return[Is[0]+Bi*Yi[0],Is[1]+Bi*Yi[1]]}var oi=[ps[0]-Jn[0],ps[1]-Jn[1]],ki=er(Un,ti),Hi=ki*ki,Di=Zt(Un,Un);if(Hi>0){var hi=er(oi,ti)/ki;if(hi<0||hi>1)return null;var yi=er(oi,Un)/ki;return yi<0||yi>1?null:hi===0||hi===1?[ai(Jn,hi,Un)]:yi===0||yi===1?[ai(ps,yi,ti)]:[ai(Jn,hi,Un)]}if((Hi=(ki=er(oi,Un))*ki)>0)return null;var ds=Zt(Un,oi)/Di,Bs=ds+Zt(Un,ti)/Di,ka=Math.min(ds,Bs),In=Math.max(ds,Bs);return ka<=1&&In>=0?ka===1?[ai(Jn,ka>0?ka:0,Un)]:In===0?[ai(Jn,In<1?In:1,Un)]:[ai(Jn,ka>0?ka:0,Un),ai(Jn,In<1?In:1,Un)]:null}(at.point,at.otherEvent.point,ut.point,ut.otherEvent.point),Dr=yr?yr.length:0;if(Dr===0||Dr===1&&(Oe(at.point,ut.point)||Oe(at.otherEvent.point,ut.otherEvent.point))||Dr===2&&at.isSubject===ut.isSubject)return 0;if(Dr===1)return Oe(at.point,yr[0])||Oe(at.otherEvent.point,yr[0])||pr(at,yr[0],nr),Oe(ut.point,yr[0])||Oe(ut.otherEvent.point,yr[0])||pr(ut,yr[0],nr),1;var Rr=[],pn=!1,xn=!1;return Oe(at.point,ut.point)?pn=!0:hr(at,ut)===1?Rr.push(ut,at):Rr.push(at,ut),Oe(at.otherEvent.point,ut.otherEvent.point)?xn=!0:hr(at.otherEvent,ut.otherEvent)===1?Rr.push(ut.otherEvent,at.otherEvent):Rr.push(at.otherEvent,ut.otherEvent),pn&&xn||pn?(ut.type=I,at.type=ut.inOut===at.inOut?R:$,pn&&!xn&&pr(Rr[1].otherEvent,Rr[0].point,nr),2):xn?(pr(Rr[0],Rr[1].point,nr),3):Rr[0]!==Rr[3].otherEvent?(pr(Rr[0],Rr[1].point,nr),pr(Rr[1],Rr[2].point,nr),3):(pr(Rr[0],Rr[1].point,nr),pr(Rr[3].otherEvent,Rr[2].point,nr),3)}function Tr(at,ut){if(at===ut)return 0;if(vr(at.point,at.otherEvent.point,ut.point)!==0||vr(at.point,at.otherEvent.point,ut.otherEvent.point)!==0)return Oe(at.point,ut.point)?at.isBelow(ut.otherEvent.point)?-1:1:at.point[0]===ut.point[0]?at.point[1]ut.contourId?1:-1:hr(at,ut)===1?1:-1}var jr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function hn(at,ut,nr,yr){var Dr,Rr=at+1,pn=ut[at].point,xn=ut.length;for(Rryr;)Rr--;return Rr}jr.prototype.isExterior=function(){return this.holeOf==null};var Ur=rn,Zr=rn;function rn(at,ut){if(!(this instanceof rn))return new rn(at,ut);if(this.data=at||[],this.length=this.data.length,this.compare=ut||gs,this.length>0)for(var nr=(this.length>>1)-1;nr>=0;nr--)this._down(nr)}function gs(at,ut){return atut?1:0}rn.prototype={push:function(at){this.data.push(at),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var at=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),at}},peek:function(){return this.data[0]},_up:function(at){for(var ut=this.data,nr=this.compare,yr=ut[at];at>0;){var Dr=at-1>>1,Rr=ut[Dr];if(nr(yr,Rr)>=0)break;ut[at]=Rr,at=Dr}ut[at]=yr},_down:function(at){for(var ut=this.data,nr=this.compare,yr=this.length>>1,Dr=ut[at];at=0)break;ut[at]=xn,at=Rr}ut[at]=Dr}},Ur.default=Zr;var kr=Math.max,sn=Math.min,qn=0;function Ds(at,ut,nr,yr,Dr,Rr){var pn,xn,Jn,cs,ps,Es;for(pn=0,xn=at.length-1;pn0?Es.left=!0:ps.left=!0;var Ln=Jn[0],Un=Jn[1];Dr[0]=sn(Dr[0],Ln),Dr[1]=sn(Dr[1],Un),Dr[2]=kr(Dr[2],Ln),Dr[3]=kr(Dr[3],Un),yr.push(ps),yr.push(Es)}}var Us=[];function rs(at,ut,nr){typeof at[0][0][0]=="number"&&(at=[at]),typeof ut[0][0][0]=="number"&&(ut=[ut]);var yr=function(Un,ti,ai){var oi=null;return Un.length*ti.length==0&&(ai===W?oi=Us:ai===X?oi=Un:ai!==G&&ai!==te||(oi=Un.length===0?ti:Un)),oi}(at,ut,nr);if(yr)return yr===Us?null:yr;var Dr=[1/0,1/0,-1/0,-1/0],Rr=[1/0,1/0,-1/0,-1/0],pn=function(Un,ti,ai,oi,ki){var Hi,Di,hi,yi,ds,Bs,ka=new Ur(null,hr);for(hi=0,yi=Un.length;hioi[2]||oi[0]>ai[2]||ai[1]>oi[3]||oi[1]>ai[3])&&(ki===W?Hi=Us:ki===X?Hi=Un:ki!==G&&ki!==te||(Hi=Un.concat(ti))),Hi}(at,ut,Dr,Rr,nr))return yr===Us?null:yr;for(var xn=function(Un){var ti,ai,oi=function(hi){var yi,ds,Bs,ka,In=[];for(ds=0,Bs=hi.length;ds0){var Xi=Is[oo];if(Xi.holeOf!=null){var Pn=Xi.holeOf;Is[Pn].holeIds.push(Bi),Yi.holeOf=Pn,Yi.depth=Is[oo].depth}else Is[oo].holeIds.push(Bi),Yi.holeOf=oo,Yi.depth=Is[oo].depth+1}else Yi.holeOf=null,Yi.depth=Is[oo].depth}else Yi.holeOf=null,Yi.depth=0;return Yi}(oi[ti],Hi,hi),ds=function(In){ki[In]=!0,In=oi.length)&&oi[Bs];);Hi.push(yi)}};for(ti=0,ai=oi.length;tika||Hi===X&&In.point[0]>oi[2])break;if(In.left){hi=Di=ds.insert(In),Di=Di!==(yi=ds.minNode())?ds.prev(Di):null,hi=ds.next(hi);var Is=Di?Di.key:null;if(se(In,Is,Hi),hi&&mr(In,hi.key,Un)===2&&(se(In,Is,Hi),se(hi.key,In,Hi)),Di&&mr(Di.key,In,Un)===2){var Bi=Di;se(Is,(Bi=Bi!==yi?ds.prev(Bi):null)?Bi.key:null,Hi),se(In,Is,Hi)}}else hi=Di=ds.find(In=In.otherEvent),Di&&hi&&(Di=Di!==yi?ds.prev(Di):null,hi=ds.next(hi),ds.remove(In),hi&&Di&&mr(Di.key,hi.key,Un))}return Bs}(pn,0,0,Dr,Rr,nr)),Jn=[],cs=0;cs * @license MIT * @preserve */function ZP(f,c,u,g){const v=[],k=g===0?(N,I,R,$,W,G)=>{N.push(new ir(G,R+(G-I)/($-I)*(W-R)))}:(N,I,R,$,W,G)=>{N.push(new ir(I+(G-R)/(W-R)*($-I),G))};for(const N of f){const I=[];for(const R of N){if(R.length<=2)continue;const $=[];for(let X=0;Xc&&k($,te,se,me,Se,c):Ne>u?Oe=c&&k($,te,se,me,Se,c),Oe>u&&Ne<=u&&k($,te,se,me,Se,u)}let W=R[R.length-1];const G=g===0?W.x:W.y;G>=c&&G<=u&&$.push(W),$.length&&(W=$[$.length-1],$[0].x===W.x&&$[0].y===W.y||$.push($[0]),I.push($))}I.length&&v.push(I)}return v}function DUe(f,c){const u=Pae(f),g=Pae([c]),v=d1e.intersection(u,g);return v==null?[]:u1e(v)}function RUe(f,c){let g=Pae(f,65536);const v=[];for(;c.valid();c.next()){const[k,N]=c.get(),I=k.x*65536,R=k.y*65536,$=N.x*65536,W=N.y*65536,G=$-I,X=W-R,te=Math.hypot(G,X);if(te===0)continue;const se=Math.trunc(X/te*3),me=-Math.trunc(G/te*3);v.push([[[I,R],[$,W],[$+se,W+me],[I+se,R+me],[I,R]]])}return v.length>0&&(g=d1e.diff(g,v)),u1e(g,1/65536)}function Pae(f,c=1){return[f.map(u=>u.map(g=>[g.x*c,g.y*c]))]}function u1e(f,c=1){return f.map(u=>u.map((g,v)=>{const k=g.map(N=>new ir(N[0]*c,N[1]*c).round());return v>0&&k.reverse(),k}))}class Lae{constructor(c,u){this.layoutVertexArray=new qm,this.indexArray=new Bo,this.lineIndexArray=new du,this.triangleSegments=new Aa,this.lineSegments=new Aa,this.programConfigurations=new Th(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,u&&(this.elevatedLayoutVertexArray=new kp)}update(c,u,g,v,k,N,I,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,N,I,R)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,bUe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.lineIndexBuffer=c.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,wUe.members))),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(c,u,g,v,k,N,I){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,u,g,v,k,N,void 0,I)}}class Oae{constructor(c){this.zoom=c.zoom,this.pixelRatio=c.pixelRatio,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=c.lut,this.bufferData=new Lae(c,!1),this.elevationBufferData=new Lae(c,!0),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=c.sourceLayerIndex,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Eae("fill",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("fill-sort-key"),N=[];for(const{feature:I,id:R,index:$,sourceLayerIndex:W}of c){const G=this.layers[0]._featureFilter.needGeometry,X=Ot(I,G);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),X,g))continue;const te=k?k.evaluate(X,{},g,u.availableImages):void 0,se={id:R,properties:I.properties,type:I.type,sourceLayerIndex:W,index:$,geometry:G?X.geometry:bt(I,g,v),patterns:{},sortKey:te};N.push(se)}k&&N.sort((I,R)=>I.sortKey-R.sortKey);for(const I of N){const{geometry:R,index:$,sourceLayerIndex:W}=I;if(this.hasPattern){const G=Iae("fill",this.layers,I,this.zoom,this.pixelRatio,u);this.patternFeatures.push(G)}else this.addFeature(I,R,$,g,{},u.availableImages,u.brightness,u.elevationFeatures);u.featureIndex.insert(c[$].feature,R,$,W,this.index)}}update(c,u,g,v,k,N,I){this.bufferData.update(c,u,g,v,k,N,I,this.worldview),this.elevationBufferData.update(c,u,g,v,k,N,I,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,u,g,v,k,N,I,this.worldview)}addFeatures(c,u,g,v,k,N){for(const I of this.patternFeatures)this.addFeature(I,I.geometry,I.index,u,g,v,N,c.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(c){this.bufferData.upload(c),this.elevationBufferData.upload(c),this.elevatedStructures&&this.elevatedStructures.upload(c)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(c,u,g,v,k,N=[],I,R){const $=B5(u,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,$,v,g,R):this.addGeometry($,this.bufferData),this.bufferData.populatePaintArrays(c,g,k,N,v,I,this.worldview),this.elevationBufferData.populatePaintArrays(c,g,k,N,v,I,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,u,g,v,k){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(u,g,v,k,this.worldview))}addElevatedRoadFeature(c,u,g,v,k){const N=new Array,I=gi.getElevationFeature(c,k);if(!I)return void this.addGeometry(u,this.bufferData);{const $=this.clipPolygonsToTile(u,1);$.length>0&&N.push({polygons:$,elevationFeature:I,elevationTileID:g})}const R={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},g),featureIndex:v};for(const $ of N)if($.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new hu($.elevationTileID,this.layers,this.zoom,this.lut));const G=$.elevationFeature.isTunnel();let X=0;c.properties.hasOwnProperty(qt)&&(X=+c.properties[qt]);for(const te of $.polygons)this.elevatedStructures.addPortalCandidates($.elevationFeature.id,te,G,$.elevationFeature,X)}$.elevationFeature.constantHeight==null&&($.polygons=this.prepareElevatedPolygons($.polygons,$.elevationFeature,$.elevationTileID));const W=new Li(g,$.elevationTileID);this.addElevatedGeometry($.polygons,W,$.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,v,R)}}addElevatedGeometry(c,u,g,v,k,N){const I={elevation:g,elevationSampler:u,bias:v,index:k,featureInfo:N},[R,$]=this.addGeometry(c,this.elevationBufferData,I);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:R,max:$}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,R),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,$))}addGeometry(c,u,g){let v=Number.POSITIVE_INFINITY,k=Number.NEGATIVE_INFINITY,N=null;g&&(N=g.elevationSampler.constantElevation(g.elevation,g.bias),N!=null&&(v=N,k=N));const I=(R,$,W)=>{if(g!=null)if($.push(R),N!=null)u.elevatedLayoutVertexArray.emplaceBack(N),W.push(N);else{const G=g.elevationSampler.pointElevation(R,g.elevation,g.bias);u.elevatedLayoutVertexArray.emplaceBack(G),W.push(G),v=Math.min(v,G),k=Math.max(k,G)}};for(const R of c){let $=0;for(const Fe of R)$+=Fe.length;const W=u.triangleSegments.prepareSegment($,u.layoutVertexArray,u.indexArray),G=W.vertexLength,X=[],te=[],se=[],me=[],Se=[],Ne=u.layoutVertexArray.length;for(const Fe of R){if(Fe.length===0)continue;Fe!==R[0]&&te.push(X.length/2);const He=u.lineSegments.prepareSegment(Fe.length,u.layoutVertexArray,u.lineIndexArray),dt=He.vertexLength;g&&Se.push(u.layoutVertexArray.length-Ne),I(Fe[0],se,me),u.layoutVertexArray.emplaceBack(Fe[0].x,Fe[0].y),u.lineIndexArray.emplaceBack(dt+Fe.length-1,dt),X.push(Fe[0].x),X.push(Fe[0].y);for(let it=1;it0&&g&&this.elevationMode==="hd-road-base"){const Fe=g.elevation.isTunnel(),He=g.elevation.safeArea,dt=this.elevatedStructures.addVertices(se,me);this.elevatedStructures.addTriangles(Oe,dt,Fe);const it=Se.length;if(it>0){for(let gt=0;gt=g&&te.max.x<=k&&te.min.y>=v&&te.max.y<=N?R:$).push(X)}if(R.length===c.length)return c;const W=[new ir(g,v),new ir(k,v),new ir(k,N),new ir(g,N),new ir(g,v)],G=R;for(const X of $)G.push(...DUe(X,W));return G}}let h1e,f1e,p1e,m1e;Qr(Oae,"FillBucket",{omit:["layers","patternFeatures"]}),Qr(Lae,"FillBufferData"),Qr(hu,"ElevatedStructures");class YP{constructor(c,u,g,v){if(this.triangleCount=u.length/3,this.min=new ir(0,0),this.max=new ir(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||c.length===0)return;const[k,N]=[c[0].clone(),c[0].clone()];for(let G=1;GG.cellIdx-X.cellIdx||G.triIdx-X.triIdx);let W=0;for(;W<$.length;){const G=$[W].cellIdx,X={start:this.payload.length,len:0};for(;W<$.length&&$[W].cellIdx===G;)++X.len,this.payload.push($[W++].triIdx);this.cells[G]=X}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(c,u){if(this.triangleCount===0||this.cells.length===0||c.x>this.max.x||this.min.x>c.x||c.y>this.max.y||this.min.y>c.y)return;const g=Km(c.x-this.min.x,this.xScale,this.cellsX),v=Km(c.y-this.min.y,this.yScale,this.cellsY),k=this.cells[v*this.cellsX+g];if(k){this._lazyInitLookup();for(let N=0;Nthis.max.x||this.min.x>u.x||c.y>this.max.y||this.min.y>u.y)return;this._lazyInitLookup();const v=Km(c.x-this.min.x,this.xScale,this.cellsX),k=Km(u.x-this.min.x,this.xScale,this.cellsX),N=Km(c.y-this.min.y,this.yScale,this.cellsY),I=Km(u.y-this.min.y,this.yScale,this.cellsY);for(let R=N;R<=I;R++)for(let $=v;$<=k;$++){const W=this.cells[R*this.cellsX+$];if(W)for(let G=0;Gu.fqid),this.index=c.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.footprints=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){for(const g of this.footprints)u.push({footprint:g,id:c})}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=[];for(const{feature:N,id:I,index:R,sourceLayerIndex:$}of c){const W=this.layers[0]._featureFilter.needGeometry,G=Ot(N,W);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:I,properties:N.properties,type:N.type,sourceLayerIndex:$,index:R,geometry:W?G.geometry:bt(N,g,v),patterns:{}};k.push(X)}for(const N of k){const{geometry:I,index:R,sourceLayerIndex:$}=N;this.addFeature(N,I,R,g,{},u.availableImages,u.brightness),u.featureIndex.insert(c[R].feature,I,R,$,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,u,g,v,k,N,I){}destroy(){}addFeature(c,u,g,v,k,N=[],I){for(const R of B5(u,2)){const $=[],W=[],G=[],X=new ir(1/0,1/0),te=new ir(-1/0,-1/0);for(const Se of R)if(Se.length!==0){Se!==R[0]&&G.push(W.length/2);for(let Ne=0;NeN===v)===void 0}(g,f.clipScope)}function XP(f,c){return f.x-c.x||f.y-c.y}function v1e(f,c){return XP(f.min,c.min)===0&&XP(f.max,c.max)===0}function Dae(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew ir((R.x+k.x*Mr)*I-N.x*Mr,(R.y+k.y*Mr)*I-N.y*Mr))}return Rae(u,v,f.indices,0,f.indices.length,0,0)}function w1e(f,c,u,g){const v=Math.pow(2,g.z-u.z);return new ir((f+u.x*Mr)*v-g.x*Mr,(c+u.y*Mr)*v-g.y*Mr)}function j1e(f,c){const u=[];c.grid.queryPoint(f,u);const g=c.indices,v=c.vertices;for(let k=0;k0&&(g.length>1&&u.push(g),g=[])}return g.length>1&&u.push(g),u}const zae=Pt.types,GUe=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],KUe=["fill-extrusion-flood-light-ground-radius"],ZUe=Math.pow(2,13),YUe=Math.pow(2,15)-1,N1e=new ir(0,1),lx=2147483648,S1e=7,C1e=450;function U5(f,c,u,g,v,k,N,I){f.emplaceBack((c<<1)+N,(u<<1)+k,(Math.floor(g*ZUe)<<1)+v,Math.round(I))}function q5(f,c,u){f.emplaceBack(c.x*Mr,c.y*Mr,u?1:0)}function JP(f,c,u,g,v,k){f.emplaceBack(c.x,c.y,(u.x<<1)+g,(u.y<<1)+v,k)}function V5(f,c,u){f.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}class M1e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class T1e{constructor(){this.centroidXY=new ir(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new ir(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ir(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new ir(this.max.x-this.min.x,this.max.y-this.min.y)}}class A1e{constructor(){this.acc=new ir(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(c,u){c.min.x===Number.MAX_VALUE&&(c.min.x=c.max.x=u.x,c.min.y=c.max.y=u.y)}appendEdge(c,u,g){this.accCount++,this.acc._add(u);let v=!!this.borders;u.xc.max.x&&(c.max.x=u.x,v=!0),u.yc.max.y&&(c.max.y=u.y,v=!0),((u.x===0||u.x===Mr)&&u.x===g.x)!=((u.y===0||u.y===Mr)&&u.y===g.y)&&this.processBorderOverlap(u,g),v&&this.checkBorderIntersection(u,g)}checkBorderIntersection(c,u){u.x<0!=c.x<0&&this.addBorderIntersection(0,Fn(u.y,c.y,(0-u.x)/(c.x-u.x))),u.x>Mr!=c.x>Mr&&this.addBorderIntersection(1,Fn(u.y,c.y,(Mr-u.x)/(c.x-u.x))),u.y<0!=c.y<0&&this.addBorderIntersection(2,Fn(u.x,c.x,(0-u.y)/(c.y-u.y))),u.y>Mr!=c.y>Mr&&this.addBorderIntersection(3,Fn(u.x,c.x,(Mr-u.y)/(c.y-u.y)))}addBorderIntersection(c,u){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const g=this.borders[c];ug[1]&&(g[1]=u)}processBorderOverlap(c,u){if(c.x===u.x){if(c.y===u.y)return;const g=c.x===0?0:1;this.addBorderIntersection(g,u.y),this.addBorderIntersection(g,c.y)}else{const g=c.y===0?2:3;this.addBorderIntersection(g,u.x),this.addBorderIntersection(g,c.x)}}centroid(){return this.accCount===0?new ir(0,0):new ir(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((c,u)=>c+ +(u[0]!==Number.MAX_VALUE),0):0}}function E1e(f,c){const u=f.add(c)._unit(),g=we(f.x*u.x+f.y*u.y,-1,1);var v,k,N;return v=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(v)))/4*YUe*((k=f).x*(N=c).y-k.y*N.x<0?-1:1)}const XUe=[f=>f.x<0,f=>f.x>Mr,f=>f.y<0,f=>f.y>Mr];function QUe(f,c,u,g){const v=[4];if(g===0)return v;u._mult(g);const k=f.sub(u),N=c.sub(u),I=[f,c,k,N];for(let R=0;R<4;R++)for(const $ of I)if(XUe[R]($)){v.push(R);break}return v}class Bae{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new g5,this.indexArray=new Bo,this.programConfigurations=new Th(c.layers,{zoom:c.zoom,lut:c.lut},u=>KUe.includes(u)),this._segments=new Aa,this.hiddenByLandmarkVertexArray=new uN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Aa}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,u,g,v=!1){const k=c.length;if(k>2){let N=Math.max(0,this._segments.get().length-1);const I=this._segments._prepareSegment(4*k,this.vertexArray.length,2*this._segmentToGroundQuads[N].length);let R;N!==this._segments.get().length-1&&(N++,this._segmentToGroundQuads[N]=[],this._segmentToRegionTriCounts[N]=[0,0,0,0,0]);{const $=c[0],W=c[1];R=E1e($.sub(c[k-1])._perp()._unit(),W.sub($)._perp()._unit())}for(let $=0;$v.region-k.region);for(let g=0;gR+$,0);let I=0;for(let R=0;R<=4;R++){const $=N[R];if($!==0){let W=this.regionSegments[R];W||(W=this.regionSegments[R]=new Aa);const G={vertexOffset:k.vertexOffset,primitiveOffset:k.primitiveOffset+I,vertexLength:k.vertexLength,primitiveLength:$};W.get().push(G)}I+=$}for(let R=0;R0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,qUe.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let c=0;c<=4;c++){const u=this.regionSegments[c];u&&u.destroy()}}}}class e6{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaling=c.overscaling,this.layers=c.layers,this.pixelRatio=c.pixelRatio,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=c.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Bo,this.footprintVertices=new qm,this.footprintSegments=[],this.layoutVertexArray=new zy,this.centroidVertexArray=new $P,this.wallVertexArray=new Fv,this.indexArray=new Bo,this.programConfigurations=new Th(c.layers,{zoom:c.zoom,lut:c.lut},u=>GUe.includes(u)),this.segments=new Aa,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.groundEffect=new Bae(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.features=[],this.hasPattern=Eae("fill-extrusion",this.layers,this.pixelRatio,u),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Pe(g),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:k,id:N,index:I,sourceLayerIndex:R}of c){const $=this.layers[0]._featureFilter.needGeometry,W=Ot(k,$);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),W,g))continue;const G={id:N,sourceLayerIndex:R,index:I,geometry:$?W.geometry:bt(k,g,v),properties:k.properties,type:k.type,patterns:{}},X=this.layoutVertexArray.length,te=zae[G.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:k.id,feature:Iae("fill-extrusion",this.layers,G,this.zoom,this.pixelRatio,u)});else if(this.wallMode)for(const se of G.geometry)for(const me of k1e(se,te))this.addFeature(k.id,G,[me],I,g,{},u.availableImages,v,u.brightness);else this.addFeature(k.id,G,G.geometry,I,g,{},u.availableImages,v,u.brightness);u.featureIndex.insert(k,G.geometry,I,R,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,u,g,v,k,N){for(const{featureId:I,feature:R}of this.features){const $=zae[R.type]==="Polygon",{geometry:W}=R;if(this.wallMode)for(const G of W)for(const X of k1e(G,$))this.addFeature(I,R,[X],R.index,u,g,v,k,N);else this.addFeature(I,R,W,R.index,u,g,v,k,N)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,u,g,v,k,N,I){this.programConfigurations.updatePaintArrays(c,u,k,g,v,N,I,this.worldview),this.groundEffect.update(c,u,k,g,v,N,I,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,HUe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,UUe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,VUe.members,!0)),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}uploadCentroid(c){this.groundEffect.uploadHiddenByLandmark(c),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=c.createVertexBuffer(this.centroidVertexArray,$Ue.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(c,u,g,v,k,N,I,R,$){const W=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(u,{})/this.tileToMeter,G=[new ir(0,0),new ir(Mr,Mr)],X=R.projection,te=X.name==="globe",se=this.wallMode||zae[u.type]==="Polygon",me=new A1e;me.centroidDataIndex=this.centroidData.length;const Se=new T1e;Se.buildingId=c,u.properties&&u.properties.hasOwnProperty("building_id")&&(Se.buildingId=u.properties.building_id);const Ne=this.layers[0].paint.get("fill-extrusion-base").evaluate(u,{},k)<=0,Oe=this.layers[0].paint.get("fill-extrusion-height").evaluate(u,{},k);let Fe;if(Se.height=Oe,Se.vertexArrayOffset=this.layoutVertexArray.length,Se.groundVertexArrayOffset=this.groundEffect.vertexArray.length,te&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new iN),this.wallMode){if(te)return void Vr("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;Fe=function(Dt){const tr=Dt[0].x===Dt[Dt.length-1].x&&Dt[0].y===Dt[Dt.length-1].y;(function(Zr){let rn=0;const gs=Zr.length;for(let kr=0;kr=0})(Dt)||(Dt=Dt.reverse());const lr={geometry:[],joinNormals:[],indices:[]},xr=[],vr=[],hr=[];let pr=Dt.length;for(;pr>=2&&Dt[pr-1].equals(Dt[pr-2]);)pr--;if(pr<(tr?3:2))return lr;let er,Zt,mr,Tr,jr,hn=0;for(;hn0;let qn="miter";const Ds=2;qn==="miter"&&kr>Ds&&(qn="bevel"),qn==="bevel"&&(kr>100&&(qn="flipbevel"),kr{const nr=new ir(rs.x,rs.y),yr=new ir(rs.x,rs.y);nr.x+=Oi.x*ut,nr.y+=Oi.y*ut,yr.x-=Oi.x*Math.max(at,1),yr.y-=Oi.y*Math.max(at,1),hr.push(Oi),xr.push(nr),vr.push(yr)};if(qn==="miter")rn._mult(kr),Us(er,rn,0,0);else if(qn==="flipbevel")rn=jr.mult(-1),Us(er,rn,0,0),Us(er,rn.mult(-1),0,0);else{const rs=-Math.sqrt(kr*kr-1),Oi=sn?rs:0,at=sn?0:rs;Zt&&Us(er,Tr,Oi,at),mr&&Us(er,jr,Oi,at)}}lr.geometry=[...xr,...vr.reverse(),xr[0]],lr.joinNormals=[...hr,...hr.reverse(),hr[hr.length-1]];const Ur=lr.geometry.length-1;for(let Zr=0;ZrDt<(tr.length-1)/2||Dt===tr.length-1,dt=this.wallMode?[g]:B5(g,500);for(let Dt=dt.length-1;Dt>=0;Dt--){const tr=dt[Dt];(tr.length===0||(it=tr[0]).every(or=>or.x<=0)||it.every(or=>or.x>=Mr)||it.every(or=>or.y<=0)||it.every(or=>or.y>=Mr))&&dt.splice(Dt,1)}var it;let gt;if(te)gt=F1e(dt,G,k);else{gt=[];for(const Dt of dt)gt.push({polygon:Dt,bounds:G})}const Nt=se?this.edgeRadius:0,Tt=Nt>0&&this.zoom<17,Gt=(Dt,tr)=>{if(Dt.length===0)return!1;const or=Dt[Dt.length-1];return tr.x===or.x&&tr.y===or.y};for(const{polygon:Dt,bounds:tr}of gt){let or=0,lr=0;for(const pr of Dt)se&&!pr[0].equals(pr[pr.length-1])&&pr.push(pr[0]),lr+=se?pr.length-1:pr.length;const xr=this.segments.prepareSegment((se?5:4)*lr,this.layoutVertexArray,this.indexArray);Se.footprintSegIdx<0&&(Se.footprintSegIdx=this.footprintSegments.length),Se.polygonSegIdx<0&&(Se.polygonSegIdx=this.polygonSegments.length);const vr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},hr=new M1e;if(hr.vertexOffset=this.footprintVertices.length,hr.indexOffset=3*this.footprintIndices.length,hr.ringIndices=[],se){const pr=[],er=[];or=xr.vertexLength;for(let mr=0;mr4&&O1e(er[er.length-2],er[0],er[1]),mr=Nt?JUe(er[er.length-2],er[0],er[1],Nt):0;const Tr=[];let jr,hn,Ur;hn=er[1].sub(er[0])._perp()._unit();let Zr=!0;for(let rn=1,gs=0;rn0?1:0,Oi=kr.dist(sn);if(gs+Oi>32768&&(gs=0),Nt){Ur=qn.sub(sn)._perp()._unit();let yr=P1e(kr,sn,qn,I1e(hn,Ur),Nt);isNaN(yr)&&(yr=0);const Dr=sn.sub(kr)._unit();kr=kr.add(Dr.mult(mr))._round(),sn=sn.add(Dr.mult(-yr))._round(),mr=yr,hn=Ur,Ne&&this.zoom>=17&&(Gt(Tr,kr)||Tr.push(kr),Gt(Tr,sn)||Tr.push(sn))}const at=xr.vertexLength,ut=er.length>4&&O1e(kr,sn,qn);let nr=D1e(gs,Zt,Zr);if(U5(this.layoutVertexArray,kr.x,kr.y,Us,rs,0,0,nr),U5(this.layoutVertexArray,kr.x,kr.y,Us,rs,0,1,nr),this.wallMode){const yr=He(rn-1,er),Dr=Fe.joinNormals[rn-1];q5(this.wallVertexArray,Dr,yr),q5(this.wallVertexArray,Dr,yr)}if(gs+=Oi,nr=D1e(gs,ut,!Zr),Zt=ut,U5(this.layoutVertexArray,sn.x,sn.y,Us,rs,0,0,nr),U5(this.layoutVertexArray,sn.x,sn.y,Us,rs,0,1,nr),this.wallMode){const yr=He(rn,er),Dr=Fe.joinNormals[rn];q5(this.wallVertexArray,Dr,yr),q5(this.wallVertexArray,Dr,yr)}if(xr.vertexLength+=4,this.indexArray.emplaceBack(at+0,at+1,at+2),this.indexArray.emplaceBack(at+1,at+3,at+2),xr.primitiveLength+=2,Nt){const yr=or+(rn===1?er.length-2:rn-2),Dr=rn===1?or:yr+1;if(this.indexArray.emplaceBack(at+1,yr,at+3),this.indexArray.emplaceBack(yr,Dr,at+3),xr.primitiveLength+=2,jr===void 0&&(jr=at),!$ae(qn,er[rn],tr)){const Rr=rn===er.length-1?jr:xr.vertexLength;this.indexArray.emplaceBack(at+2,at+3,Rr),this.indexArray.emplaceBack(at+3,Rr+1,Rr),this.indexArray.emplaceBack(at+3,Dr,Rr+1),xr.primitiveLength+=3}Zr=!Zr}if(te){const yr=this.layoutVertexExtArray,Dr=X.projectTilePoint(kr.x,kr.y,k),Rr=X.projectTilePoint(sn.x,sn.y,k),pn=X.upVector(k,kr.x,kr.y),xn=X.upVector(k,sn.x,sn.y);V5(yr,Dr,pn),V5(yr,Dr,pn),V5(yr,Rr,xn),V5(yr,Rr,xn)}}se&&(or+=er.length-1),Ne&&Nt&&this.zoom>=17&&(Tr.length!==0&&Gt(Tr,Tr[0])&&Tr.pop(),this.groundEffect.addData(Tr,tr,W,Nt>0))}this.footprintSegments.push(hr),vr.triangleCount=this.indexArray.length-vr.triangleArrayOffset,this.polygonSegments.push(vr),++Se.footprintSegLen,++Se.polygonSegLen}if(Se.vertexCount=this.layoutVertexArray.length-Se.vertexArrayOffset,Se.groundVertexCount=this.groundEffect.vertexArray.length-Se.groundVertexArrayOffset,Se.vertexCount!==0){if(Se.centroidXY=me.borders?N1e:this.encodeCentroid(me,Se),this.centroidData.push(Se),me.borders){this.featuresOnBorder.push(me);const Dt=this.featuresOnBorder.length-1;for(let tr=0;trthis.featuresOnBorder[u].borders[c][0]-this.featuresOnBorder[g].borders[c][0])}splitToSubtiles(){const c=[];for(let I=0;IMr),W=2*$+(+(R.min.x+R.max.x>Mr)^$);for(let G=0;GI.triangleSegmentIdx===R.triangleSegmentIdx?I.subtile-R.subtile:I.triangleSegmentIdx-R.triangleSegmentIdx);let g=0,v=0,k=0;for(const I of c){if(I.triangleSegmentIdx!==g)break;k++}const N=c.length;for(;v!==c.length;){g=c[v].triangleSegmentIdx;let I=0,R=v,$=v;for(let W=R;W0&&this.triangleSubSegments.push({segment:te,min:G,max:X}),R=$;for(let se=R;se[me[0]*(1-Ne[0])+Se[0]*Ne[0],me[1]*(1-Ne[1])+Se[1]*Ne[1]],te=[],se=[];for(const me of this.triangleSubSegments){te[0]=me.min.x/Mr,te[1]=me.min.y/Mr,se[0]=me.max.x/Mr,se[1]=me.max.y/Mr;const Se=X(W,G,te),Ne=X(W,G,se);if(new dn([Se[0],Se[1],k],[Ne[0],Ne[1],N]).intersectsPrecise(g)===0){$&&(v.segments.push($),$=void 0);continue}const Oe=me.segment;$&&$.vertexOffset!==Oe.vertexOffset&&(v.segments.push($),$=void 0),$?($.vertexLength+=Oe.vertexLength,$.primitiveLength+=Oe.primitiveLength):$={vertexOffset:Oe.vertexOffset,primitiveLength:Oe.primitiveLength,vertexLength:Oe.vertexLength,primitiveOffset:Oe.primitiveOffset,sortKey:void 0,vaos:{}}}return $&&v.segments.push($),v}encodeCentroid(c,u){const g=c.centroid(),v=u.span(),k=Math.min(7,Math.round(v.x*this.tileToMeter/10)),N=Math.min(7,Math.round(v.y*this.tileToMeter/10));return new ir(we(g.x,1,Mr-1)<<3|k,we(g.y,1,Mr-1)<<3|N)}encodeBorderCentroid(c){if(!c.borders)return new ir(0,0);const u=c.borders,g=Number.MAX_VALUE;if(u[0][0]!==g||u[1][0]!==g){const v=u[0][0]!==g?0:1;return new ir(6|(u[0][0]!==g?0:65528),(u[v][0]+u[v][1])/2<<3|6)}{const v=u[2][0]!==g?2:3;return new ir((u[v][0]+u[v][1])/2<<3|6,6|(u[2][0]!==g?0:65528))}}showCentroid(c){const u=this.centroidData[c.centroidDataIndex];u.flags&=2147483647,u.centroidXY.x=0,u.centroidXY.y=0,this.writeCentroidToBuffer(u)}writeCentroidToBuffer(c){this.groundEffect.updateHiddenByLandmark(c);const u=c.vertexArrayOffset,g=c.vertexCount+c.vertexArrayOffset,v=c.flags&lx?N1e:c.centroidXY,k=this.centroidVertexArray.geta_centroid_pos0(u);if(this.centroidVertexArray.geta_centroid_pos1(u)!==v.y||k!==v.x){for(let N=u;NR.max.x||R.min.x>N.max.x||N.min.y>R.max.y||R.min.y>N.max.y||N.footprint.buildingIds.has(R.buildingId)&&(R.flags|=lx);else for(const R of this.centroidData)if(!(R.flags&lx||N.min.x>R.max.x||R.min.x>N.max.x||N.min.y>R.max.y||R.min.y>N.max.y))for(let $=0;$u!=te>u&&c<(this.footprintVertices.int16[2*(W+N.vertexOffset)+0]-G)*(u-X)/(te-X)+G&&(v=!v)}I=R}}return v}getHeightAtTileCoord(c,u){let g=Number.NEGATIVE_INFINITY,v=!0;const k=4*(c+Mr)*Mr+(u+Mr);if(this.partLookup.hasOwnProperty(k)){const N=this.partLookup[k];return N?{height:N.height,hidden:!!(N.flags&lx)}:void 0}for(const N of this.centroidData)c>N.max.x||N.min.x>c||u>N.max.y||N.min.y>u||N.height<=g||this.footprintContainsPoint(c,u,N)&&(g=N.height,this.partLookup[k]=N,v=!!(N.flags&lx));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.partLookup[k]=void 0}}function I1e(f,c){const u=f.add(c)._unit();return f.x*u.x+f.y*u.y}function JUe(f,c,u,g){const v=c.sub(f)._perp()._unit(),k=u.sub(c)._perp()._unit();return P1e(f,c,u,I1e(v,k),g)}function P1e(f,c,u,g,v){const k=Math.sqrt(1-g*g);return Math.min(f.dist(c)/3,c.dist(u)/3,v*k/g)}function $ae(f,c,u){return f.xu[1].x&&c.x>u[1].x||f.yu[1].y&&c.y>u[1].y}function L1e(f,c){return f.xc[1].x||f.yc[1].y}function O1e(f,c,u){if(f.x<0||f.x>=Mr||c.x<0||c.x>=Mr||u.x<0||u.x>=Mr)return!1;const g=u.sub(c),v=g.perp(),k=f.sub(c);return(g.x*k.x+g.y*k.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(k.x*k.x+k.y*k.y))>-.866&&v.x*k.x+v.y*k.y<0}function D1e(f,c,u){const g=c?2|f:-3&f;return u?1|g:-2&g}function R1e(){const f=Math.PI/32,c=Math.tan(f),u=_;return u*Math.sqrt(1+2*c*c)-u}function F1e(f,c,u){const g=1<{for(const Nt of it)se.push({polygon:Nt,bounds:gt})},Se=Math.ceil(Math.log2(W)),Ne=Math.ceil(Math.log2(G)),Oe=Se-Ne,Fe=[];for(let it=0;it0?0:1);for(let it=0;itgt+1?dt.push({polygons:lr,bounds:vr,depth:gt+1}):me(lr,vr)}if(xr.length){const vr=[new ir(Nt===0?or:Tt.x,Nt===1?or:Tt.y),Gt];Fe.length>gt+1?dt.push({polygons:xr,bounds:vr,depth:gt+1}):me(xr,vr)}}return se}(f,c,Math.ceil((k-v)/11.25),Math.ceil((N-I)/11.25),1,(R,$,W)=>{if(R===0)return .5*($+W);{const G=le((u.y+$/Mr)/g);return(V(.5*(le((u.y+W/Mr)/g)+G))*g-u.y)*Mr}})}function eqe(f,c,u,g,v,k){const N=Math.pow(2,g.z-v.z);for(let I=0;I=R[N]&&(I=c,R=f),I[N]v&&U1e(I,R,N,v),I[N]k&&U1e(R,I,N,k)}}function t6(f,c,u,g,v,k){const N=[];for(let I=0;I=g&&se.x>=g||(te.x>=g?te=new ir(g,te.y+(g-te.x)/(se.x-te.x)*(se.y-te.y))._round():se.x>=g&&(se=new ir(g,te.y+(g-te.x)/(se.x-te.x)*(se.y-te.y))._round()),te.y>=v&&se.y>=v||(te.y>=v?te=new ir(te.x+(v-te.y)/(se.y-te.y)*(se.x-te.x),v)._round():se.y>=v&&(se=new ir(te.x+(v-te.y)/(se.y-te.y)*(se.x-te.x),v)._round()),$&&te.equals($[$.length-1])||($=[te],N.push($),k&&k.push({progress:{min:Se+V1e(Ne,Oe,te)*me,max:1},parentIndex:I,prevPoint:Ne,nextPoint:Oe})),$.push(se),k&&(k[k.length-1].progress.max=Se+V1e(Ne,Oe,se)*me,k[k.length-1].nextPoint=Oe)))))}if(k&&G>0)for(let X=W;X$.t-W.t);let N=0,I=0,R=[];for(g.push(R);N!==f.length;){if(I===k.length){for(;N!==f.length;)R.length!==0&&R[R.length-1].equals(f[N])||R.push(f[N]),N++;break}k[I].t<=N?(R.length!==0&&R[R.length-1].equals(k[I].point)||R.push(k[I].point),Math.trunc(k[I].t),I++):(R.length!==0&&R[R.length-1].equals(f[N])||R.push(f[N]),N++)}}function V1e(f,c,u){return f.x!==c.x?(u.x-f.x)/(c.x-f.x):f.y!==c.y?(u.y-f.y)/(c.y-f.y):0}function H5(f,c){return f.x*c.x+f.y*c.y}function H1e(f,c){if(f.length===1){let u=0;const g=c[u++];let v;for(;!v||g.equals(v);)if(v=c[u++],!v)return 1/0;for(;u{or[0]=lr,or[1]=xr,or[2]=vr,or[3]=1},tr=R1e();te>0&&(te+=tr),se+=tr;for(const or of X){const lr=[],xr=[];for(const vr of or){const hr=vr.x+me.x,pr=vr.y+me.y,er=G.projection.projectTilePoint(hr,pr,dt),Zt=G.projection.upVector(dt,vr.x,vr.y);let mr=te,Tr=se;if(Ne){const jr=K1e(hr,pr,te,se,Ne,Oe,Fe,He);mr+=jr.base,Tr+=jr.top}te!==0?Dt(Tt,er.x+Zt[0]*Nt*mr,er.y+Zt[1]*Nt*mr,er.z+Zt[2]*Nt*mr):Dt(Tt,er.x,er.y,er.z),Dt(Gt,er.x+Zt[0]*Nt*Tr,er.y+Zt[1]*Nt*Tr,er.z+Zt[2]*Nt*Tr),Ye(Tt,Tt,Se),Ye(Gt,Gt,Se),lr.push(new Kv(Tt[0],Tt[1],Tt[2])),xr.push(new Kv(Gt[0],Gt[1],Gt[2]))}it.push(lr),gt.push(xr)}return[it,gt]}(f,c,u,g,v,k,N,I,R,$,W):N?function(G,X,te,se,me,Se,Ne,Oe,Fe){const He=[],dt=[],it=[0,0,0,1];for(const gt of G){const Nt=[],Tt=[];for(const Gt of gt){const Dt=Gt.x+se.x,tr=Gt.y+se.y,or=K1e(Dt,tr,X,te,Se,Ne,Oe,Fe);it[0]=Dt,it[1]=tr,it[2]=or.base,it[3]=1,wt(it,it,me),it[3]=Math.max(it[3],1e-5);const lr=new Kv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);it[0]=Dt,it[1]=tr,it[2]=or.top,it[3]=1,wt(it,it,me),it[3]=Math.max(it[3],1e-5);const xr=new Kv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);Nt.push(lr),Tt.push(xr)}He.push(Nt),dt.push(Tt)}return[He,dt]}(c,u,g,v,k,N,I,R,$):function(G,X,te,se,me){const Se=[],Ne=[],Oe=me[8]*X,Fe=me[9]*X,He=me[10]*X,dt=me[11]*X,it=me[8]*te,gt=me[9]*te,Nt=me[10]*te,Tt=me[11]*te;for(const Gt of G){const Dt=[],tr=[];for(const or of Gt){const lr=or.x+se.x,xr=or.y+se.y,vr=me[0]*lr+me[4]*xr+me[12],hr=me[1]*lr+me[5]*xr+me[13],pr=me[2]*lr+me[6]*xr+me[14],er=me[3]*lr+me[7]*xr+me[15],Zt=vr+Oe,mr=hr+Fe,Tr=pr+He,jr=Math.max(er+dt,1e-5),hn=vr+it,Ur=hr+gt,Zr=pr+Nt,rn=Math.max(er+Tt,1e-5);Dt.push(new Kv(Zt/jr,mr/jr,Tr/jr)),tr.push(new Kv(hn/rn,Ur/rn,Zr/rn))}Se.push(Dt),Ne.push(tr)}return[Se,Ne]}(c,u,g,v,k)}function K1e(f,c,u,g,v,k,N,I){const R=N*v.getElevationAt(f,c,!0,!0),$=k[0]!==0,W=$?k[1]===0?N*(k[0]/S1e-C1e):N*function(G,X,te){const se=Math.floor(X[0]/8),me=Math.floor(X[1]/8),Se=10*(X[0]-8*se),Ne=10*(X[1]-8*me),Oe=G.getElevationAt(se,me,!0,!0),Fe=G.getMeterToDEM(te),He=Math.floor(.5*(Se*Fe-1)),dt=Math.floor(.5*(Ne*Fe-1)),it=G.tileCoordToPixel(se,me),gt=2*He+1,Nt=2*dt+1,Tt=function(xr,vr,hr,pr,er){return[xr.getElevationAtPixel(vr,hr,!0),xr.getElevationAtPixel(vr+er,hr,!0),xr.getElevationAtPixel(vr,hr+er,!0),xr.getElevationAtPixel(vr+pr,hr+er,!0)]}(G,it.x-He,it.y-dt,gt,Nt),Gt=Math.abs(Tt[0]-Tt[1]),Dt=Math.abs(Tt[2]-Tt[3]),tr=Math.abs(Tt[0]-Tt[2])+Math.abs(Tt[1]-Tt[3]),or=Math.min(.25,.5*Fe*(Gt+Dt)/gt),lr=Math.min(.25,.5*Fe*tr/Nt);return Oe+Math.max(or*Se,lr*Ne)}(v,k,I):R;return{base:R+(u===0?-1:u),top:$?Math.max(W+g,R+u+2):R+g}}class rqe{constructor(c){this._callback=c,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class nqe{constructor(){this.tasks={},this.taskQueue=[],Lt(["process"],this),this.invoker=new rqe(this.process),this.nextId=0}add(c,u){const g=this.nextId++,v=function({type:k,isSymbolTile:N,zoom:I}){return I=I||0,k==="message"?0:k!=="maybePrepare"||N?k!=="parseTile"||N?k==="parseTile"&&N?300-I:k==="maybePrepare"&&N?400-I:500:200-I:100-I}(u);if(v===0){try{c()}finally{}return null}return this.tasks[g]={fn:c,metadata:u,priority:v,id:g},this.taskQueue.push(g),this.invoker.trigger(),{cancel:()=>{delete this.tasks[g]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(g=>!!this.tasks[g]),!this.taskQueue.length)return;const c=this.pick();if(c===null)return;const u=this.tasks[c];if(delete this.tasks[c],this.taskQueue.length&&this.invoker.trigger(),!u)return;u.fn()}finally{}}pick(){let c=null,u=1/0;for(let v=0;v{g&&delete this.callbacks[I],this.target.postMessage({id:I,type:"",targetMapId:v,sourceMapId:this.mapId})}}}receive(c){const u=c.data;if(!u)return;const g=u.id;if(g&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type===""){const v=this.cancelCallbacks[g];delete this.cancelCallbacks[g],v&&v.cancel()}else if(u.mustQueue||Fs(self)){const v=this.callbacks[g],k=this.scheduler.add(()=>this.processTask(g,u),v&&v.metadata||{type:"message"});k&&(this.cancelCallbacks[g]=k)}else this.processTask(g,u)}processTask(c,u){if(delete this.cancelCallbacks[c],u.type===""){const g=this.callbacks[c];delete this.callbacks[c],g&&(u.error?g(Um(u.error)):g(null,Um(u.data)))}else{const g=new Set,v=u.hasCallback?(N,I)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:N?_p(N):null,data:_p(I,g)},g)}:()=>{},k=Um(u.data);if(this.parent[u.type])this.parent[u.type](u.sourceMapId,k,v);else if(this.parent.getWorkerSource){const N=u.type.split("."),{source:I,scope:R}=k;this.parent.getWorkerSource(u.sourceMapId,N[0],I,R)[N[1]](k,v)}else v(new Error(`Could not find function ${u.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var W5={workerUrl:"",workerClass:null,workerParams:void 0};const Uae="mapboxgl_preloaded_worker_pool";class Zv{constructor(c){this.active={},this.name=c}acquire(c,u=Zv.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Uae]}numActive(){return Object.keys(this.active).length}}Zv.workerCount=2;class NN{constructor(c,u,g="Worker",v=Zv.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=At();const k=this.workerPool.acquire(this.id,v);for(let N=0;N{this.ready=!0})}broadcast(c,u,g){_t(this.actors,(v,k)=>{v.send(c,u,k)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(c=>{c.remove()}),this.actors=[],this.workerPool.release(this.id)}}let G5,qae;function r6(){return G5||(G5=new Zv),G5}NN.Actor=Z1e;const Vae=4096;class sqe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Vae),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Vae?-1:(new Int32Array(this.module.heap32.buffer,u,c.length).set(c),u)}createFloatArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Vae?-1:(new Float32Array(this.module.heapF32.buffer,u,c.length).set(c),u)}readStringBuffer(c){let u="";for(;this.module.heapU8[c]!==0;)u+=String.fromCharCode(this.module.heapU8[c]),++c;return u}setStyle(c){const u=c.normalScale;this.module.setStyle(u[0],u[1],u[2],c.tileToMeters)}setAOOptions(c,u){this.module.setAOOptions(c?1:0,u)}setMetricOptions(c,u){this.module.setMetricOptions(c?1:0,u)}setStructuralOptions(c){this.module.setStructuralOptions(c?1:0)}setFacadeOptions(c,u){this.module.setFacadeOptions(c,u?1:0)}setFauxFacadeOptions(c,u,g){this.module.setFauxFacadeOptions(c?1:0,u?1:0,g)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,u){this.memoryStackNextFree=this.memoryStack;for(const I of c){const R=this.createIntArray(I.ringIndices),$=this.createFloatArray(I.coordinates);if(R===-1||$===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(I.id,I.sourceId,I.minHeight,I.height,I.roofType,$,R,I.ringIndices.length-1)}for(const I of u){let R;R=I.entrances?JSON.parse(I.entrances):[];const $=this.createFloatArray(R),W=this.createFloatArray(I.coordinates);if($===-1||W===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(I.sourceId,I.crossPerc,I.distanceToRoad,$,R.length,W,I.coordinates.length)}if(!this.module.generateMesh()){const I=this.module.getLastError();return this.readStringBuffer(I)}const g=this.module.getMeshCount(),v=new Array(g);for(let I=0;Iv.arrayBuffer()).then(v=>{c.buffers[u]=v})}function nve(f,c){const u=f.json.bufferViews[c];return new Uint8Array(f.buffers[u.buffer],u.byteOffset||0,u.byteLength)}function dqe(f,c,u,g){if(f.uri){const v=rve(f.uri,g);return fetch(v).then(k=>k.blob()).then(k=>createImageBitmap(k)).then(k=>{c.images[u]=k})}if(f.bufferView!==void 0){const v=nve(c,f.bufferView),k=new Blob([v],{type:f.mimeType});return createImageBitmap(k).then(N=>{c.images[u]=N})}}function sve(f,c=0,u){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===eve){const W=new Uint32Array(f,c);let G=2;const X=(W[G++]>>2)-3,te=W[G++]>>2;if(G++,g.json=JSON.parse(tve.decode(W.subarray(G,G+te))),G+=te,G{const W=[],G=I&&I.includes(Gae),X=I&&I.includes(i6);if(G&&W.push(function(){if(!Ip)return K5??(K5=function(te){let se,me=null;function Se(){se=new Uint8Array(me.buffer)}function Ne(){throw new Error("Unexpected Draco error.")}const Oe={a:{a:Ne,d:function(Fe,He,dt){return se.copyWithin(Fe,He,He+dt)},c:function(Fe){const He=se.length,dt=Math.max(Fe>>>0,Math.ceil(1.2*He)),it=Math.ceil((dt-He)/65536);try{return me.grow(it),Se(),!0}catch{return!1}},b:Ne}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(te,Oe):te.then(Fe=>Fe.arrayBuffer()).then(Fe=>WebAssembly.instantiate(Fe,Oe))).then(Fe=>{const{Rb:He,Qb:dt,P:it,T:gt,X:Nt,Ja:Tt,La:Gt,Qa:Dt,Va:tr,Wa:or,eb:lr,jb:xr,f:vr,e:hr,yb:pr,zb:er,Ab:Zt,Bb:mr,Db:Tr,Gb:jr}=Fe.instance.exports;me=hr;const hn=(()=>{let Ur=0,Zr=0,rn=0,gs=0;return kr=>{rn&&(He(gs),He(Ur),Zr+=rn,rn=Ur=0),Ur||(Zr+=128,Ur=dt(Zr));const sn=kr.length+7&-8;let qn=Ur;sn>=Zr&&(rn=sn,qn=gs=dt(sn));for(let Ds=0;Ds{Ip=te,K5=void 0}))}()),X&&W.push(function(){if(Wae)return;const te=function(se){let me;const Se=WebAssembly.instantiateStreaming(se,{}).then(Fe=>{me=Fe.instance,me.exports.__wasm_call_ctors()}),Ne={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Oe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Se,supported:!0,decodeGltfBuffer(Fe,He,dt,it,gt,Nt){(function(Tt,Gt,Dt,tr,or,lr,xr){const vr=Tt.exports.sbrk,hr=tr+3&-4,pr=vr(hr*or),er=vr(lr.length),Zt=new Uint8Array(Tt.exports.memory.buffer);Zt.set(lr,er);const mr=Gt(pr,tr,or,er,lr.length);if(mr===0&&xr&&xr(pr,hr,or),Dt.set(Zt.subarray(pr,pr+tr*or)),vr(pr-vr(0)),mr!==0)throw new Error(`Malformed buffer data: ${mr}`)})(me,me.exports[Oe[gt]],Fe,He,dt,it,me.exports[Ne[Nt]])}}}(fetch(Q1e()));return te.ready.then(()=>{Wae=te})}()),k)for(let te=0;te{if(G&&N)for(const{primitives:te}of N)for(const se of te)oqe(se,g);if(X&&N&&R)for(const te of R)lqe(te,g);return g})})}function ive(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>sve(c,0,f))}function Kae(f){switch(f){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function Zae(f){switch(f){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Yae{constructor(c,u,g,v){this.context=c,this.format=g,this.useMipmap=v&&v.useMipmap,this.texture=c.gl.createTexture(),this.update(u,{premultiply:v&&v.premultiply})}update(c,u){const g=c&&c instanceof HTMLVideoElement&&c.width===0?c.videoWidth:c.width,v=c&&c instanceof HTMLVideoElement&&c.height===0?c.videoHeight:c.height,{context:k}=this,{gl:N}=k,{x:I,y:R}=u&&u.position?u.position:{x:0,y:0},$=I+g,W=R+v;!this.size||this.size[0]===$&&this.size[1]===W||(N.bindTexture(N.TEXTURE_2D,null),N.deleteTexture(this.texture),this.texture=N.createTexture(),this.size=null),N.bindTexture(N.TEXTURE_2D,this.texture),k.pixelStoreUnpackFlipY.set(!1),k.pixelStoreUnpack.set(1),k.pixelStoreUnpackPremultiplyAlpha.set(this.format===N.RGBA8&&(!u||u.premultiply!==!1));const G=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&$>0&&W>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max($,W)))+1:1;N.texStorage2D(N.TEXTURE_2D,X,this.format,$,W),this.size=[$,W]}this.size&&(G?N.texSubImage2D(N.TEXTURE_2D,0,I,R,Kae(this.format),Zae(this.format),c):"data"in c&&c.data&&N.texSubImage2D(N.TEXTURE_2D,0,I,R,g,v,Kae(this.format),Zae(this.format),c.data)),this.useMipmap&&N.generateMipmap(N.TEXTURE_2D)}bind(c,u,g=!1){const{context:v}=this,{gl:k}=v;k.bindTexture(k.TEXTURE_2D,this.texture),c!==this.minFilter&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,c),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,this.useMipmap&&!g?c===k.NEAREST?k.NEAREST_MIPMAP_NEAREST:k.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),u!==this.wrapS&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,u),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,u),this.wrapS=u)}bindExtraParam(c,u,g,v,k){const{context:N}=this,{gl:I}=N;I.bindTexture(I.TEXTURE_2D,this.texture),u!==this.magFilter&&(I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MAG_FILTER,u),this.magFilter=u),c!==this.minFilter&&(I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MIN_FILTER,this.useMipmap?c===I.NEAREST?I.NEAREST_MIPMAP_NEAREST:I.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),g!==this.wrapS&&(I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_S,g),this.wrapS=g),v!==this.wrapT&&(I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_T,v),this.wrapT=v),k!==this.compareMode&&(k?(I.texParameteri(I.TEXTURE_2D,I.TEXTURE_COMPARE_MODE,I.COMPARE_REF_TO_TEXTURE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_COMPARE_FUNC,k)):I.texParameteri(I.TEXTURE_2D,I.TEXTURE_COMPARE_MODE,I.NONE),this.compareMode=k)}destroy(){const{gl:c}=this.context;c.deleteTexture(this.texture),this.texture=null}}class Y5{constructor(c,u){this.context=c,this.texture=u}bind(c,u){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),c!==this.minFilter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,c),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,c),this.minFilter=c),u!==this.wrapS&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,u),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,u),this.wrapS=u)}}const uqe=As([{name:"a_pos_3f",components:3,type:"Float32"}]),hqe=As([{name:"a_color_3f",components:3,type:"Float32"}]),fqe=As([{name:"a_color_4f",components:4,type:"Float32"}]),pqe=As([{name:"a_uv_2f",components:2,type:"Float32"}]),mqe=As([{name:"a_normal_3f",components:3,type:"Float32"}]),gqe=As([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),xqe=As([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function ave(f,c){const u=a6(f.projection,f.zoom,f.width,f.height),g=function(k,N,I,R,$){const W=new m(I.lng-180*Zy,I.lat),G=new m(I.lng+180*Zy,I.lat),X=k.project(W.lng,W.lat),te=k.project(G.lng,G.lat),se=-Math.atan2(te.y-X.y,te.x-X.x),me=$e.fromLngLat(I);me.y=we(me.y,-1+Zy,1-Zy);const Se=me.toLngLat(),Ne=k.project(Se.lng,Se.lat),Oe=$e.fromLngLat(Se);Oe.x+=Zy;const Fe=Oe.toLngLat(),He=k.project(Fe.lng,Fe.lat),dt=lve(He.x-Ne.x,He.y-Ne.y,se),it=$e.fromLngLat(Se);it.y+=Zy;const gt=it.toLngLat(),Nt=k.project(gt.lng,gt.lat),Tt=lve(Nt.x-Ne.x,Nt.y-Ne.y,se),Gt=Math.abs(dt.x)/Math.abs(Tt.y),Dt=A([]);H(Dt,Dt,-se*(1-($?0:R)));const tr=A([]);return z(tr,tr,[1,1-(1-Gt)*R,1]),tr[4]=-Tt.x/Tt.y*R,H(tr,tr,se),T(tr,Dt,tr),tr}(f.projection,0,f.center,u,c),v=ove(f);return z(g,g,[v,v,1]),g}function ove(f){const c=f.projection,u=a6(f.projection,f.zoom,f.width,f.height),g=Xae(c,f.center),v=Xae(c,m.convert(c.center));return Math.pow(2,g*u+(1-u)*v)}function a6(f,c,u,g,v=1/0){const k=f.range;if(!k)return 0;const N=Math.min(v,Math.max(u,g)),I=Math.log2(N/1024);return De(k[0]+I,k[1]+I,c)}const Zy=1/4e4;function Xae(f,c){const u=we(c.lat,-ce,ce),g=new m(c.lng-180*Zy,u),v=new m(c.lng+180*Zy,u),k=f.project(g.lng,u),N=f.project(v.lng,u),I=$e.fromLngLat(g),R=$e.fromLngLat(v),$=N.x-k.x,W=N.y-k.y,G=R.x-I.x,X=R.y-I.y,te=Math.sqrt((G*G+X*X)/($*$+W*W));return Math.log2(te)}function lve(f,c,u){const g=Math.cos(u),v=Math.sin(u);return{x:f*g-c*v,y:f*v+c*g}}function cve(f,c,u){A(f),H(f,f,ss(c[2])),F(f,f,ss(c[0])),q(f,f,ss(c[1])),z(f,f,u),T(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function o6(f,c,u,g,v,k,N,I){const R=[u[0]-c[0],u[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(ye(R)<1e-12||ye($)<1e-12)return It(f);const W=Je([],R,$);Re(W,W),_e($,g,c),R[2]=(k-v)*I,$[2]=(N-v)*I;const G=R;return Je(G,R,$),Re(G,G),zn(f,W,G)}function l6(f,c,u=!1){const g=Gy(c.zoom),v=function(k,N,I){const R=N.worldSize,$=[k[12],k[13],k[14]],W=le($[1]/R),G=Q($[0]/R),X=A([]),te=Y(1,W)*R,se=Y(1,0)*R*ve(W,N.zoom),me=1/Sae(R);let Se=se*me;if(I){const He=a6(N.projection,N.zoom,N.width,N.height,1024);Se=me*N.projection.pixelSpaceConversion(N.center.lat,R,He)}const Ne=Vy(W,G);de(Ne,Ne,ae([],Re([],Ne),te*Se*$[2]));const Oe=function(He){const dt=[He[0],He[1],He[2]];let it=[0,1,0];const gt=Je([],it,dt);return Je(it,dt,gt),Ie(it)===0&&(it=[0,1,0],Je(gt,dt,it)),Re(gt,gt),Re(it,it),Re(dt,dt),[gt[0],gt[1],gt[2],0,it[0],it[1],it[2],0,dt[0],dt[1],dt[2],0,He[0],He[1],He[2],1]}(Ne);z(X,X,[Se,Se,Se*te]),O(X,X,[-$[0],-$[1],-$[2]]);const Fe=T([],N.globeMatrix,Oe);return T(Fe,Fe,X),T(Fe,Fe,k),Fe}(f,c,u);if(g>0){const k=function(N,I){const R=I.worldSize,$=Y(1,0)*R*ve(I.center.lat,I.zoom)/Sae(R),W=Y(1,I.center.lat)*R,G=A([]);q(G,G,ss(I.center.lng)),F(G,G,ss(I.center.lat)),O(G,G,[0,0,mc]),z(G,G,[$,$,$*W]);const X=I.point;return O(G,G,[-X.x,-X.y,0]),T(G,G,N),T(G,I.globeMatrix,G)}(f,c);return function(N,I,R){const $=(se,me,Se)=>{const Ne=ye(se),Oe=ye(me),Fe=Ep(se,me,Se);return ae(Fe,Fe,1/ye(Fe)*Fn(Ne,Oe,Se))},W=$([N[0],N[1],N[2]],[I[0],I[1],I[2]],R),G=$([N[4],N[5],N[6]],[I[4],I[5],I[6]],R),X=$([N[8],N[9],N[10]],[I[8],I[9],I[10]],R),te=Ep([N[12],N[13],N[14]],[I[12],I[13],I[14]],R);return[W[0],W[1],W[2],0,G[0],G[1],G[2],0,X[0],X[1],X[2],0,te[0],te[1],te[2],1]}(v,k,g)}return v}function Qae(f,c,u,g){const v=dn.projectAabbCorners(g,u);let k=Number.MAX_VALUE;for(let I=0;I0||Se===0&&se[0]*me[0]+se[1]*me[1]>=0&&se[0]*se[0]+se[1]*se[1]>me[0]*me[0]+me[1]*me[1])&&(W=te)}G=W}while(G!==$);return R.length>0&&R.push(R[0]),R}(v);if(ni(f,N))return k}const Yv=64,TN={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function c6(f,c,u,g,v,k,N,I,R,$=!1){const W=u.zoom,G=u.project(g),X=ve(g.lat,W),te=1/X;A(f),O(f,f,[G.x+N[0]*te,G.y+N[1]*te,N[2]]);let se=1,me=1;const Se=u.worldSize;if($){if(u.projection.name==="mercator"){let He=0;u.elevation&&(He=u.elevation.getAtPointOrZero(new $e(G.x/Se,G.y/Se),0));const dt=wt([],[G.x,G.y,He,1],u.projMatrix)[3]/u.cameraToCenterDistance;se=dt,me=dt*ve(u.center.lat,W)}else if(u.projection.name==="globe"){const He=l6(f,u),dt=[0,0,0,1];wt(dt,dt,T([],u.projMatrix,He));const it=dt[3]/u.cameraToCenterDistance,gt=Gy(W),Nt=u.projection.pixelsPerMeter(g.lat,Se)*ve(g.lat,W),Tt=u.projection.pixelsPerMeter(u.center.lat,Se)*ve(u.center.lat,W);se=it/Fn(Nt,je(u.center.lat),gt),me=it*X/Nt,se*=Tt,me*=Tt}}else se=te;z(f,f,[se,se,me]);const Ne=[...f],Oe=c.orientation,Fe=[];if(cve(Fe,[Oe[0]+(v?v[0]:0),Oe[1]+(v?v[1]:0),Oe[2]+(v?v[2]:0)],k),T(f,Ne,Fe),I&&u.elevation){let He=0;const dt=[];if(R&&u.elevation){He=function(gt,Nt,Tt,Gt,Dt){const tr=Nt.elevation;if(!tr)return 0;const or=dn.projectAabbCorners(Tt,Gt),lr=Y(1,Dt.lat)*Nt.worldSize,xr=function(Zr,rn){const gs=[0,0,1],kr=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const sn of kr){const qn=Zr[sn.corners[0]],Ds=Zr[sn.corners[1]],Us=Zr[sn.corners[2]],rs=[Ds[0]-qn[0],Ds[1]-qn[1],rn*(Ds[2]-qn[2])],Oi=Je(rs,rs,[Us[0]-qn[0],Us[1]-qn[1],rn*(Us[2]-qn[2])]);Re(Oi,Oi),sn.dotProductWithUp=Ce(Oi,gs)}return kr.sort((sn,qn)=>sn.dotProductWithUp-qn.dotProductWithUp),kr[0].corners}(or,lr),vr=or[xr[0]],hr=or[xr[1]],pr=or[xr[2]],er=or[xr[3]],Zt=tr.getAtPointOrZero(new $e(vr[0]/Nt.worldSize,vr[1]/Nt.worldSize),0),mr=tr.getAtPointOrZero(new $e(hr[0]/Nt.worldSize,hr[1]/Nt.worldSize),0),Tr=tr.getAtPointOrZero(new $e(pr[0]/Nt.worldSize,pr[1]/Nt.worldSize),0),jr=tr.getAtPointOrZero(new $e(er[0]/Nt.worldSize,er[1]/Nt.worldSize),0),hn=(Zt+jr)/2,Ur=(mr+Tr)/2;return hn>Ur?mr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function yqe(f,c,u){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,uqe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,mqe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,pqe.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?hqe:fqe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,xqe.members,!0)),f.segments=Aa.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&X5(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&X5(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&X5(g.normalTexture,c),g.occlusionTexture&&X5(g.occlusionTexture,c,u),g.emissionTexture&&X5(g.emissionTexture,c)}function Jae(f,c,u){if(f.meshes)for(const g of f.meshes)yqe(g,c,u);if(f.children)for(const g of f.children)Jae(g,c,u)}function d6(f){if(f.meshes)for(const c of f.meshes)c.indexArray.destroy(),c.vertexArray.destroy(),c.colorArray&&c.colorArray.destroy(),c.normalArray&&c.normalArray.destroy(),c.texcoordArray&&c.texcoordArray.destroy(),c.featureArray&&c.featureArray.destroy();if(f.children)for(const c of f.children)d6(c)}function eoe(f){if(f.meshes)for(const u of f.meshes)u.vertexBuffer&&(u.vertexBuffer.destroy(),u.indexBuffer.destroy(),u.normalBuffer&&u.normalBuffer.destroy(),u.texcoordBuffer&&u.texcoordBuffer.destroy(),u.colorBuffer&&u.colorBuffer.destroy(),u.pbrBuffer&&u.pbrBuffer.destroy(),u.segments.destroy(),u.material&&((c=u.material).pbrMetallicRoughness.baseColorTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),c.pbrMetallicRoughness.metallicRoughnessTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),c.normalTexture&&c.normalTexture.gfxTexture&&c.normalTexture.gfxTexture.destroy(),c.emissionTexture&&c.emissionTexture.gfxTexture&&c.emissionTexture.gfxTexture.destroy(),c.occlusionTexture&&c.occlusionTexture.gfxTexture&&c.occlusionTexture.gfxTexture.destroy()));var c;if(f.children)for(const u of f.children)eoe(u)}function Xv(f,c){const u=f.json.bufferViews[c.bufferView],g=s6[c.componentType];return new g(f.buffers[u.buffer],(c.byteOffset||0)+(u.byteOffset||0),c.count*(u.byteStride&&u.byteStride!==Z5[c.type]*g.BYTES_PER_ELEMENT?u.byteStride/g.BYTES_PER_ELEMENT:Z5[c.type]))}function toe(f,c,u,g){const v=s6[c.componentType],k=function(W){switch(W){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(v),N=f.json.bufferViews[c.bufferView],I=N.byteStride?N.byteStride/v.BYTES_PER_ELEMENT:Z5[c.type],R=u.float32,$=R.length/u.capacity;for(let W=0,G=0;W0){for(let Se=0;Se0){k.texcoordArray=new vf;const X=c.json.accessors[v.TEXCOORD_0];k.texcoordArray.resize(X.count);const te=Xv(c,X);toe(c,X,k.texcoordArray,te)}if(v._FEATURE_ID_RGBA4444!==void 0){const X=c.json.accessors[v._FEATURE_ID_RGBA4444];c.json.extensionsUsed&&c.json.extensionsUsed.includes("EXT_meshopt_compression")&&(k.featureData=Xv(c,X))}v._FEATURE_RGBA4444!==void 0&&(k.featureData=new Uint32Array(Xv(c,c.json.accessors[v._FEATURE_RGBA4444]).buffer));const G=f.material;return k.material=function(X,te){const{emissiveFactor:se=[0,0,0],alphaMode:me="OPAQUE",alphaCutoff:Se=.5,normalTexture:Ne,occlusionTexture:Oe,emissiveTexture:Fe,doubleSided:He,name:dt}=X,{baseColorFactor:it=[1,1,1,1],metallicFactor:gt=1,roughnessFactor:Nt=1,baseColorTexture:Tt,metallicRoughnessTexture:Gt}=X.pbrMetallicRoughness||{},Dt=Oe?te[Oe.index]:void 0;if(Oe&&Oe.extensions&&Oe.extensions.KHR_texture_transform&&Dt){const tr=Oe.extensions.KHR_texture_transform;Dt.offsetScale=[tr.offset[0],tr.offset[1],tr.scale[0],tr.scale[1]]}return{name:dt,pbrMetallicRoughness:{baseColorFactor:new wi(...it),metallicFactor:gt,roughnessFactor:Nt,baseColorTexture:Tt?te[Tt.index]:void 0,metallicRoughnessTexture:Gt?te[Gt.index]:void 0},doubleSided:He,emissiveFactor:new wi(...se),alphaMode:me,alphaCutoff:Se,normalTexture:Ne?te[Ne.index]:void 0,occlusionTexture:Dt,emissionTexture:Fe?te[Fe.index]:void 0,defined:X.defined===void 0}}(G!==void 0?c.json.materials[G]:{defined:!1},u),k}function uve(f,c,u){const{matrix:g,rotation:v,translation:k,scale:N,mesh:I,extras:R,children:$,name:W}=f,G={};if(G.name=W,G.localMatrix=g||function(X,te,se,me){var Se=te[0],Ne=te[1],Oe=te[2],Fe=te[3],He=Se+Se,dt=Ne+Ne,it=Oe+Oe,gt=Se*He,Nt=Se*dt,Tt=Se*it,Gt=Ne*dt,Dt=Ne*it,tr=Oe*it,or=Fe*He,lr=Fe*dt,xr=Fe*it,vr=me[0],hr=me[1],pr=me[2];return X[0]=(1-(Gt+tr))*vr,X[1]=(Nt+xr)*vr,X[2]=(Tt-lr)*vr,X[3]=0,X[4]=(Nt-xr)*hr,X[5]=(1-(gt+tr))*hr,X[6]=(Dt+or)*hr,X[7]=0,X[8]=(Tt+lr)*pr,X[9]=(Dt-or)*pr,X[10]=(1-(gt+Gt))*pr,X[11]=0,X[12]=se[0],X[13]=se[1],X[14]=se[2],X[15]=1,X}([],v||[0,0,0,1],k||[0,0,0],N||[1,1,1]),G.globalMatrix=C(G.localMatrix),I!==void 0){G.meshes=u[I];const X=G.anchor=[0,0];for(const te of G.meshes){const{min:se,max:me}=te.aabb;X[0]+=se[0]+me[0],X[1]+=se[1]+me[1]}X[0]=Math.floor(X[0]/G.meshes.length/2),X[1]=Math.floor(X[1]/G.meshes.length/2)}if(R&&(R.id&&(G.id=R.id),R.lights&&(G.lights=function(X){if(!X.length)return[];const te=function(Oe){const Fe=atob(Oe),He=new Uint8Array(Fe.length);for(let dt=0;dt1&&g[g.length-1].equals(g[0])&&g.pop();let v=0;for(let N=0;N0&&g.reverse();const k=jN(g.flatMap(N=>[N.x,N.y]),[]);return k.length===0?null:{vertices:g,indices:k}}function wqe(f,c){const u=[],g=[];let v=0;const k=[];for(const N of f){v=u.length;const I=N.vertexArray.float32,R=N.indexArray.uint16;for(let $=0;$0&&([g[N+1],g[N+2]]=[g[N+2],g[N+1]])}return{vertices:u,indices:g}}function roe(f){const c=function(R,$){const W=[],G=WebGL2RenderingContext;if(R.json.textures)for(const X of R.json.textures){const te={magFilter:G.LINEAR,minFilter:G.NEAREST,wrapS:G.REPEAT,wrapT:G.REPEAT};X.sampler!==void 0&&Object.assign(te,R.json.samplers[X.sampler]),W.push({image:$[X.source],sampler:te,uploaded:!1})}return W}(f,f.images),u=function(R,$){const W=[];for(const G of R.json.meshes){const X=[];for(const te of G.primitives)X.push(vqe(te,R,$));W.push(X)}return W}(f,c),{scenes:g,scene:v,nodes:k}=f.json,N=g?g[v||0].nodes:[...k.keys()],I=[];for(const R of N)I.push(uve(k[R],f,u));return function(R,$,W){const G={},X=new Set;for(let te=0;te0){const te=Array.from(X.values()).sort((se,me)=>se-me);for(let se=te.length-1;se>=0;se--)R.splice(te[se],1)}}(I,N,f.json.nodes),I}function jqe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const c=f.vertexArray.float32,u=f.aabb.min[0]-1,g=f.aabb.min[1]-1,v=Yv/(f.aabb.max[0]-u+2),k=Yv/(f.aabb.max[1]-g+2);for(let N=0;Nf.heightmap[$*Yv+R]&&(f.heightmap[$*Yv+R]=I)}}function hve(f,c,u,g,v){u.reserve(u.length+4*f.length),g.reserve(g.length+10*f.length),v.reserve(v.length+10*f.length);let k=g.length;for(const N of f){const I=Math.min(10,Math.max(4,1.3*N.height))*c,R=[-N.normal[1],N.normal[0],0],$=Math.min(.29,.1*N.width/N.depth),W=N.width-2*N.depth*c*($+.01),G=ge([],N.pos,R,W/2),X=ge([],N.pos,R,-W/2),te=[G[0],G[1],G[2]+N.height],se=[X[0],X[1],X[2]+N.height],me=ge([],N.normal,R,$);ae(me,me,I);const Se=ge([],N.normal,R,-$);ae(Se,Se,I),de(me,G,me),de(Se,X,Se),G[2]+=.1,X[2]+=.1,g.emplaceBack(me[0],me[1],me[2]),g.emplaceBack(Se[0],Se[1],Se[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(te[0],te[1],te[2]),g.emplaceBack(se[0],se[1],se[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(me[0],me[1],me[2]),g.emplaceBack(Se[0],Se[1],Se[2]);const Ne=W/I/2;v.emplaceBack(-Ne-$,-1,Ne,.8),v.emplaceBack(Ne+$,-1,Ne,.8),v.emplaceBack(-Ne,0,Ne,1.3),v.emplaceBack(Ne,0,Ne,1.3),v.emplaceBack(Ne+$,-.8,Ne,.7),v.emplaceBack(Ne+$,-.8,Ne,.7),v.emplaceBack(0,0,Ne,1.3),v.emplaceBack(0,0,Ne,1.3),v.emplaceBack(Ne+$,-1.2,Ne,.8),v.emplaceBack(Ne+$,-1.2,Ne,.8),u.emplaceBack(6+k,4+k,8+k),u.emplaceBack(7+k,9+k,5+k),u.emplaceBack(0+k,1+k,2+k),u.emplaceBack(1+k,3+k,2+k),k+=10}}function kqe(f,c){const u={};u.indexArray=new Bo,u.vertexArray=new cu,u.colorArray=new Vm,hve(f,c,u.indexArray,u.vertexArray,u.colorArray);const g={defined:!0};g.emissiveFactor=wi.black;const v={};return v.baseColorFactor=wi.white,g.pbrMetallicRoughness=v,u.material=g,u.aabb=new dn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),u}const fve=As([{name:"a_pos_3f",components:3,type:"Float32"}]),Nqe=As([{name:"a_normal_3",components:3,type:"Int16"}]),Sqe=As([{name:"a_centroid_3",components:3,type:"Int16"}]),pve=As([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),Cqe=As([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),Mqe=As([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),Tqe=As([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),Aqe=As([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),Eqe=As([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),mve=Pt.types,u6=32767;function Iqe(f,c){const u=Mr+c;for(const g of f)for(const v of g)if(v.x<-c||v.x>u||v.y<-c||v.y>u)return!1;return!0}function Pqe(f){switch(f){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${f}`)}}class noe{constructor(){this.layoutVertexArray=new cu,this.layoutAttenuationArray=new Vm,this.layoutColorArray=new du,this.indexArray=new Bo,this.indexArrayForConflation=new Bo,this.segmentsBucket=new Aa}}class soe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Aa,this.entranceBloom=new noe;const u=66560;this.layoutVertexArray=new cu,this.layoutVertexArray.reserve(u),this.layoutNormalArray=new Fy,this.layoutNormalArray.reserve(u),this.layoutCentroidArray=new Fy,this.layoutCentroidArray.reserve(u),this.layoutColorArray=new du,this.layoutColorArray.reserve(u),this.layoutFloodLightDataArray=new Hm,this.layoutFloodLightDataArray.reserve(u),this.layoutAOArray=new uN,this.layoutAOArray.reserve(u),this.indexArray=new Bo,this.indexArray.reserve(66560),this.indexArrayForConflation=new Bo,this.segmentsBucket=new Aa,this.entranceBloom=new noe,c&&(this.layoutFacadePaintArray=new du,this.layoutFacadeDataArray=new sx,this.layoutFacadeVerticalRangeArray=new du)}reserve(c,u,g){this.layoutVertexArray.reserveForAdditional(c),this.layoutCentroidArray.reserveForAdditional(c),this.layoutFloodLightDataArray.reserveForAdditional(c),this.layoutNormalArray.reserveForAdditional(c),this.layoutAOArray.reserveForAdditional(c),this.layoutColorArray.reserveForAdditional(c),this.indexArray.reserveForAdditional(u),g&&(this.layoutFacadePaintArray.reserveForAdditional(c),this.layoutFacadeDataArray.reserveForAdditional(c),this.layoutFacadeVerticalRangeArray.reserveForAdditional(c))}}class gve{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new vf,this.footprintsIndices=new Hm,this.footprintsMin=new ir(1/0,1/0),this.footprintsMax=new ir(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new soe(!1),this.buildingWithFacade=new soe(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=c.zoom,this.canonical=c.canonical,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.worldview=c.worldview,this.lut=c.lut,this.programConfigurations=new Th(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.groundEffect=new Bae(c),this.groundEffect.groundRadiusArray=new kp,this.hasAppearances=null}updateFootprints(c,u){const g=new YP([],[],1),v={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};u.push({footprint:v,id:c})}updateAppearances(c,u,g,v){}prepare(){return function(){if(n6!=null||Y1e!=null)return null;if(MN!=null)return MN;const c=fetch(Cs.BUILDING_GEN_URL);return MN=function(u){let g,v,k,N,I;function R(){g=new Uint8Array(I.buffer),v=new Int16Array(I.buffer),k=new Int32Array(I.buffer),N=new Float32Array(I.buffer)}function $(){throw new Error("Unexpected BuildingGen error.")}const W=()=>{},G={a:{a:$,f:function(X){const te=g.length,se=Math.max(X>>>0,Math.ceil(1.2*te)),me=Math.ceil((se-te)/65536);try{return I.grow(me),R(),!0}catch{return!1}},g:$,b:W,c:W,d:W,e:W}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(u,G):u.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,G))).then(X=>{const te=X.instance.exports;return(0,te.g)(),I=te.f,R(),new sqe({setStyle:te.h,setAOOptions:te.i,setMetricOptions:te.j,setStructuralOptions:te.k,setFacadeOptions:te.l,setFauxFacadeOptions:te.m,setFacadeClassifierOptions:te.n,addFeature:te.o,addFacade:te.p,generateMesh:te.q,getLastError:te.r,getOuterRingLength:te.s,getMeshCount:te.t,getPositionsPtr:te.u,getPositionsLength:te.v,getNormalsPtr:te.w,getNormalsLength:te.x,getAOPtr:te.y,getAOLength:te.z,getUVPtr:te.A,getUVLength:te.B,getFauxFacadePtr:te.C,getFauxFacadeLength:te.D,getIndicesPtr:te.E,getIndicesLength:te.F,getBuildingPart:te.G,getRingCount:te.H,getRingPtr:te.I,getRingLength:te.J,malloc:te.K,free:te.L,heapU8:g,heap16:v,heap32:k,heapF32:N})})}(c).then(u=>(MN=null,n6=u,n6)).catch(u=>{Vr("Could not load building-gen"),MN=null,Y1e=u}),MN}()}populate(c,u,g,v){const k=iqe();if(!k)return;const N=Pe(g);this.tileToMeter=N,this.brightness=u.brightness,k.setStyle({normalScale:[1,-1,N],tileToMeters:N}),k.setAOOptions(!1,.3),k.setMetricOptions(!1,16),k.setStructuralOptions(!0),k.setFacadeClassifierOptions(3);const I=new Map,R=new Map;let $=0;for(const{feature:Ne}of c){if(mve[Ne.type]!=="LineString"){I.set(Ne.id,Ne.properties.source_id);continue}const Oe=this.layers[0]._featureFilter.needGeometry;if(Oe&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),Ne,g))continue;const Fe=Ot(Ne,Oe);if(!Oe&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),Fe,g))continue;const He=Oe?Fe.geometry:bt(Ne,g,v),dt=[];for(const Tt of He)for(const Gt of Tt)dt.push(Gt.x),dt.push(Gt.y);const it={coordinates:dt,crossPerc:Ne.properties.cross_perc,distanceToRoad:Ne.properties.distance_to_road,entrances:Ne.properties.entrances,sourceId:0},gt=Ne.properties.source_id;let Nt=R.get(gt);Nt||(Nt=[],R.set(gt,Nt)),Nt.push(it),++$}this.maxHeight=0;const W=new Array,G=new Set,X=Ne=>{Ne!=null&&G.add(Ne)},te=(Ne,Oe)=>{Ne!=null&&W.push({buildingId:Ne,footprintIndex:Oe})},se=64*(c.length-$),me=se/2;this.buildingWithFacade.reserve(se,me,!0),this.buildingWithoutFacade.reserve(2*se,2*me,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:Ne,id:Oe,index:Fe,sourceLayerIndex:He}of c){if(mve[Ne.type]==="LineString")continue;const dt=this.layers[0]._featureFilter.needGeometry;if(dt&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),Ne,g))continue;let it=null;if(Ne.properties&&Ne.properties.hasOwnProperty("building_id")&&(it=Ne.properties.building_id,G.has(it)))continue;const gt=Ot(Ne,dt);if(!dt&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),gt,g))continue;const Nt=dt?gt.geometry:bt(Ne,g,v),Tt=B5(Nt,500);let Gt=!1;for(const Pn of Tt)if(Pn.length!==1){Gt=!0;break}if(Gt){X(it);continue}if(!Iqe(Nt,163)){X(it);continue}const Dt=this.layers[0],tr=Pqe(Dt.layout.get("building-roof-shape").evaluate(Ne,{},g)),or=Dt.layout.get("building-base").evaluate(Ne,{},g),lr=Dt.layout.get("building-height").evaluate(Ne,{},g),xr=Dt.layout.get("building-flood-light-ground-radius").evaluate(Ne,{},g),vr=Dt.paint.get("building-ambient-occlusion-intensity"),hr=xr/this.tileToMeter;Ne.properties["building-part"]="roof";const pr=Dt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),er=Dt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="wall";const Zt=Dt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),mr=Dt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="window";const Tr=Dt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),jr=Dt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="door";const hn=Dt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),Ur=Dt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);let Zr=Dt.layout.get("building-flood-light-wall-radius").evaluate(Ne,{},g);Zr=we(Zr,0,2048);const rn=Zr/2048*u6,gs=I.get(Oe),kr=R.get(gs)||[],sn=kr.length!==0&&Dt.layout.get("building-facade").evaluate(Ne,{},g);k.setFacadeOptions(4,!0),k.setFauxFacadeOptions(sn,!1,1);let qn=0,Ds=0,Us=0,rs=0,Oi=0,at=0,ut=0,nr=0,yr=0,Dr=0,Rr=0;if(sn){let Pn=Math.round(Dt.layout.get("building-facade-floors").evaluate(Ne,{},g));if(or===0){Pn=Math.max(1,Pn-(kr.length>0?1:0));let Ni=4;if(lr>100){const ya=[10,13,15];Ni=ya[Ne.id?Ne.id%ya.length:0]}else lr<=10&&(Ni=3);k.setFacadeOptions(Ni,!0),Oi=(lr<15?1.3:1.61803)*Ni/N}else Oi=or/N;at=lr/N,Oi=Math.min(Oi,at),Us=Dt.layout.get("building-facade-unit-width").evaluate(Ne,{},g)/N,rs=(at-Oi)/Pn,k.setFauxFacadeOptions(!0,!0,Us);const Pa=Dt.layout.get("building-facade-window").evaluate(Ne,{},g);qn=Pa[0],Ds=Pa[1],ut=Math.floor(65535*Math.min(1,Oi/Mr)),nr=Math.floor(65535*Math.min(1,at/Mr)),yr=Math.floor(255*qn)<<8|Math.floor(255*Ds),Dr=Math.floor(65535*Math.min(1,Us/Mr)),Rr=Math.floor(65535*Math.min(1,rs/Mr))}const pn=Array(Tt.length),xn={x:1/0,y:1/0},Jn={x:-1/0,y:-1/0},cs={x:0,y:0};let ps=0;for(let Pn=0;Pn0){const Ni=[],ya=Array(Pa.length+1);ya[0]=0;for(let qo=0;qoMr||xn.y<0||Jn.y>Mr)&&this.featuresOnBorder.push({featureId:Ne.id,footprintIndex:this.footprints.length});{const Pn=jN(Bi,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Pn.length),this.footprintsIndices.uint16.set(Pn,In),this.buildingIds.add(it??Ne.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Yi.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Yi.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ea.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ea.y);const Pa={footprintVertexOffset:Is,footprintVertexLength:this.footprintsVertices.length-Is,footprintIndexOffset:In,footprintIndexLength:this.footprintsIndices.length-In,min:Yi,max:ea,hiddenFlags:0,indicesOffset:yi,indicesLength:ka,bloomIndicesOffset:ki,bloomIndicesLength:Hi,groundEffectVertexOffset:oo,groundEffectVertexLength:Xi,hasFauxFacade:sn,height:ds,promoteId:Oe,feature:gt,parts:ai,buildingBloom:oi},Ni=this.footprints.length;Ne.id!==void 0&&this.featureFootprintLookup.set(Ne.id,Ni),te(it,Ni),this.footprints.push(Pa)}this.programConfigurations.populatePaintArrays(Ln.layoutVertexArray.length,Ne,Fe,{},u.availableImages,g,u.brightness),this.groundEffect.addPaintPropertiesData(Ne,Fe,{},u.availableImages,g,u.brightness),u.featureIndex.insert(Ne,Nt,Fe,He,this.index,Di)}W.forEach(({buildingId:Ne,footprintIndex:Oe})=>{G.has(Ne)&&(this.footprints[Oe].hiddenFlags|=4)});const Se=new Set;this.buildingIds.forEach((Ne,Oe,Fe)=>{G.has(Ne)||Se.add(Ne)}),this.buildingIds=Se,this.groundEffect.prepareBorderSegments()}update(c,u,g,v,k,N,I){this.programConfigurations.updatePaintArrays(c,u,k,g,v,N,I),this.groundEffect.update(c,u,k,g,v,N,I),this.evaluate(this.layers[0],c),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(c){const u=g=>{g.layoutVertexBuffer=c.createVertexBuffer(g.layoutVertexArray,fve.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,Nqe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,Sqe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,Eqe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,Mqe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,Tqe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,fve.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,Aqe.members)),this.uploadUpdatedColorBuffer(c),this.uploadUpdatedIndexBuffer(c)};this.uploaded||(u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){const c=u=>{u.layoutVertexBuffer&&(u.layoutVertexBuffer.destroy(),u.layoutNormalBuffer.destroy(),u.layoutColorBuffer.destroy(),u.segmentsBucket.destroy(),u.indexBuffer&&u.indexBuffer.destroy(),u.entranceBloom.layoutVertexBuffer&&(u.entranceBloom.layoutVertexBuffer.destroy(),u.entranceBloom.layoutColorBuffer.destroy(),u.entranceBloom.layoutAttenuationBuffer.destroy(),u.entranceBloom.indexBuffer.destroy(),u.entranceBloom.segmentsBucket.destroy()))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(c,u,g=!0){let v=!1;const k=g?u:0,N=0|(g?-1:~u);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const I of c){const R=this.footprints[I],$=R.hiddenFlags&N|k;R.hiddenFlags!==$&&(R.hiddenFlags=$,v=!0,this.groundEffect.updateHiddenByLandmarkRange(R.groundEffectVertexOffset,R.groundEffectVertexLength,R.hiddenFlags!==0))}return v&&(this.indexArrayForConflationUploaded=!1),v}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const u=v=>{v.indexArray.length!==0&&(v.indexArrayForConflation.resize(v.indexArray.length),v.indexArrayForConflation.uint16.set(v.indexArray.uint16),v.entranceBloom.indexArrayForConflation.resize(v.entranceBloom.indexArray.length),v.entranceBloom.indexArrayForConflation.uint16.set(v.entranceBloom.indexArray.uint16))};u(this.buildingWithoutFacade),u(this.buildingWithFacade);for(const v of this.footprints){const k=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,N=v.indicesOffset+v.indicesLength;if(v.hiddenFlags!==0){for(let R=v.indicesOffset;R{v.indexArray.length!==0&&(v.indexBuffer?v.indexBuffer.updateData(v.indexArrayForConflation):v.indexBuffer=c.createIndexBuffer(v.indexArrayForConflation,!0),v.entranceBloom.indexBuffer?v.entranceBloom.indexBuffer.updateData(v.entranceBloom.indexArrayForConflation):v.entranceBloom.indexBuffer=c.createIndexBuffer(v.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(c){const u=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=c.createVertexBuffer(g.layoutColorArray,pve.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,Cqe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,pve.members,!0)};u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,u){const g=c.paint.get("building-ambient-occlusion-intensity");for(const v of this.footprints){if(4&v.hiddenFlags)continue;const k=u[v.promoteId],N=v.feature;N.properties["building-part"]="roof";const I=c.paint.get("building-color").evaluate(N,k,this.canonical).toPremultipliedRenderColor(this.lut),R=c.paint.get("building-emissive-strength").evaluate(N,k,this.canonical);N.properties["building-part"]="wall";const $=c.paint.get("building-color").evaluate(N,k,this.canonical).toPremultipliedRenderColor(this.lut),W=c.paint.get("building-emissive-strength").evaluate(N,k,this.canonical);N.properties["building-part"]="window";const G=c.paint.get("building-color").evaluate(N,k,this.canonical).toPremultipliedRenderColor(this.lut),X=c.paint.get("building-emissive-strength").evaluate(N,k,this.canonical);N.properties["building-part"]="door";const te=c.paint.get("building-color").evaluate(N,k,this.canonical).toPremultipliedRenderColor(this.lut),se=c.paint.get("building-emissive-strength").evaluate(N,k,this.canonical),me=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const Ne of v.parts){let Oe,Fe=I;Ne.part===1?(Fe=I,Oe=R):Ne.part===0?(Fe=$,Oe=W):Ne.part===2?(Fe=G,Oe=X):Ne.part===3&&(Fe=te,Oe=se),Oe=we(Oe,0,1);for(let He=0;HeN.max.x||R.max.xN.max.y||R.max.yI.max.x||I.min.x>c||u>I.max.y||I.min.y>u||I.height<=g||Lqe(N,this.footprintsVertices.float32.subarray(2*I.footprintVertexOffset,2*(I.footprintVertexOffset+I.footprintVertexLength)),this.footprintsIndices.uint16.subarray(I.footprintIndexOffset,I.footprintIndexOffset+I.footprintIndexLength))&&(g=I.height,this.footprintLookup[k]=I,v=I.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.footprintLookup[k]=void 0}}function Lqe(f,c,u){for(let g=0;g1&&(R=c[++I]);const W=Math.abs($-R.left),G=Math.abs($-R.right),X=Math.min(W,G);let te;const se=k/g*(v+1);if(R.isDash){const me=v-Math.abs(se);te=Math.sqrt(X*X+me*me)}else te=v-Math.sqrt(X*X+se*se);this.image.data[N+$]=Math.max(0,Math.min(255,te+128))}}}addRegularDash(c,u){for(let R=c.length-1;R>=0;--R){const $=c[R],W=c[R+1];$.zeroLength?c.splice(R,1):W&&W.isDash===$.isDash&&(W.left=$.left,c.splice(R,1))}const g=c[0],v=c[c.length-1];g.isDash===v.isDash&&(g.left=v.left-this.width,v.right=g.right+this.width);const k=this.width*this.nextRow;let N=0,I=c[N];for(let R=0;R1&&(I=c[++N]);const $=Math.abs(R-I.left),W=Math.abs(R-I.right),G=Math.min($,W);this.image.data[k+R]=Math.max(0,Math.min(255,(I.isDash?G:-G)+u+128))}}addDash(c,u){const g=this.getKey(c,u);if(this.positions[g])return this.positions[g];const v=u==="round",k=v?7:0,N=2*k+1;if(this.nextRow+N>this.height)return Vr("LineAtlas out of space"),null;c.length===0&&c.push(1);let I=0;for(let W=0;Wu.fqid),this.index=c.index,this.projection=c.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(u=>{this.gradients[u.id]={}}),this.layoutVertexArray=new sN,this.layoutVertexArray2=new cu,this.patternVertexArray=new cu,this.indexArray=new Bo,this.programConfigurations=new Th(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Aa,this.maxLineLength=0,this.zOffsetVertexArray=new cu,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Mr/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Eae("line",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Pe(g);const N=this.layers[0].layout.get("line-elevation-reference");if(N==="hd-road-markup")this.elevationType="road";else{const X=this.layers[0].layout.get("line-z-offset"),te=X.isConstant()&&!X.constantOr(0);this.elevationType=N!=="sea"&&N!=="ground"&&te?"none":"offset",this.elevationType==="offset"&&N==="none"&&Vr(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const I=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&I!==void 0;const R=[];for(const{feature:X,id:te,index:se,sourceLayerIndex:me}of c){const Se=this.layers[0]._featureFilter.needGeometry,Ne=Ot(X,Se);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),Ne,g))continue;const Oe=k?k.evaluate(Ne,{},g):void 0,Fe={id:te,properties:X.properties,type:X.type,sourceLayerIndex:me,index:se,geometry:Se?Ne.geometry:bt(X,g,v),patterns:{},sortKey:Oe};R.push(Fe)}k&&R.sort((X,te)=>X.sortKey-te.sortKey);const{lineAtlas:$,featureIndex:W}=u,G=this.addConstantDashes($);for(const X of R){const{geometry:te,index:se,sourceLayerIndex:me}=X;if(G&&this.addFeatureDashes(X,$),this.hasPattern){const Se=Iae("line",this.layers,X,this.zoom,this.pixelRatio,u);this.patternFeatures.push(Se)}else this.addFeature(X,te,se,g,$.positions,u.availableImages,u.brightness,u.elevationFeatures);W.insert(c[se].feature,te,se,me,this.index)}}addConstantDashes(c){let u=!1;for(const g of this.layers){const v=g.paint.get("line-dasharray").value,k=g.layout.get("line-cap").value;if(v.kind!=="constant"||k.kind!=="constant")u=!0;else{const N=k.value,I=v.value;if(!I)continue;c.addDash(I,N)}}return u}addFeatureDashes(c,u){const g=this.zoom;for(const v of this.layers){const k=v.paint.get("line-dasharray").value,N=v.layout.get("line-cap").value;if(k.kind==="constant"&&N.kind==="constant")continue;let I,R;if(k.kind==="constant"){if(I=k.value,!I)continue}else I=k.evaluate({zoom:g},c);R=N.kind==="constant"?N.value:N.evaluate({zoom:g},c),u.addDash(I,R),c.patterns[v.id]=[u.getKey(I,R)]}}update(c,u,g,v,k,N,I,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,N,I,R)}addFeatures(c,u,g,v,k,N){for(const I of this.patternFeatures)this.addFeature(I,I.geometry,I.index,u,g,v,N,c.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=c.createVertexBuffer(this.layoutVertexArray2,Bqe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,Uqe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,Rqe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,Fqe),this.indexBuffer=c.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(c,u){let g,v;if(u&&u>0?(g=`mapbox_clip_start_${u}`,v=`mapbox_clip_end_${u}`):(g="mapbox_clip_start",v="mapbox_clip_end"),c.properties&&c.properties.hasOwnProperty(g)&&c.properties.hasOwnProperty(v))return{start:+c.properties[g],end:+c.properties[v]}}addFeature(c,u,g,v,k,N,I,R){const $=this.layers[0].layout,W=$.get("line-join").evaluate(c,{}),G=$.get("line-cap").evaluate(c,{}),X=$.get("line-miter-limit"),te=$.get("line-round-limit");this.lineClips=this.lineFeatureClips(c),this.lineFeature=c;const se=!(!c.properties||!c.properties.hasOwnProperty("mapbox_line_metrics"))&&c.properties.mapbox_line_metrics;this.zOffsetValue=$.get("line-z-offset").value;const me=this.layers[0].paint.get("line-width").value;if(me.kind!=="constant"&&me.isLineProgressConstant===!1&&(this.variableWidthValue=me),this.elevationType==="road"){const Se=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,u,v,R,W,G,X,te)){const[Ne,Oe]=this.clipRuntimeLinesToTile(u,1);for(let Fe=0;Fe0?dt.parentIndex:null)}this.fillNonElevatedRoadSegment(Se)}}else for(let Se=0;Se0?Se:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,k,N,v,I,void 0,this.worldview)}computeSegNextDir(c,u){return c.nextPoint.sub(u.at(-2)).unit()}computeSegPrevDir(c,u){return u[1].sub(c.prevPoint).unit()}clipLinesToTile(c,u){return t6(c,-u,-u,Mr+u,Mr+u)}clipRuntimeLinesToTile(c,u){const g=[];return[t6(c,-u,-u,Mr+u,Mr+u,g),g]}addElevatedRoadFeature(c,u,g,v,k,N,I,R){const $=[],W=gi.getElevationFeature(c,v);if(W){const G=this.clipLinesToTile(u,1),X=this.prepareElevatedLines(G,W,g);for(const te of X)$.push({geometry:te,elevation:W,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if($.length===0)return!1;for(const G of $){const X=this.layoutVertexArray.length;this.addLine(G.geometry,c,g,k,N,I,R);const te=new Li(g,G.elevationTileID);if(G.elevation)for(let se=X;se>1,this.layoutVertexArray.int16[6*se+1]>>1),Se=te.pointElevation(me,G.elevation,.05);this.updateHeightRange(Se),this.zOffsetVertexArray.emplaceBack(Se,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(c,u,g){if(u.constantHeight!=null)return c;const v=[],k=1/Pe(g);for(const N of c)tqe(N,new ii(u,k),0,v);return v}fillNonElevatedRoadSegment(c){for(let u=c;u0,X=R&&R.progress.max<1;if(this.lineClips){let Tt={min:this.lineClips.start,max:this.lineClips.end},Gt=1;if(R){const or=this.lineClips.end-this.lineClips.start;Tt=function(lr,xr,vr){return{min:zi(lr.min,xr,vr),max:zi(lr.max,xr,vr)}}(R.progress,{min:0,max:1},Tt),or>0&&(Gt=(Tt.max-Tt.min)/or)}const Dt=+u.properties.mapbox_clip_feature_len,tr=+u.properties.mapbox_clip_seg_len;if(Number.isNaN(Dt)||Number.isNaN(tr)){for(let lr=0;lr=2&&c[se-1].equals(c[se-2]);)se--;let me=0;for(;me0,er=this.overscaling<=16?15*Mr/(512*this.overscaling):0;if(Gt&&Dt==="round"){if(xrN&&(Dt="bevel"),Dt==="bevel"&&(xr>2&&(Dt="flipbevel"),xr2*er){const Tr=Ne.sub(Ne.sub(Oe)._mult(er/Zt)._round());this.updateDistance(Oe,Tr),this.addCurrentVertex(Tr,He,0,0,Se,Nt),Oe=Tr}this.updateDistance(Oe,Ne),or._mult(xr),this.addCurrentVertex(Ne,or,0,0,Se,Nt);const mr=Ne.dist(Fe);if(mr>2*er){const Tr=Ne.add(Fe.sub(Ne)._mult(er/mr)._round());this.updateDistance(Ne,Tr),this.addCurrentVertex(Tr,dt,0,0,Se,Nt),Ne=Tr}}else or._mult(xr),this.addCurrentVertex(Ne,or,0,0,Se,Nt);else if(Dt==="flipbevel"){if(xr>100)or=dt.mult(-1);else{const Zt=xr*He.add(dt).mag()/He.sub(dt).mag();or._perp()._mult(Zt*(pr?-1:1))}this.addCurrentVertex(Ne,or,0,0,Se,Nt),this.addCurrentVertex(Ne,or.mult(-1),0,0,Se,Nt)}else if(Dt==="bevel"||Dt==="fakeround"){Nt!=null&&Oe&&this.addCurrentVertex(Ne,gt||He,-1,-1,Se,Nt);const Zt=Ne.dist(Oe)<=2*er&&Dt!=="bevel",mr=or.mult(pr?1:-1);mr._mult(xr);const Tr=dt.mult(pr?-1:1),jr=He.mult(pr?-1:1),hn=this.evaluateLineProgressFeatures(this.distance);if(Nt==null&&(this.addHalfVertex(Ne,mr.x,mr.y,!1,!pr,0,Se,hn),Zt||this.addHalfVertex(Ne,mr.x+2*jr.x,mr.y+2*jr.y,!1,pr,0,Se,hn)),Dt==="fakeround"){const Ur=Math.round(180*vr/Math.PI/20);this.addHalfVertex(Ne,jr.x,jr.y,!1,pr,0,Se,hn);for(let Zr=0;Zr1){this.lineSoFar=c.w;const me=(u.x-c.x)/G,Se=(u.y-c.y)/G,Ne=(u.z-c.z)/G,Oe=(u.w-c.w)/G;for(let Fe=1;Fe=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,W),R.primitiveLength++),N?this.e2=W:this.e1=W,$!=null&&this.zOffsetVertexArray.emplaceBack($.zOffset,$.variableWidth,$.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(c,u){this.prevDistance=this.distance,this.distance+=c.dist(u),this.updateScaledDistance()}}function aoe(f,c,u){return f.xu||f.yu}let _ve,bve;function wve(f,c,u){return c*(Mr/(f.tileSize*Math.pow(2,u-f.tileID.overscaledZ)))}Qr(ioe,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const jve=(f,c,u)=>(1-u)*f+u*c;function kve(f,c){return 1/wve(f,1,c.tileZoom)}function Nve(f,c,u,g){return f.translatePosMatrix(g||c.tileID.projMatrix,c,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const Sve=f=>{const c=[];Cve(f)&&c.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const u=f.paint.get("line-trim-offset");u[0]===0&&u[1]===0||c.push("RENDER_LINE_TRIM_OFFSET"),f.paint.get("line-border-width").constantOr(1)!==0&&c.push("RENDER_LINE_BORDER");const g=f.layout.get("line-join").constantOr("miter")==="none",v=!!f.paint.get("line-pattern").constantOr(1);return g&&v&&c.push("LINE_JOIN_NONE"),c};function Cve(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let ooe;const Mve=()=>ooe||(ooe={layout:_ve||(_ve=new $a({"line-cap":new Lr(Rt.layout_line["line-cap"]),"line-join":new Lr(Rt.layout_line["line-join"]),"line-miter-limit":new Nr(Rt.layout_line["line-miter-limit"]),"line-round-limit":new Nr(Rt.layout_line["line-round-limit"]),"line-sort-key":new Lr(Rt.layout_line["line-sort-key"]),"line-z-offset":new Lr(Rt.layout_line["line-z-offset"]),"line-elevation-reference":new Nr(Rt.layout_line["line-elevation-reference"]),"line-cross-slope":new Nr(Rt.layout_line["line-cross-slope"]),visibility:new Nr(Rt.layout_line.visibility),"line-width-unit":new Nr(Rt.layout_line["line-width-unit"])})),paint:bve||(bve=new $a({"line-opacity":new Lr(Rt.paint_line["line-opacity"]),"line-color":new Lr(Rt.paint_line["line-color"]),"line-translate":new Nr(Rt.paint_line["line-translate"]),"line-translate-anchor":new Nr(Rt.paint_line["line-translate-anchor"]),"line-width":new Lr(Rt.paint_line["line-width"]),"line-gap-width":new Lr(Rt.paint_line["line-gap-width"]),"line-offset":new Lr(Rt.paint_line["line-offset"]),"line-blur":new Lr(Rt.paint_line["line-blur"]),"line-dasharray":new Lr(Rt.paint_line["line-dasharray"]),"line-pattern":new Lr(Rt.paint_line["line-pattern"]),"line-pattern-cross-fade":new Nr(Rt.paint_line["line-pattern-cross-fade"]),"line-gradient":new tx(Rt.paint_line["line-gradient"]),"line-trim-offset":new Nr(Rt.paint_line["line-trim-offset"]),"line-trim-fade-range":new Nr(Rt.paint_line["line-trim-fade-range"]),"line-trim-color":new Nr(Rt.paint_line["line-trim-color"]),"line-emissive-strength":new Lr(Rt.paint_line["line-emissive-strength"]),"line-border-width":new Lr(Rt.paint_line["line-border-width"]),"line-border-color":new Lr(Rt.paint_line["line-border-color"]),"line-occlusion-opacity":new Nr(Rt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"})}))},ooe);class Wqe extends Lr{possiblyEvaluate(c,u){return u=new Ji(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,transition:u.transition,worldview:u.worldview}),super.possiblyEvaluate(c,u)}evaluate(c,u,g,v){return u=Object.assign({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(c,u,g,v)}}let Q5;function Tve(f,c){return c>0?c+2*f:f}const Gqe=As([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Kqe=As([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Zqe=As([{name:"a_projected_pos",components:4,type:"Float32"}],4);As([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Yqe=As([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Xqe=As([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Qqe=As([{name:"a_texb",components:2,type:"Uint16"}]),Jqe=As([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),eVe=As([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);As([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ave=As([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tVe=As([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);As([{name:"triangle",components:3,type:"Uint16"}]),As([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),As([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),As([{type:"Float32",name:"offsetX"}]),As([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var gl=24;function rVe(f,c,u){return f.sections.forEach(g=>{g.text=function(v,k,N){const I=k.layout.get("text-transform").evaluate(N,{});return I==="uppercase"?v=v.toLocaleUpperCase():I==="lowercase"&&(v=v.toLocaleLowerCase()),jp.applyArabicShaping&&(v=jp.applyArabicShaping(v)),v}(g.text,c,u)}),f}const J5={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function nVe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function sVe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const loe=4294967296,Eve=1/loe,Ive=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let h6=class{constructor(f=new Uint8Array(16)){this.buf=ArrayBuffer.isView(f)?f:new Uint8Array(f),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(f,c,u=this.length){for(;this.pos>3,k=this.pos;this.type=7&g,f(v,c,this),this.pos===k&&this.skip(g)}return c}readMessage(f,c){return this.readFields(f,c,this.readVarint()+this.pos)}readFixed32(){const f=this.dataView.getUint32(this.pos,!0);return this.pos+=4,f}readSFixed32(){const f=this.dataView.getInt32(this.pos,!0);return this.pos+=4,f}readFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*loe;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*loe;return this.pos+=8,f}readFloat(){const f=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,f}readDouble(){const f=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,f}readVarint(f){const c=this.buf;let u,g;return g=c[this.pos++],u=127&g,g<128?u:(g=c[this.pos++],u|=(127&g)<<7,g<128?u:(g=c[this.pos++],u|=(127&g)<<14,g<128?u:(g=c[this.pos++],u|=(127&g)<<21,g<128?u:(g=c[this.pos],u|=(15&g)<<28,function(v,k,N){const I=N.buf;let R,$;if($=I[N.pos++],R=(112&$)>>4,$<128||($=I[N.pos++],R|=(127&$)<<3,$<128)||($=I[N.pos++],R|=(127&$)<<10,$<128)||($=I[N.pos++],R|=(127&$)<<17,$<128)||($=I[N.pos++],R|=(127&$)<<24,$<128)||($=I[N.pos++],R|=(1&$)<<31,$<128))return AN(v,R,k);throw new Error("Expected varint not more than 10 bytes")}(u,f,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const f=this.readVarint();return f%2==1?(f+1)/-2:f/2}readBoolean(){return!!this.readVarint()}readString(){const f=this.readVarint()+this.pos,c=this.pos;return this.pos=f,f-c>=12&&Ive?Ive.decode(this.buf.subarray(c,f)):function(u,g,v){let k="",N=g;for(;N239?4:I>223?3:I>191?2:1;if(N+X>v)break;X===1?I<128&&(G=I):X===2?(R=u[N+1],(192&R)==128&&(G=(31&I)<<6|63&R,G<=127&&(G=null))):X===3?(R=u[N+1],$=u[N+2],(192&R)==128&&(192&$)==128&&(G=(15&I)<<12|(63&R)<<6|63&$,(G<=2047||G>=55296&&G<=57343)&&(G=null))):X===4&&(R=u[N+1],$=u[N+2],W=u[N+3],(192&R)==128&&(192&$)==128&&(192&W)==128&&(G=(15&I)<<18|(63&R)<<12|(63&$)<<6|63&W,(G<=65535||G>=1114112)&&(G=null))),G===null?(G=65533,X=1):G>65535&&(G-=65536,k+=String.fromCharCode(G>>>10&1023|55296),G=56320|1023&G),k+=String.fromCharCode(G),N+=X}return k}(this.buf,c,f)}readBytes(){const f=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,f);return this.pos=f,c}readPackedVarint(f=[],c){const u=this.readPackedEnd();for(;this.pos127;);else if(c===2)this.pos=this.readVarint()+this.pos;else if(c===5)this.pos+=4;else{if(c!==1)throw new Error(`Unimplemented type: ${c}`);this.pos+=8}}writeTag(f,c){this.writeVarint(f<<3|c)}realloc(f){let c=this.length||16;for(;c268435455||f<0?function(c,u){let g,v;if(c>=0?(g=c%4294967296|0,v=c/4294967296|0):(g=~(-c%4294967296),v=~(-c/4294967296),4294967295^g?g=g+1|0:(g=0,v=v+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),function(k,N,I){I.buf[I.pos++]=127&k|128,k>>>=7,I.buf[I.pos++]=127&k|128,k>>>=7,I.buf[I.pos++]=127&k|128,k>>>=7,I.buf[I.pos++]=127&k|128,I.buf[I.pos]=127&(k>>>=7)}(g,0,u),function(k,N){const I=(7&k)<<4;N.buf[N.pos++]|=I|((k>>>=3)?128:0),k&&(N.buf[N.pos++]=127&k|((k>>>=7)?128:0),k&&(N.buf[N.pos++]=127&k|((k>>>=7)?128:0),k&&(N.buf[N.pos++]=127&k|((k>>>=7)?128:0),k&&(N.buf[N.pos++]=127&k|((k>>>=7)?128:0),k&&(N.buf[N.pos++]=127&k)))))}(v,u)}(f,this):(this.realloc(4),this.buf[this.pos++]=127&f|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=f>>>7&127))))}writeSVarint(f){this.writeVarint(f<0?2*-f-1:2*f)}writeBoolean(f){this.writeVarint(+f)}writeString(f){f=String(f),this.realloc(4*f.length),this.pos++;const c=this.pos;this.pos=function(g,v,k){for(let N,I,R=0;R55295&&N<57344){if(!I){N>56319||R+1===v.length?(g[k++]=239,g[k++]=191,g[k++]=189):I=N;continue}if(N<56320){g[k++]=239,g[k++]=191,g[k++]=189,I=N;continue}N=I-55296<<10|N-56320|65536,I=null}else I&&(g[k++]=239,g[k++]=191,g[k++]=189,I=null);N<128?g[k++]=N:(N<2048?g[k++]=N>>6|192:(N<65536?g[k++]=N>>12|224:(g[k++]=N>>18|240,g[k++]=N>>12&63|128),g[k++]=N>>6&63|128),g[k++]=63&N|128)}return k}(this.buf,f,this.pos);const u=this.pos-c;u>=128&&Pve(c,u,this),this.pos=c-1,this.writeVarint(u),this.pos+=u}writeFloat(f){this.realloc(4),this.dataView.setFloat32(this.pos,f,!0),this.pos+=4}writeDouble(f){this.realloc(8),this.dataView.setFloat64(this.pos,f,!0),this.pos+=8}writeBytes(f){const c=f.length;this.writeVarint(c),this.realloc(c);for(let u=0;u=128&&Pve(u,g,this),this.pos=u-1,this.writeVarint(g),this.pos+=g}writeMessage(f,c,u){this.writeTag(f,2),this.writeRawMessage(c,u)}writePackedVarint(f,c){c.length&&this.writeMessage(f,iVe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,aVe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,cVe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,oVe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,lVe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,dVe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,uVe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,hVe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,fVe,c)}writeBytesField(f,c){this.writeTag(f,2),this.writeBytes(c)}writeFixed32Field(f,c){this.writeTag(f,5),this.writeFixed32(c)}writeSFixed32Field(f,c){this.writeTag(f,5),this.writeSFixed32(c)}writeFixed64Field(f,c){this.writeTag(f,1),this.writeFixed64(c)}writeSFixed64Field(f,c){this.writeTag(f,1),this.writeSFixed64(c)}writeVarintField(f,c){this.writeTag(f,0),this.writeVarint(c)}writeSVarintField(f,c){this.writeTag(f,0),this.writeSVarint(c)}writeStringField(f,c){this.writeTag(f,2),this.writeString(c)}writeFloatField(f,c){this.writeTag(f,5),this.writeFloat(c)}writeDoubleField(f,c){this.writeTag(f,1),this.writeDouble(c)}writeBooleanField(f,c){this.writeVarintField(f,+c)}};function AN(f,c,u){return u?4294967296*c+(f>>>0):4294967296*(c>>>0)+(f>>>0)}function Pve(f,c,u){const g=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));u.realloc(g);for(let v=u.pos-1;v>=f;v--)u.buf[v+g]=u.buf[v]}function iVe(f,c){for(let u=0;u=0&&g>=c&&f6[this.text.charCodeAt(g)];g--)u--;this.text=this.text.substring(c,u),this.sectionIndex=this.sectionIndex.slice(c,u)}substring(c,u){const g=new EN;return g.text=this.text.substring(c,u),g.sectionIndex=this.sectionIndex.slice(c,u),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((c,u)=>Math.max(c,this.sections[u].scale),0)}addTextSection(c,u){this.text+=c.text,this.sections.push(eM.forText(c.scale,c.fontStack||u));const g=this.sections.length-1;for(let v=0;v=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function doe(f,c,u,g,v,k,N,I,R,$,W,G,X,te,se,me=1){const Se=EN.fromFeature(f,v,me);G===fu.vertical&&Se.verticalizePunctuation(X);let Ne=[];const Oe=function(gt,Nt,Tt,Gt,Dt,tr){if(!gt)return[];const or=[],lr=function(pr,er,Zt,mr,Tr,jr){let hn=0;for(let Ur=0;Ur=0;let vr=0;for(let pr=0;pr0&&oi>rs&&(rs=oi)}else{const ti=Tt[yr.fontStack];if(!ti)continue;ti[Rr]&&(Jn=ti[Rr]);const ai=Nt[yr.fontStack];if(!ai)continue;const oi=ai.glyphs[Rr];if(!oi)continue;if(xn=oi.metrics,ps=Rr!==8203?gl:0,jr){const ki=ai.ascender!==void 0?Math.abs(ai.ascender):0,Hi=ai.descender!==void 0?Math.abs(ai.descender):0,Di=(ki+Hi)*pn;Oi-u/2;){if(N--,N<0)return!1;I-=f[N].dist(k),k=f[N]}I+=f[N].dist(f[N+1]),N++;const R=[];let $=0;for(;Ig;)$-=R.shift().angleDelta;if($>v)return!1;N++,I+=W.dist(G)}return!0}function Vve(f){let c=0;for(let u=0;u$){const se=($-R)/te,me=Fn(G.x,X.x,se),Se=Fn(G.y,X.y,se),Ne=new cx(me,Se,0,X.angleTo(G),W);return!N||qve(f,Ne,I,N,c)?Ne:void 0}R+=te}}function _Ve(f,c,u,g,v,k,N,I,R){const $=Hve(g,k,N),W=Wve(g,v),G=W*N,X=f[0].x===0||f[0].x===R||f[0].y===0||f[0].y===R;return c-G=0&&He=0&&dt=0&&X+$<=W){const it=new cx(He,dt,0,Oe,se);g&&!qve(f,it,k,g,v)||te.push(it)}}G+=Ne}return I||te.length||N||(te=Gve(f,G/2,u,g,v,k,N,!0,R)),te}function Kve(f){let c=0,u=0;for(const N of f)c+=N.w*N.h,u=Math.max(u,N.w);f.sort((N,I)=>I.h-N.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),u),h:1/0}];let v=0,k=0;for(const N of f)for(let I=g.length-1;I>=0;I--){const R=g[I];if(!(N.w>R.w||N.h>R.h)){if(N.x=R.x,N.y=R.y,k=Math.max(k,N.y+N.h),v=Math.max(v,N.x+N.w),N.w===R.w&&N.h===R.h){const $=g.pop();$&&I1?se-1:se,yc.copy(G.data,$,{x:0,y:0},{x:me,y:Se},G.data,g),yc.copy(G.data,$,{x:0,y:Oe-se},{x:me,y:Se-se},{width:Ne,height:se},g),yc.copy(G.data,$,{x:0,y:0},{x:me,y:Se+Oe},{width:Ne,height:se},g),yc.copy(G.data,$,{x:Ne-se,y:0},{x:me-se,y:Se},{width:se,height:Oe},g),yc.copy(G.data,$,{x:0,y:0},{x:me+Ne,y:Se},{width:se,height:Oe},g),yc.copy(G.data,$,{x:Ne-se,y:Oe-se},{x:me-se,y:Se-se},{width:se,height:se},g),yc.copy(G.data,$,{x:0,y:Oe-se},{x:me+Ne,y:Se-se},{width:se,height:se},g),yc.copy(G.data,$,{x:0,y:0},{x:me+Ne,y:Se+Oe},{width:se,height:se},g),yc.copy(G.data,$,{x:Ne-se,y:0},{x:me-se,y:Se+Oe},{width:se,height:se},g)}this.lut=g,this.image=$,this.iconPositions=v,this.patternPositions=k}addImages(c,u,g,v){for(const[k,N]of c.entries()){const{bin:I,imagePosition:R,imageVariant:$}=moe(k,N,g);u.set(k,R),v.push(I),N.hasRenderCallback&&this.haveRenderCallbacks.push($.id)}}patchUpdatedImages(c,u,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(v=>c.hasImage(v,g)),c.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const v of c.getUpdatedImages(g)){for(const k of this.iconPositions.keys()){const N=gp.parse(k);if(Ic.isEqual(N.id,v)){const I=c.getImage(v,g);this.patchUpdatedImage(this.iconPositions.get(k),I,u,null)}}for(const k of this.patternPositions.keys()){const N=gp.parse(k);if(Ic.isEqual(N.id,v)){const I=c.getImage(v,g);this.patchUpdatedImage(this.patternPositions.get(k),I,u,this.lut)}}}}patchUpdatedImage(c,u,g,v=null){if(!c||!u||c.version===u.version)return;c.version=u.version;const[k,N]=c.tl,I=c.sdf;if(this.lut||I){const R={width:u.data.width,height:u.data.height},$=new yc(R);yc.copy(u.data,$,{x:0,y:0},{x:0,y:0},R,v,I),g.update($,{position:{x:k,y:N}})}else g.update(u.data,{position:{x:k,y:N}})}}Qr(tM,"ImagePosition"),Qr(Zve,"ImageAtlas");const rM=1e20;function Yve(f,c,u,g,v,k,N,I,R){for(let $=c;$-1);R++,k[R]=I,N[R]=$,N[R+1]=rM}for(let I=0,R=0;I{let R=this.entries[k];R||(R=this.entries[k]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let $=R.glyphs[N];if($!==void 0)return void I(null,{stack:k,id:N,glyph:$});if($=this._tinySDF(R,k,N),$)return R.glyphs[N]=$,void I(null,{stack:k,id:N,glyph:$});const W=Math.floor(N/256);if(256*W>65535)return Vr("glyphs > 65535 not supported"),void I(null,{stack:k,id:N,glyph:$});if(R.ranges[W])return void I(null,{stack:k,id:N,glyph:$});let G=R.requests[W];G||(G=R.requests[W]=[],LN.loadGlyphRange(k,W,v,this.requestManager,(X,te)=>{if(te){R.ascender=te.ascender,R.descender=te.descender;for(const se in te.glyphs)this._doesCharSupportLocalGlyph(+se)||(R.glyphs[+se]=te.glyphs[+se]);R.ranges[W]=!0}for(const se of G)se(X,te);delete R.requests[W]})),G.push((X,te)=>{X?I(X):te&&I(null,{stack:k,id:N,glyph:te.glyphs[N]||null})})},(k,N)=>{if(k)u(k);else if(N){const I={};for(const{stack:R,id:$,glyph:W}of N)I[R]===void 0&&(I[R]={}),I[R].glyphs===void 0&&(I[R].glyphs={}),I[R].glyphs[$]=W&&{id:W.id,bitmap:W.bitmap.clone(),metrics:W.metrics},I[R].ascender=this.entries[R].ascender,I[R].descender=this.entries[R].descender;u(null,I)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==goe.none&&(this.localGlyphMode===goe.all?!!this.localFontFamily:!!this.localFontFamily&&(Tn["CJK Unified Ideographs"](c)||Tn["Hangul Syllables"](c)||Tn.Hiragana(c)||Tn.Katakana(c)||Tn["CJK Symbols and Punctuation"](c)||Tn["CJK Unified Ideographs Extension A"](c)||Tn["CJK Unified Ideographs Extension B"](c)||Tn.Osage(c)))}_tinySDF(c,u,g){const v=this.localFontFamily;if(!v||!this._doesCharSupportLocalGlyph(g))return;let k=c.tinySDF;if(!k){let me="400";/bold/i.test(u)?me="900":/medium/i.test(u)?me="500":/light/i.test(u)&&(me="200"),k=c.tinySDF=new LN.TinySDF({fontFamily:v,fontWeight:me,fontSize:24*Lp,buffer:3*Lp,radius:8*Lp}),k.fontWeight=me}if(this.localGlyphs[k.fontWeight][g])return this.localGlyphs[k.fontWeight][g];const N=String.fromCodePoint(g),{data:I,width:R,height:$,glyphWidth:W,glyphHeight:G,glyphLeft:X,glyphTop:te,glyphAdvance:se}=k.draw(N);return this.localGlyphs[k.fontWeight][g]={id:g,bitmap:new Ky({width:R,height:$},I),metrics:{width:W/Lp,height:G/Lp,left:X/Lp,top:te/Lp-27,advance:se/Lp,localGlyph:!0}}}}LN.loadGlyphRange=function(f,c,u,g,v){const k=256*c,N=k+255,I=g.transformRequest(g.normalizeGlyphsURL(u).replace("{fontstack}",f).replace("{range}",`${k}-${N}`),qg.Glyphs);Hu(I,(R,$)=>{if(R)v(R);else if($){const W={},G=function(X){return new h6(X).readFields(pVe,{})}($);for(const X of G.glyphs)W[X.id]=X;v(null,{glyphs:W,ascender:G.ascender,descender:G.descender})}})},LN.TinySDF=class{constructor({fontSize:f=24,buffer:c=3,radius:u=8,cutoff:g=.25,fontFamily:v="sans-serif",fontWeight:k="normal",fontStyle:N="normal",lang:I=null}={}){this.buffer=c,this.cutoff=g,this.radius=u,this.lang=I;const R=this.size=f+4*c,$=this._createCanvas(R),W=this.ctx=$.getContext("2d",{willReadFrequently:!0});W.font=`${N} ${k} ${f}px ${v}`,W.textBaseline="alphabetic",W.textAlign="left",W.fillStyle="black",this.gridOuter=new Float64Array(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Uint16Array(R)}_createCanvas(f){const c=document.createElement("canvas");return c.width=c.height=f,c}draw(f){const{width:c,actualBoundingBoxAscent:u,actualBoundingBoxDescent:g,actualBoundingBoxLeft:v,actualBoundingBoxRight:k}=this.ctx.measureText(f),N=Math.ceil(u),I=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(k-v))),R=Math.min(this.size-this.buffer,N+Math.ceil(g)),$=I+2*this.buffer,W=R+2*this.buffer,G=Math.max($*W,0),X=new Uint8ClampedArray(G),te={data:X,width:$,height:W,glyphWidth:I,glyphHeight:R,glyphTop:N,glyphLeft:0,glyphAdvance:c};if(I===0||R===0)return te;const{ctx:se,buffer:me,gridInner:Se,gridOuter:Ne}=this;this.lang&&(se.lang=this.lang),se.clearRect(me,me,I,R),se.fillText(f,me,me+N);const Oe=se.getImageData(me,me,I,R);Ne.fill(rM,0,G),Se.fill(0,0,G);for(let Fe=0;Fe0?gt*gt:0,Se[it]=gt<0?gt*gt:0}}Yve(Ne,0,0,$,W,$,this.f,this.v,this.z),Yve(Se,me,me,I,R,$,this.f,this.v,this.z);for(let Fe=0;Fe{const xr=g6(Dt.stretch-Oe,Fe,W,f.left*v),vr=x6(Dt.fixed-it,gt,Dt.stretch,se),hr=g6(tr.stretch-He,dt,G,f.top*v),pr=x6(tr.fixed-Nt,Tt,tr.stretch,me),er=g6(or.stretch-Oe,Fe,W,f.left*v),Zt=x6(or.fixed-it,gt,or.stretch,se),mr=g6(lr.stretch-He,dt,G,f.top*v),Tr=x6(lr.fixed-Nt,Tt,lr.stretch,me),jr=new ir(xr,hr),hn=new ir(er,hr),Ur=new ir(er,mr),Zr=new ir(xr,mr),rn=new ir(vr/I,pr/I),gs=new ir(Zt/I,Tr/I),kr=c*Math.PI/180;if(kr){const Oi=Math.sin(kr),at=Math.cos(kr),ut=[at,-Oi,Oi,at];jr._matMult(ut),hn._matMult(ut),Zr._matMult(ut),Ur._matMult(ut)}const sn=Dt.stretch+Dt.fixed,qn=or.stretch+or.fixed,Ds=tr.stretch+tr.fixed,Us=lr.stretch+lr.fixed,rs=f.imageSecondary;return{tl:jr,tr:hn,bl:Zr,br:Ur,texPrimary:{x:N.paddedRect.x+Zm+sn,y:N.paddedRect.y+Zm+Ds,w:qn-sn,h:Us-Ds},texSecondary:rs?{x:rs.paddedRect.x+Zm+sn,y:rs.paddedRect.y+Zm+Ds,w:qn-sn,h:Us-Ds}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:rn,pixelOffsetBR:gs,minFontScaleX:gt/I/W,minFontScaleY:Tt/I/G,isSDF:u}};if(g&&(N.stretchX||N.stretchY)){const Dt=Jve(X,Se,se),tr=Jve(te,Ne,me);for(let or=0;ork)&&(k=se.x),(!te||se.y>N)&&(N=se.y)}const R=Math.min(k-g,N-v);let $=R/2;const W=new kk([],kVe);if(R===0)return new ir(g,v);for(let te=g;teG.d||!G.d)&&(G=te,u&&console.log("found best %d after %d probes",Math.round(1e4*te.d)/1e4,X)),te.max-G.d<=c||($=te.h/2,W.push(new ON(te.p.x-$,te.p.y-$,$,f)),W.push(new ON(te.p.x+$,te.p.y-$,$,f)),W.push(new ON(te.p.x-$,te.p.y+$,$,f)),W.push(new ON(te.p.x+$,te.p.y+$,$,f)),X+=4)}return u&&(console.log(`num probes: ${X}`),console.log(`best distance: ${G.d}`)),G.p}function kVe(f,c){return c.max-f.max}class ON{constructor(c,u,g,v){this.p=new ir(c,u),this.h=g,this.d=function(k,N){let I=!1,R=1/0;for(let $=0;$k.y!=me.y>k.y&&k.x<(me.x-se.x)*(k.y-se.y)/(me.y-se.y)+se.x&&(I=!I),R=Math.min(R,eo(k,se,me))}}return(I?1:-1)*Math.sqrt(R)}(this.p,v),this.max=this.d+this.h*Math.SQRT2}}const NVe=Object.keys,yoe=Number.POSITIVE_INFINITY,SVe=Math.sqrt(2);function Yy(f,c,u,g,v){const k=hoe(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],N={top:f.top-k[1],bottom:f.bottom+k[3],left:f.left-k[0],right:f.right+k[2],scaled:!1};return g!==void 0&&function(I,R){I.top*=R,I.bottom*=R,I.left*=R,I.right*=R,I.scaled=!0}(N,g),u&&function(I,R){if(!R)return;const $=ss(R),W=new ir(I.left,I.top),G=new ir(I.right,I.top),X=new ir(I.left,I.bottom),te=new ir(I.right,I.bottom),se=new ir(0,0);W._rotateAround($,se),G._rotateAround($,se),X._rotateAround($,se),te._rotateAround($,se),I.left=Math.min(W.x,G.x,X.x,te.x),I.right=Math.max(W.x,G.x,X.x,te.x),I.top=Math.min(W.y,G.y,X.y,te.y),I.bottom=Math.max(W.y,G.y,X.y,te.y)}(N,u),v&&(N.left+=v[0],N.right+=v[0],N.top+=v[1],N.bottom+=v[1]),c?{top:Math.min(c.top,N.top),bottom:Math.max(c.bottom,N.bottom),left:Math.min(c.left,N.left),right:Math.max(c.right,N.right),scaled:c.scaled||N.scaled}:N}function t_e(f,[c,u]){let g=0,v=0;if(u===yoe){c<0&&(c=0);const k=c/SVe;switch(f){case"top-right":case"top-left":v=k-7;break;case"bottom-right":case"bottom-left":v=7-k;break;case"bottom":v=7-c;break;case"top":v=c-7}switch(f){case"top-right":case"bottom-right":g=-k;break;case"top-left":case"bottom-left":g=k;break;case"left":g=c;break;case"right":g=-c}}else{switch(c=Math.abs(c),u=Math.abs(u),f){case"top-right":case"top-left":case"top":v=u-7;break;case"bottom-right":case"bottom-left":case"bottom":v=7-u}switch(f){case"top-right":case"bottom-right":case"right":g=-c;break;case"top-left":case"bottom-left":case"left":g=c}}return[g,v]}function CVe(f,c,u,g,v,k,N,I,R,$,W,G,X,te){const se=f.layers[0],me=se.appearances;if(me.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Se={iconBBox:null,iconVerticalBBox:null},Ne={textBBox:null,textVerticalBBox:null},{baseIconRotate:Oe,baseTextRotate:Fe,iconScaleFactor:He}=function(it,gt,Nt){const Tt=it.get("icon-rotate").evaluate(gt,{},Nt),Gt=it.get("text-rotate").evaluate(gt,{},Nt),[Dt,tr]=it.get("icon-size-scale-range");return{baseIconRotate:Tt,baseTextRotate:Gt,iconScaleFactor:we(1,Dt,tr)}}(g,v,k);c&&(Se.iconBBox=Yy(c,Se.iconBBox,Oe,N),u)&&(Se.iconVerticalBBox=Yy(u,Se.iconVerticalBBox,Oe+90,N));const dt=v6(G.horizontal);dt&&(Ne.textBBox=Yy(dt,Ne.textBBox,Fe,1,te)),G.vertical&&(Ne.textVerticalBBox=Yy(G.vertical,Ne.textVerticalBBox,Fe+90,1,te));for(const it of me)it.hasIconProperties()&&MVe(Se,f,se,it,v,k,I,Oe,N,R,c,$,He,W),it.hasTextProperties()&&TVe(Ne,se,it,v,k,te,Fe,X,dt,G.vertical);return{iconBBox:Se.iconBBox,iconVerticalBBox:Se.iconVerticalBBox,textBBox:Ne.textBBox,textVerticalBBox:Ne.textVerticalBBox}}function MVe(f,c,u,g,v,k,N,I,R,$,W,G,X,te){const{appearanceIconOffset:se,appearanceIconRotate:me,appearanceIconSize:Se}=function(He,dt,it,gt,Nt,Tt,Gt,Dt){const tr=He.hasProperty("icon-offset")?dt.getAppearanceValueAndResolveTokens(He,"icon-offset",it,gt,[]):null,or=tr&&Array.isArray(tr)?tr:Nt,lr=He.hasProperty("icon-rotate")?dt.getAppearanceValueAndResolveTokens(He,"icon-rotate",it,gt,[]):null,xr=typeof lr=="number"?lr:Tt,vr=He.hasProperty("icon-size")?dt.getAppearanceValueAndResolveTokens(He,"icon-size",it,gt,[]):null;return{appearanceIconOffset:or,appearanceIconRotate:xr,appearanceIconSize:typeof vr=="number"?vr*Dt.iconScaleFactor:Gt}}(g,u,v,k,N,I,R,$);let Ne=null,Oe=null,Fe=null;g.hasProperty("icon-image")?Fe=function(He,dt,it,gt,Nt,Tt,Gt){let Dt=null;const tr=dt.getAppearanceValueAndResolveTokens(it,"icon-image",gt,Nt,[]);if(tr){const or=He.getResolvedImageFromTokens(tr),lr=it.getUnevaluatedProperty("icon-size"),xr=nM(or,IN(He.zoom,lr,He.worldview),lr,Nt,He.zoom,gt,He.pixelRatio,Gt,He.worldview);Dt=Tt.get(xr.iconPrimary.toString())}return Dt}(c,u,g,v,k,G,X):W&&(Fe=W.imagePrimary),Fe&&(Ne=p6(Fe,null,se,te),c.allowVerticalPlacement&&(Oe=p6(Fe,null,se,te))),Ne&&(f.iconBBox=Yy(Ne,f.iconBBox,me,Se)),Oe&&(f.iconVerticalBBox=Yy(Oe,f.iconVerticalBBox,me+90,Se))}function TVe(f,c,u,g,v,k,N,I,R,$){const{appearanceTextOffset:W,appearanceTextRotate:G,appearanceTextSize:X}=function(se,me,Se,Ne,Oe,Fe,He){const dt=se.hasProperty("text-offset")?me.getAppearanceValueAndResolveTokens(se,"text-offset",Se,Ne,[]):null,it=dt&&Array.isArray(dt)?[dt[0]*gl,dt[1]*gl]:Oe,gt=se.hasProperty("text-rotate")?me.getAppearanceValueAndResolveTokens(se,"text-rotate",Se,Ne,[]):null,Nt=typeof gt=="number"?gt:Fe,Tt=se.hasProperty("text-size")?me.getAppearanceValueAndResolveTokens(se,"text-size",Se,Ne,[]):null;return{appearanceTextOffset:it,appearanceTextRotate:Nt,appearanceTextSize:typeof Tt=="number"?Tt:He}}(u,c,g,v,k,N,I),te=X/I;R&&(f.textBBox=Yy(R,f.textBBox,G,te,W)),$&&(f.textVerticalBBox=Yy($,f.textVerticalBBox,G+90,te,W))}function y6(f,c,u,g,v,k,N,I,R){if(!c||!c.usvg)return;const $=Uve(g),W=Uve(v),G=k!=="both"&&k!=="width"||!Bve(g)?1:W.width/$.width,X=k!=="both"&&k!=="height"||!$ve(g)?1:W.height/$.height;u.scaleSelf(G,X);const te=u.toString();N.set(te,u),I.set(te,c);const{imagePosition:se}=moe(te,c,Qv);R.set(te,se)}function r_e(f,c,u,g,v,k,N,I,R){if(!f)return;const $=function(W,G,X,te,se,me){if(W.kind==="camera")return W.maxSize;if(W.kind==="composite"){const Se=G.possiblyEvaluate(new Ji(W.maxZoom,{worldview:me}),X).evaluate(se,{},X),Ne=G.possiblyEvaluate(new Ji(W.minZoom,{worldview:me}),X).evaluate(se,{},X);return Math.max(Se,Ne)}return G.possiblyEvaluate(new Ji(te,{worldview:me})).evaluate(se,{},X)}(c,u,g,v,k,R);return f.scaleSelf($*I*N)}function nM(f,c,u,g,v,k,N,I,R){return{iconPrimary:r_e(f.getPrimary(),c,u,g,v,k,N,I,R),iconSecondary:r_e(f.getSecondary(),c,u,g,v,k,N,I,R)}}function AVe(f,c,u){if(!c)return;const g=u.get(f.toString()),v=u.get(c.toString());g&&v&&(g.paddedRect.w===v.paddedRect.w&&g.paddedRect.h===v.paddedRect.h||Vr(`Mismatch in icon variant sizes: ${f.toString()} and ${c.toString()}`),g.usvg!==v.usvg&&Vr(`Mismatch in icon variant image types: ${f.id} and ${c.id}`))}function n_e(f,c,u,g){if(!f)return;const v=c.get(u.toString());if(f.imagePrimary=v,g){const k=c.get(g.toString());f.imageSecondary=k}}function EVe(f,c){for(const u in f.horizontal)s_e(f.horizontal[u],c);s_e(f.vertical,c)}function s_e(f,c){if(f){for(const u of f.positionedLines)for(const g of u.positionedGlyphs)if(g.image!==null){const v=g.image.toString();g.rect=c.get(v).paddedRect}}}function voe(f){switch(f){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function IVe(f,c,u,g,v,k,N,I,R){const $=v6(k.horizontal)||k.vertical,W=u.get("icon-text-fit-padding").evaluate(g,{},v);let G,X=c;return c&&R!=="none"&&(f.allowVerticalPlacement&&k.vertical&&(G=foe(c,k.vertical,R,W,I,N)),$&&(X=foe(c,$,R,W,I,N))),{defaultShapedIcon:X,verticallyShapedIcon:G}}function PVe(f,c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe,Fe,He,dt,it,gt){let Nt=N.textMaxSize.evaluate(c,{},X);Nt===void 0?Nt=I*N.textScaleFactor:Nt*=N.textScaleFactor;const Tt=f.layers[0].layout,Gt=gl,Dt=I*N.textScaleFactor/Gt,tr=v6(u.horizontal)||u.vertical;if(Se!=="none"&&f.appearanceFeatureData&&c.index18&&mr>2&&(mr>>=1),Math.max(Mr/(512*mr),1)*Tt.get("symbol-spacing")),vr=Tt.get("text-padding")*f.tilePixelRatio,hr=Tt.get("icon-padding")*f.tilePixelRatio,pr=ss(Tt.get("text-max-angle")),er=Tt.get("icon-rotation-alignment")==="map"&&Fe!=="point",Zt=xr/2;var mr;f.hasAnyIconTextFit===!1&&Se!=="none"&&(f.hasAnyIconTextFit=!0);const Tr=c.properties?+c.properties[Yt]:null,jr=Tr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Tr):65535,hn=(Ur,Zr,rn)=>{if(Zr.x<0||Zr.x>=Mr||Zr.y<0||Zr.y>=Mr)return;let gs=null;if(or){const{x:kr,y:sn,z:qn}=te.projectTilePoint(Zr.x,Zr.y,rn);gs={anchor:new cx(kr,sn,qn,0,void 0),up:te.upVector(rn,Zr.x,Zr.y)}}(function(kr,sn,qn,Ds,Us,rs,Oi,at,ut,nr,yr,Dr,Rr,pn,xn,Jn,cs,ps,Es,Ln,Un,ti,ai,oi,ki,Hi,Di,hi,yi,ds,Bs,ka,In){const Is=kr.addToLineVertexArray(sn,Ds);let Bi,Yi,ea,oo,Xi,Pn,Pa,Ni=0,ya=0,qo=0,xl=0,Ao=-1,Eo=-1;const ol={};let kd=hk("");const Qi=qn?qn.anchor:sn,to=hi!=="none";let lo=0,qd=0;if(ut._unevaluatedLayout.getValue("text-radial-offset")===void 0){const tc=ut.layout.get("text-offset").evaluate(Un,{},ki);lo=tc[0]*gl,qd=tc[1]*gl}else lo=ut.layout.get("text-radial-offset").evaluate(Un,{},ki)*gl,qd=yoe;if(kr.allowVerticalPlacement&&Us.vertical){const tc=Us.vertical;if(xn)Pn=_oe(tc),at&&(Pa=_oe(at));else{const nd=ut.layout.get("text-rotate").evaluate(Un,{},ki)+90;ea=_6(nr,Qi,sn,yr,Dr,Rr,tc,pn,nd,Jn,ka),at&&(oo=_6(nr,Qi,sn,yr,Dr,Rr,at,ps,nd,null,Bs))}}if(rs){const tc=kr.iconSizeData,nd=ut.layout.get("icon-rotate").evaluate(Un,{},ki),pu=xoe(rs,nd,ai,to,ti.iconScaleFactor),Jy=at?xoe(at,nd,ai,to,ti.iconScaleFactor):void 0;Yi=_6(nr,Qi,sn,yr,Dr,Rr,rs,ps,nd,null,ds);const UN=function(Fp,bM,j2e,HHe,k2e,N2e,WHe,GHe){const S2e=Fp.layers[0],C2e=S2e.appearances;let qN=bM.length;if(j2e&&(qN=Math.max(qN,j2e.length)),C2e.length===0)return qN;const[KHe,ZHe]=HHe.get("icon-size-scale-range"),YHe=we(1,KHe,ZHe);for(const M2e of C2e){const T2e=M2e.getUnevaluatedProperties();if(T2e._values["icon-image"].value!==void 0){const A2e=S2e.getAppearanceValueAndResolveTokens(M2e,"icon-image",k2e,N2e,[]);if(A2e){const E2e=Fp.getResolvedImageFromTokens(A2e);if(E2e){const I2e=T2e._values["icon-size"],XHe=nM(E2e,IN(Fp.zoom,I2e,Fp.worldview),I2e,N2e,Fp.zoom,k2e,Fp.pixelRatio,YHe,Fp.worldview),QHe=WHe.get(XHe.iconPrimary.toString());qN=Math.max(qN,bVe(QHe,GHe))}}}}return qN}(kr,pu,Jy,ut.layout,Un,ki,kr.iconAtlasPositions,to);Ni=4*UN;let Rp=null;tc.kind==="source"?(Rp=[Pp*ut.layout.get("icon-size").evaluate(Un,{},ki)*ti.iconScaleFactor],Rp[0]>dx&&Vr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${sM}. Reduce your "icon-size".`)):tc.kind==="composite"&&(Rp=[Pp*ti.compositeIconSizes[0].evaluate(Un,{},ki)*ti.iconScaleFactor,Pp*ti.compositeIconSizes[1].evaluate(Un,{},ki)*ti.iconScaleFactor],(Rp[0]>dx||Rp[1]>dx)&&Vr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${sM}. Reduce your "icon-size".`)),kr.addSymbols(kr.icon,pu,Rp,Ln,Es,Un,void 0,qn,sn,Is.lineStartIndex,Is.lineLength,-1,oi,ki,Hi,Di,kr.symbolInstances.length,UN),Ao=kr.icon.placedSymbolArray.length-1,Jy&&(ya=4*UN,kr.addSymbols(kr.icon,Jy,Rp,Ln,Es,Un,fu.vertical,qn,sn,Is.lineStartIndex,Is.lineLength,-1,oi,ki,Hi,Di,kr.symbolInstances.length,UN),Eo=kr.icon.placedSymbolArray.length-1)}for(const tc in Us.horizontal){const nd=tc,pu=Us.horizontal[nd];Bi||(kd=hk(pu.text),xn?Xi=_oe(pu):Bi=_6(nr,Qi,sn,yr,Dr,Rr,pu,pn,ut.layout.get("text-rotate").evaluate(Un,{},ki),Jn,ka));const Jy=pu.positionedLines.length===1;if(qo+=i_e(kr,qn,sn,pu,Oi,ut,xn,Un,Jn,Is,Us.vertical?fu.horizontal:fu.horizontalOnly,Jy?NVe(Us.horizontal):[nd],ol,Ao,ti,oi,ki,kr.symbolInstances.length,Hi),Jy)break}Us.vertical&&(xl+=i_e(kr,qn,sn,Us.vertical,Oi,ut,xn,Un,Jn,Is,fu.vertical,["vertical"],ol,Eo,ti,oi,ki,kr.symbolInstances.length,Hi));let Vo=-1;const jf=(tc,nd)=>tc?Math.max(tc,nd):nd;Vo=jf(Xi,Vo),Vo=jf(Pn,Vo),Vo=jf(Pa,Vo);const Ym=Vo>-1?1:0;kr.glyphOffsetArray.length>=65535&&Vr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Un.sortKey!==void 0&&kr.addToSortKeyRanges(kr.symbolInstances.length,Un.sortKey),kr.symbolInstances.emplaceBack(sn.x,sn.y,Qi.x,Qi.y,Qi.z,ol.right>=0?ol.right:-1,ol.center>=0?ol.center:-1,ol.left>=0?ol.left:-1,ol.vertical>=0?ol.vertical:-1,Ao,Eo,kd,Bi!==void 0?Bi:kr.collisionBoxArray.length,Bi!==void 0?Bi+1:kr.collisionBoxArray.length,ea!==void 0?ea:kr.collisionBoxArray.length,ea!==void 0?ea+1:kr.collisionBoxArray.length,Yi!==void 0?Yi:kr.collisionBoxArray.length,Yi!==void 0?Yi+1:kr.collisionBoxArray.length,oo||kr.collisionBoxArray.length,oo?oo+1:kr.collisionBoxArray.length,yr,qo,xl,Ni,ya,Ym,0,lo,qd,Vo,0,to?1:0,yi)})(f,Zr,gs,Ur,u,g,k,v,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,vr,Oe,$,0,hr,er,Ne,c,N,W,G,X,se,me,Se,jr,He,dt,it)};if(Fe==="line")for(const Ur of t6(c.geometry,0,0,Mr,Mr)){const Zr=_Ve(Ur,xr,pr,u.vertical||tr,g,Gt,lr,f.overscaling,Mr);for(const rn of Zr)tr&&LVe(f,tr.text,Zt,rn)||hn(Ur,rn,X)}else if(Fe==="line-center"){for(const Ur of c.geometry)if(Ur.length>1){const Zr=vVe(Ur,pr,u.vertical||tr,g,Gt,lr);Zr&&hn(Ur,Zr,X)}}else if(c.type==="Polygon")for(const Ur of B5(c.geometry,0)){const Zr=jVe(Ur,16);hn(Ur[0],new cx(Zr.x,Zr.y,0,0,void 0),X)}else if(c.type==="LineString")for(const Ur of c.geometry)hn(Ur,new cx(Ur[0].x,Ur[0].y,0,0,void 0),X);else if(c.type==="Point")for(const Ur of c.geometry)for(const Zr of Ur)hn([Zr],new cx(Zr.x,Zr.y,0,0,void 0),X)}const sM=255,dx=sM*Pp;function i_e(f,c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe){const Fe=function(it,gt,Nt,Tt,Gt,Dt,tr,or){const lr=[];if(gt.positionedLines.length===0)return lr;const xr=Tt.layout.get("text-rotate").evaluate(Dt,{})*Math.PI/180,vr=function(mr){const Tr=mr[0],jr=mr[1],hn=Tr*jr;return hn>0?[Tr,-jr]:hn<0?[-Tr,jr]:Tr===0?[jr,Tr]:[jr,-Tr]}(Nt);let hr=Math.abs(gt.top-gt.bottom);for(const mr of gt.positionedLines)hr-=mr.lineOffset;const pr=gt.positionedLines.length,er=hr/pr;let Zt=gt.top-Nt[1];for(let mr=0;mrdx&&Vr(`${f.layerIds[0]}: Value for "text-size" is >= ${sM}. Reduce your "text-size".`)):He.kind==="composite"&&(dt=[Pp*se.compositeTextSizes[0].evaluate(I,{},Se)*se.textScaleFactor,Pp*se.compositeTextSizes[1].evaluate(I,{},Se)*se.textScaleFactor],(dt[0]>dx||dt[1]>dx)&&Vr(`${f.layerIds[0]}: Value for "text-size" is >= ${sM}. Reduce your "text-size".`)),f.addSymbols(f.text,Fe,dt,R,N,I,W,c,u,$.lineStartIndex,$.lineLength,te,me,Se,Oe,!1,Ne,Fe.length);for(const it of G)X[it]=f.text.placedSymbolArray.length-1;return 4*Fe.length}function v6(f){for(const c in f)return f[c];return null}function _6(f,c,u,g,v,k,N,I,R,$,W){let G,X,te,se;if(G=W?W.top:N.top,X=W?W.bottom:N.bottom,te=W?W.left:N.left,se=W?W.right:N.right,hoe(N)&&N.collisionPadding){const me=N.collisionPadding;te-=me[0],G-=me[1],se+=me[2],X+=me[3]}if(R){const me=new ir(te,G),Se=new ir(se,G),Ne=new ir(te,X),Oe=new ir(se,X),Fe=ss(R);let He=new ir(0,0);$&&(He=new ir($[0],$[1])),me._rotateAround(Fe,He),Se._rotateAround(Fe,He),Ne._rotateAround(Fe,He),Oe._rotateAround(Fe,He),te=Math.min(me.x,Se.x,Ne.x,Oe.x),se=Math.max(me.x,Se.x,Ne.x,Oe.x),G=Math.min(me.y,Se.y,Ne.y,Oe.y),X=Math.max(me.y,Se.y,Ne.y,Oe.y)}return f.emplaceBack(c.x,c.y,c.z,u.x,u.y,te,G,se,X,I,g,v,k),f.length-1}function _oe(f){hoe(f)&&f.collisionPadding&&(f.top-=f.collisionPadding[1],f.bottom+=f.collisionPadding[3]);const c=f.bottom-f.top;return c>0?Math.max(10,c):null}function LVe(f,c,u,g){const v=f.compareText;if(c in v){const k=v[c];for(let N=k.length-1;N>=0;N--)if(g.dist(k[N])Fe&&(He(it,lr,Nt,Tt,tr,or),He(lr,gt,tr,or,Gt,Dt))}He(G,X,g,k,v,k),He(X,te,v,k,v,N),He(te,se,v,N,g,N),He(se,G,g,N,g,k),me-=Fe,Se-=Fe,Ne+=Fe,Oe+=Fe;const dt=1/Math.max(Ne-me,Oe-Se);return{scale:dt,x:me*dt,y:Se*dt,x2:Ne*dt,y2:Oe*dt,projection:c}}function o_e(f,{x:c,y:u},g=0){return new ir(((c-g)*f.scale-f.x)*Mr,(u*f.scale-f.y)*Mr)}const OVe=A(new Float32Array(16));class Xy{constructor(c){this.spec=c,this.name=c.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(c,u){return{x:0,y:0,z:0}}unproject(c,u){return new m(0,0)}projectTilePoint(c,u,g){return{x:c,y:u,z:0}}locationPoint(c,u,g,v=!0){return c._coordinatePoint(c.locationCoordinate(u,g),v)}pixelsPerMeter(c,u){return Y(1,c)*u}pixelSpaceConversion(c,u,g){return 1}farthestPixelDistance(c){return a_e(c,c.pixelsPerMeter)}pointCoordinate(c,u,g,v){const k=c.horizonLineFromTop(!1),N=new ir(u,Math.max(k,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(N,v))}pointCoordinate3D(c,u,g){const v=new ir(u,g);if(c.elevation)return c.elevation.pointCoordinate(v);{const k=this.pointCoordinate(c,v.x,v.y,0);return[k.x,k.y,k.z]}}isPointAboveHorizon(c,u){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,u.x,u.y);const g=c.horizonLineFromTop();return u.y0?u<-DN+g&&(u=-DN+g):u>DN-g&&(u=DN-g);const N=k/Math.pow(w6(u),v);let I=N*Math.sin(v*c),R=k-N*Math.cos(v*c);return I=.5*(I/Math.PI+.5),R=.5*(R/Math.PI+.5),{x:I,y:this.southernCenter?R:1-R,z:0}}unproject(c,u){c=(2*c-.5)*Math.PI,this.southernCenter&&(u=1-u),u=(2*(1-u)-.5)*Math.PI;const{n:g,f:v}=this,k=v-u,N=Math.sign(k),I=Math.sign(g)*Math.sqrt(c*c+k*k);let R=Math.atan2(c,Math.abs(k))*N;k*g<0&&(R-=Math.PI*Math.sign(c)*N);const $=we(vo(R/g)+this.center[0],-180,180),W=we(vo(2*Math.atan(Math.pow(v/I,1/g))-DN),-ce,ce);return new m($,this.southernCenter?-W:W)}}class l_e extends Xy{constructor(c){super(c),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(c,u){return{x:B(c),y:V(u),z:0}}unproject(c,u){const g=Q(c),v=le(u);return new m(g,v)}}const c_e=ss(ce);class BVe extends Xy{project(c,u){const g=(u=ss(u))*u,v=g*g;return{x:.5*((c=ss(c))*(.8707-.131979*g+v*(v*(.003971*g-.001529*v)-.013791))/Math.PI+.5),y:1-.5*(u*(1.007226+g*(.015085+v*(.028874*g-.044475-.005916*v)))/Math.PI+1),z:0}}unproject(c,u){c=(2*c-.5)*Math.PI;let g=u=(2*(1-u)-1)*Math.PI,v=25,k=0,N=g*g;do{N=g*g;const $=N*N;k=(g*(1.007226+N*(.015085+$*(.028874*N-.044475-.005916*$)))-u)/(1.007226+N*(.045255+$*(.259866*N-.311325-.005916*11*$))),g=we(g-k,-c_e,c_e)}while(Math.abs(k)>1e-6&&--v>0);N=g*g;const I=we(vo(c/(.8707+N*(N*(N*N*N*(.003971-.001529*N)-.013791)-.131979))),-180,180),R=vo(g);return new m(I,R)}}const d_e=ss(ce);class $Ve extends Xy{project(c,u){u=ss(u),c=ss(c);const g=Math.cos(u),v=2/Math.PI,k=Math.acos(g*Math.cos(c/2)),N=Math.sin(k)/k,I=.5*(c*v+2*g*Math.sin(c/2)/N)||0,R=.5*(u+Math.sin(u)/N)||0;return{x:.5*(I/Math.PI+.5),y:1-.5*(R/Math.PI+1),z:0}}unproject(c,u){let g=c=(2*c-.5)*Math.PI,v=u=(2*(1-u)-1)*Math.PI,k=25;const N=1e-6;let I=0,R=0;do{const $=Math.cos(v),W=Math.sin(v),G=2*W*$,X=W*W,te=$*$,se=Math.cos(g/2),me=Math.sin(g/2),Se=2*se*me,Ne=me*me,Oe=1-te*se*se,Fe=Oe?1/Oe:0,He=Oe?Math.acos($*se)*Math.sqrt(1/Oe):0,dt=.5*(2*He*$*me+2*g/Math.PI)-c,it=.5*(He*W+v)-u,gt=.5*Fe*(te*Ne+He*$*se*X)+1/Math.PI,Nt=Fe*(Se*G/4-He*W*me),Tt=.125*Fe*(G*me-He*W*te*Se),Gt=.5*Fe*(X*se+He*Ne*$)+.5,Dt=Nt*Tt-Gt*gt;I=(it*Nt-dt*Gt)/Dt,R=(dt*Tt-it*gt)/Dt,g=we(g-I,-Math.PI,Math.PI),v=we(v-R,-d_e,d_e)}while((Math.abs(I)>N||Math.abs(R)>N)&&--k>0);return new m(vo(g),vo(v))}}class u_e extends Xy{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ss(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(c,u){const{scale:g,cosPhi:v}=this;return{x:ss(c)*v*g+.5,y:-Math.sin(ss(u))/v*g+.5,z:0}}unproject(c,u){const{scale:g,cosPhi:v}=this,k=-(u-.5)/g,N=we(vo((c-.5)/g)/v,-180,180),I=Math.asin(we(k*v,-1,1)),R=we(vo(I),-ce,ce);return new m(N,R)}}class UVe extends l_e{constructor(c){super(c),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(c,u,g){const v=L5(c,u,g);return Ye(v,v,WP(Eh(g))),{x:v[0],y:v[1],z:v[2]}}locationPoint(c,u,g){const v=Vy(u.lat,u.lng),k=Re([],v),N=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(u),c._centerAltitude):c._centerAltitude;ge(v,v,k,Y(1,0)*Mr*N);const I=A(new Float64Array(16));return T(I,c.pixelMatrix,c.globeMatrix),Ye(v,v,I),new ir(v[0],v[1])}pixelsPerMeter(c,u){return Y(1,0)*u}pixelSpaceConversion(c,u,g){const v=Y(1,c)*u,k=Fn(Y(1,45)*u,v,g);return this.pixelsPerMeter(c,u)/k}createTileMatrix(c,u,g){const v=Nae(Eh(g.canonical));return T(new Float64Array(16),c.globeMatrix,v)}createInversionMatrix(c,u){const{center:g}=c,v=WP(Eh(u));return q(v,v,ss(g.lng)),F(v,v,ss(g.lat)),z(v,v,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(v)}pointCoordinate(c,u,g,v){return Wy(c,u,g,!0)||new $e(0,0)}pointCoordinate3D(c,u,g){const v=this.pointCoordinate(c,u,g,0);return[v.x,v.y,v.z]}isPointAboveHorizon(c,u){return!Wy(c,u.x,u.y,!1)}farthestPixelDistance(c){const u=function(v,k){const N=v.cameraToCenterDistance,I=v._centerAltitude*k,R=v._camera,$=v._camera.forward(),W=de([],ae([],$,-N),[0,0,I]),G=v.worldSize/(2*Math.PI),X=[0,0,-G],te=v.width/v.height,se=Math.tan(v.fovAboveCenter),me=ae([],R.up(),se),Se=ae([],R.right(),se*te),Ne=Re([],de([],de([],$,me),Se)),Oe=[];let Fe;if(new en(W,Ne).closestPointOnSphere(X,G,Oe)){const He=de([],Oe,X),dt=Ae([],He,W);Fe=Math.cos(v.fovAboveCenter)*ye(dt)}else{const He=Ae([],W,X),dt=Ae([],X,W);Re(dt,dt);const it=ye(He)-G;Fe=Math.sqrt(it*(it+2*G));const gt=Math.acos(Fe/(G+it))-Math.acos(Ce($,dt));Fe*=Math.cos(gt)}return 1.01*Fe}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=Gy(c.zoom);if(g>0){const v=a_e(c,Y(1,c.center.lat)*c.worldSize),k=c.worldSize/(2*Math.PI),N=Math.max(c.width,c.height)/c.worldSize*Math.PI;return Fn(u,v+k*(1-Math.cos(N)),Math.pow(g,10))}return u}upVector(c,u,g){return L5(u,g,c,1)}upVectorScale(c){return{metersToTile:bf(HP(Eh(c)))}}}function h_e(f){const c=f.parallels,u=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new l_e(f);case"equirectangular":return new FVe(f);case"naturalEarth":return new BVe(f);case"equalEarth":return new RVe(f);case"winkelTripel":return new $Ve(f);case"albers":return u?new u_e(f):new DVe(f);case"lambertConformalConic":return u?new u_e(f):new zVe(f);case"globe":return new UVe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const qVe=Pt.types,VVe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dM(f,c,u,g,v,k,N,I,R,$,W,G,X){const te=I?Math.min(dx,Math.round(I[0])):0,se=I?Math.min(dx,Math.round(I[1])):0;f.emplaceBack(c,u,Math.round(32*g),Math.round(32*v),k,N,(te<<1)+(R?1:0),0+(se<<1),16*$,16*W,256*G,256*X)}function uM(f,c,u){f.emplaceBack(c,u)}function hM(f,c,u,g,v,k,N){f.emplaceBack(c,u,g,v,k,N)}const j6=(f,c,u,g)=>{for(let v=0;v0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,Qqe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,Kqe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||k)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,Yqe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,Xqe.members,!0)),this.opacityVertexBuffer.itemSize=1),(g||v)&&this.programConfigurations.upload(c))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Qr(boe,"SymbolBuffers");class woe{constructor(c,u,g){this.layoutVertexArray=new c,this.layoutAttributes=u,this.indexArray=new g,this.segments=new Aa,this.collisionVertexArray=new v5,this.collisionVertexArrayExt=new Vm}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,Jqe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,eVe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Qr(woe,"CollisionBuffers");class k6{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(N=>N.fqid),this.index=c.index,this.pixelRatio=c.pixelRatio,this.sourceLayerIndex=c.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=A([]),this.placementViewportMatrix=A([]);const u=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=IN(this.zoom,u["text-size"],this.worldview),this.iconSizeData=IN(this.zoom,u["icon-size"],this.worldview);const g=this.layers[0].layout,v=g.get("symbol-sort-key"),k=g.get("symbol-z-order");this.lut=c.lut,this.canOverlap=g.get("text-allow-overlap")||g.get("icon-allow-overlap")||g.get("text-ignore-placement")||g.get("icon-ignore-placement"),this.sortFeaturesByKey=k!=="viewport-y"&&v.constantOr(1)!==void 0,this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(N=>fu[N]),this.stateDependentLayerIds=this.layers.filter(N=>N.isStateDependent()).map(N=>N.id),this.sourceID=c.sourceID,this.projection=c.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(c){const u=this.layers[0].getAppearances();return!(!u||u.length===0)&&u.some(g=>g.getProperty(c)!=null)}createArrays(){this.text=new boe(new Th(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new boe(new Th(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new pN,this.lineVertexArray=new BP,this.symbolInstances=new S5}calculateGlyphDependencies(c,u,g,v,k){for(const N of c){const I=N.codePointAt(0);if(I===void 0)break;if(u[I]=!0,v&&k&&I<=65535){const R=J5[N];R&&(u[R.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,u,g,v,k,N){let I=1;const R=c.getUnevaluatedProperties()._values["icon-size"],$=IN(this.zoom,R,this.worldview),W=PN($,u);if($.kind!=="constant"&&$.kind!=="camera"||(I=W.uSize),$.kind==="composite"){const{minZoom:G,maxZoom:X}=$,te=R.possiblyEvaluate(new Ji(G,{worldview:this.worldview}),v),se=R.possiblyEvaluate(new Ji(X,{worldview:this.worldview}),v),me=te.evaluate(g,{},v,k);I=me+(se.evaluate(g,{},v,k)-me)*W.uSizeT}return $.kind==="source"&&(I=R.possiblyEvaluate(new Ji(this.zoom,{worldview:this.worldview}),v).evaluate(g,{},v,k)),I*N}updateFootprints(c,u){}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!QP(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?Qc.build(c):c}populate(c,u,g,v){const k=this.layers[0],N=k.layout,I=this.projection.name==="globe",R=N.get("text-font"),$=N.get("text-field"),W=N.get("icon-image"),[G,X]=N.get("icon-size-scale-range"),te=we(u.scaleFactor||1,G,X),se=($.value.kind!=="constant"||$.value.value instanceof Xc&&!$.value.value.isEmpty()||$.value.value.toString().length>0)&&(R.value.kind!=="constant"||R.value.value.length>0),me=W.value.kind!=="constant"||!!W.value.value||Object.keys(W.parameters).length>0,Se=this.hasAnyAppearanceProperty("icon-image"),Ne=N.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!se&&!me&&!Se)return;const Oe=u.iconDependencies,Fe=u.glyphDependencies,He=u.availableImages,dt=new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),it=gt=>{const Nt=gt.id.toString();Oe.has(Nt)?Oe.get(Nt).push(gt):Oe.set(Nt,[gt])};for(const gt of c){const{feature:Nt,id:Tt,index:Gt,sourceLayerIndex:Dt}=gt,tr=k._featureFilter.needGeometry,or=Ot(Nt,tr);if(!k._featureFilter.filter(dt,or,g))continue;if(tr||(or.geometry=bt(Nt,g,v)),I&&Nt.type!==1&&g.z<=5){const mr=or.geometry,Tr=.98078528056,jr=(hn,Ur)=>Ce(L5(hn.x,hn.y,g,1),L5(Ur.x,Ur.y,g,1)){if(!mr.getProperty("icon-image"))return;const Tr=this.getCombinedIconPrimary(mr,vr,or,g,He,er,te);Tr&&it(Tr)}),lr){const mr=R.evaluate(or,{},g).join(","),Tr=N.get("text-rotation-alignment")==="map"&&N.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(fu.vertical)>=0;for(const jr of lr.sections)if(jr.image){const hn=jr.image.getPrimary().scaleSelf(this.pixelRatio),Ur=hn.id.toString(),Zr=Oe.get(Ur)||[];Zr.push(hn),Oe.set(Ur,Zr)}else{const hn=Pv(lr.toString()),Ur=jr.fontStack||mr,Zr=Fe[Ur]=Fe[Ur]||{};this.calculateGlyphDependencies(jr.text,Zr,Tr,this.allowVerticalPlacement,hn)}}}if(N.get("symbol-placement")==="line"&&(this.features=function(gt){const Nt={},Tt={},Gt=[];let Dt=0;function tr(vr){Gt.push(gt[vr]),Dt++}function or(vr,hr,pr){const er=Tt[vr];return delete Tt[vr],Tt[hr]=er,Gt[er].geometry[0].pop(),Gt[er].geometry[0]=Gt[er].geometry[0].concat(pr[0]),er}function lr(vr,hr,pr){const er=Nt[hr];return delete Nt[hr],Nt[vr]=er,Gt[er].geometry[0].shift(),Gt[er].geometry[0]=pr[0].concat(Gt[er].geometry[0]),er}function xr(vr,hr,pr){const er=pr?hr[0][hr[0].length-1]:hr[0][0];return`${vr}:${er.x}:${er.y}`}for(let vr=0;vrvr.geometry)}(this.features)),N.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",u.elevationFeatures){!this.elevationFeatures&&u.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const gt of u.elevationFeatures)this.elevationFeatureIdToIndex.set(gt.id,this.elevationFeatures.length),this.elevationFeatures.push(gt)}}else N.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((gt,Nt)=>gt.sortKey-Nt.sortKey)}getCombinedIconPrimary(c,u,g,v,k,N,I){let R,$;const W=c.getUnevaluatedProperties();if(W._values["icon-image"].value!==void 0){const G=u.getAppearanceValueAndResolveTokens(c,"icon-image",g,v,k);R=this.getResolvedImageFromTokens(G)}else{const G=u.getValueAndResolveTokens("icon-image",g,v,k);R=this.getResolvedImageFromTokens(G)}if(R){const G=W._values["icon-size"]||u._unevaluatedLayout._values["icon-size"];$=nM(R,IN(this.zoom,G,this.worldview),G,v,this.zoom,N,this.pixelRatio,I,this.worldview).iconPrimary}return $}updateAppearanceBasedIconTextures(c,u,g,v){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const k=this.layers[0];let N=!1,I=0;const R=k.layout,[$,W]=R.get("icon-size-scale-range"),G=we(1,$,W);for(let X=0;X=0){const Se=me.id,Ne=u&&Se!==void 0?u[String(Se)]:void 0,Oe={type:"Point",id:me.id,properties:me.properties,geometry:[]},Fe=this.layers[0].appearances&&this.layers[0].appearances.find(He=>He.isActive({globals:v,feature:Oe,canonical:c,featureState:Ne}));if(me.activeAppearance===Fe){I+=te.numIconVertices;continue}if(Fe){me.activeAppearance=Fe;const He=this.getCombinedIconPrimary(Fe,k,Oe,c,g,{sortKey:void 0,text:void 0,icon:null,index:te.featureIndex,sourceLayerIndex:te.featureIndex,geometry:[],properties:me.properties,type:"Point",id:me.id},G);if(!He)continue;const dt=He.toString(),it=this.iconAtlasPositions&&this.iconAtlasPositions.get(dt);if(it){const gt=k.getAppearanceValueAndResolveTokens(Fe,"icon-offset",Oe,c,g),Nt=gt&&Array.isArray(gt)?gt:[0,0];let Tt=p6(it,void 0,Nt,k.layout.get("icon-anchor").evaluate(Oe,{},c));const Gt=k.getAppearanceValueAndResolveTokens(Fe,"icon-rotate",Oe,c,g),Dt=typeof Gt=="number"?Gt:0,tr=it.sdf,or=k.layout.get("icon-text-fit").constantOr("none");or!=="none"&&me.textShaping&&me.iconTextFitPadding&&me.fontScale&&(Tt=foe(Tt,me.textShaping,or,me.iconTextFitPadding,Nt,me.fontScale));const lr=this.calculateEffectiveAppearanceIconSize(Fe,v.zoom,Oe,c,g,G),xr=0,vr=1+(Math.min(dx,Math.round(lr*Pp))<<1),hr=xoe(Tt,Dt,tr,or!=="none",G);me.isUsingAppearanceVertexData||(me.isUsingAppearanceVertexData=!0,me.layoutBasedVertexData=this.icon.getIconVertexData(I,te.numIconVertices));for(let er=0;er0&&(this.icon.updateIconVertexData(I,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(I+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(I+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(I+3,0,0,0,0,0,0,0,0,0,0,0,0),N=!0),I+=te.numIconVertices,me.activeAppearance=null;else if(me.isUsingAppearanceVertexData){const dt=me.layoutBasedVertexData.length/12;for(let it=0;it0||X>0,Se=te>0,Ne=this.elevationFeatures[R.elevationFeatureIndex];if(Ne){const Oe=new ir(R.tileAnchorX,R.tileAnchorY),Fe=.075+Ne.pointElevation(Oe);R.zOffset!==Fe&&(u=!0,R.zOffset=Fe),Fe!==0&&(this.hasAnyZOffset=!0);const He=Ne.computeSlopeNormal(Oe,v),dt=zn(Ct(),ie(0,0,1),He);mt($,$,dt),mt(W,W,dt),$[2]*=g,W[2]*=g,$[0]===1&&$[1]===0&&$[2]===0&&W[0]===0&&W[1]===1&&W[2]===0||(k=k||me,N=N||Se)}if(me&&(j6(this.text.orientationVertexArray,G,$,W),j6(this.text.orientationVertexArray,X,$,W)),Se){const{placedIconSymbolIndex:Oe,verticalPlacedIconSymbolIndex:Fe}=R;Oe>=0&&j6(this.icon.orientationVertexArray,te,$,W),Fe>=0&&j6(this.icon.orientationVertexArray,se,$,W)}}k||(this.text.orientationVertexArray=void 0),N||(this.icon.orientationVertexArray=void 0),u&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(k,N,I)=>{g+=N,g>k.length&&k.resize(g);for(let R=-N;R<0;R++)k.emplace(R+g,I)},u=(k,N,I)=>{v+=N,v>k.length&&k.resize(v);for(let R=-N;R<0;R++)k.emplace(R+v,I)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,v=0;for(let k=0;k0;if((I>0||R>0)&&(c(this.text.zOffsetVertexArray,I,W),c(this.text.zOffsetVertexArray,R,W)),G){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:te}=N;X>=0&&u(this.icon.zOffsetVertexArray,$,W),te>=0&&u(this.icon.zOffsetVertexArray,N.numVerticalIconVertices,W)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(c,u,g,v,k){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(c),this.iconCollisionBox.upload(c)),this.text.upload(c,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(N=>N.appearances&&N.appearances.length>0)),this.icon.upload(c,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(c,u,g,v){return!!(c&&u&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,u,g,v)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=h_e(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,u){const g=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:v,y:k}of u)this.lineVertexArray.emplaceBack(v,k);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(c,u,g,v,k,N,I,R,$,W,G,X,te,se,me,Se,Ne,Oe){const Fe=c.indexArray,He=c.layoutVertexArray,dt=c.globeExtVertexArray,it=c.segments.prepareSegment(4*Oe,He,Fe,this.canOverlap?N.sortKey:void 0),gt=this.glyphOffsetArray.length,Nt=it.vertexLength,Tt=this.allowVerticalPlacement&&I===fu.vertical?Math.PI/2:0,Gt=N.text&&N.text.sections;for(let or=0;or=0?u.rightJustifiedTextSymbolIndex:u.centerJustifiedTextSymbolIndex>=0?u.centerJustifiedTextSymbolIndex:u.leftJustifiedTextSymbolIndex>=0?u.leftJustifiedTextSymbolIndex:u.verticalPlacedTextSymbolIndex>=0?u.verticalPlacedTextSymbolIndex:v),N=poe(this.textSizeData,c,k)/gl;return this.tilePixelRatio*N}getSymbolInstanceIconSize(c,u,g){const v=this.icon.placedSymbolArray.get(g),k=poe(this.iconSizeData,c,v);return this.tilePixelRatio*k}_commitDebugCollisionVertexUpdate(c,u,g,v){c.emplaceBack(u,-g,-g,v),c.emplaceBack(u,g,-g,v),c.emplaceBack(u,g,g,v),c.emplaceBack(u,-g,g,v)}_updateTextDebugCollisionBoxes(c,u,g,v,k,N,I){for(let R=v;R0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(c,u){const g=c.placedSymbolArray.get(u),v=g.vertexStartIndex+4*g.numGlyphs;for(let k=g.vertexStartIndex;kv[I]-v[R]||k[R]-k[I]),N}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let c=0;cthis.symbolInstances.get(u).zOffset-this.symbolInstances.get(c).zOffset)}addToSortKeyRanges(c,u){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===u?g.symbolInstanceEnd=c+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:c,symbolInstanceEnd:c+1})}sortFeatures(c){if(this.sortFeaturesByY&&this.sortedAngle!==c&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(c),this.sortedAngle=c,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const u of this.symbolInstanceIndexes){const g=this.symbolInstances.get(u);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:v,centerJustifiedTextSymbolIndex:k,leftJustifiedTextSymbolIndex:N,verticalPlacedTextSymbolIndex:I,placedIconSymbolIndex:R,verticalPlacedIconSymbolIndex:$}=g;v>=0&&this.addIndicesForPlacedSymbol(this.text,v),k>=0&&k!==v&&this.addIndicesForPlacedSymbol(this.text,k),N>=0&&N!==k&&N!==v&&this.addIndicesForPlacedSymbol(this.text,N),I>=0&&this.addIndicesForPlacedSymbol(this.text,I),R>=0&&this.addIndicesForPlacedSymbol(this.icon,R),$>=0&&this.addIndicesForPlacedSymbol(this.icon,$)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(c){const u=this.symbolInstances.get(this.text.symbolInstanceIndices[c]).elevationFeatureIndex;let g;return this.elevationFeatures&&ug in f?String(f[g]):"")}let p_e,m_e,joe;Qr(k6,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),k6.addDynamicAttributes=RN;class g_e{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:kh,this.defaultValue=c}evaluate(c){if(c.formattedSection){const u=this.defaultValue.property.overrides;if(u&&u.hasOverride(c.formattedSection))return u.getOverride(c.formattedSection)}return c.feature&&c.featureState?this.defaultValue.evaluate(c.feature,c.featureState):this.defaultValue.property.specification.default}eachChild(c){this.defaultValue.isConstant()||c(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qr(g_e,"FormatSectionOverride",{omit:["defaultValue"]});const koe=()=>joe||(joe={layout:p_e||(p_e=new $a({"symbol-placement":new Nr(Rt.layout_symbol["symbol-placement"]),"symbol-spacing":new Nr(Rt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Nr(Rt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Lr(Rt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Nr(Rt.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Nr(Rt.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Nr(Rt.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Nr(Rt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Nr(Rt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Nr(Rt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Nr(Rt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Lr(Rt.layout_symbol["icon-size"]),"icon-size-scale-range":new Nr(Rt.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Lr(Rt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Lr(Rt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Lr(Rt.layout_symbol["icon-image"]),"icon-image-use-theme":new Nr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Lr(Rt.layout_symbol["icon-rotate"]),"icon-padding":new Nr(Rt.layout_symbol["icon-padding"]),"icon-keep-upright":new Nr(Rt.layout_symbol["icon-keep-upright"]),"icon-offset":new Lr(Rt.layout_symbol["icon-offset"]),"icon-anchor":new Lr(Rt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Nr(Rt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Nr(Rt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Nr(Rt.layout_symbol["text-rotation-alignment"]),"text-field":new Lr(Rt.layout_symbol["text-field"]),"text-font":new Lr(Rt.layout_symbol["text-font"]),"text-size":new Lr(Rt.layout_symbol["text-size"]),"text-size-scale-range":new Nr(Rt.layout_symbol["text-size-scale-range"]),"text-max-width":new Lr(Rt.layout_symbol["text-max-width"]),"text-line-height":new Lr(Rt.layout_symbol["text-line-height"]),"text-letter-spacing":new Lr(Rt.layout_symbol["text-letter-spacing"]),"text-justify":new Lr(Rt.layout_symbol["text-justify"]),"text-radial-offset":new Lr(Rt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Nr(Rt.layout_symbol["text-variable-anchor"]),"text-anchor":new Lr(Rt.layout_symbol["text-anchor"]),"text-max-angle":new Nr(Rt.layout_symbol["text-max-angle"]),"text-writing-mode":new Nr(Rt.layout_symbol["text-writing-mode"]),"text-rotate":new Lr(Rt.layout_symbol["text-rotate"]),"text-padding":new Nr(Rt.layout_symbol["text-padding"]),"text-keep-upright":new Nr(Rt.layout_symbol["text-keep-upright"]),"text-transform":new Lr(Rt.layout_symbol["text-transform"]),"text-offset":new Lr(Rt.layout_symbol["text-offset"]),"text-allow-overlap":new Nr(Rt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Nr(Rt.layout_symbol["text-ignore-placement"]),"text-optional":new Nr(Rt.layout_symbol["text-optional"]),visibility:new Nr(Rt.layout_symbol.visibility)})),paint:m_e||(m_e=new $a({"icon-opacity":new Lr(Rt.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Lr(Rt.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Lr(Rt.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Lr(Rt.paint_symbol["text-emissive-strength"]),"icon-color":new Lr(Rt.paint_symbol["icon-color"]),"icon-halo-color":new Lr(Rt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Lr(Rt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Lr(Rt.paint_symbol["icon-halo-blur"]),"icon-translate":new Nr(Rt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Nr(Rt.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Nr(Rt.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Lr(Rt.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Lr(Rt.paint_symbol["text-occlusion-opacity"]),"text-color":new Lr(Rt.paint_symbol["text-color"],{runtimeType:_d,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Lr(Rt.paint_symbol["text-halo-color"]),"text-halo-width":new Lr(Rt.paint_symbol["text-halo-width"]),"text-halo-blur":new Lr(Rt.paint_symbol["text-halo-blur"]),"text-translate":new Nr(Rt.paint_symbol["text-translate"]),"text-translate-anchor":new Nr(Rt.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Nr(Rt.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Nr(Rt.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Nr(Rt.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Nr(Rt.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Lr(Rt.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"})}))},joe);class N6 extends td{constructor(c,u,g,v){super(c,koe(),u,g,v,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=A([]),this.hasOcclusionOpacityProperties=c.paint!==void 0&&("icon-occlusion-opacity"in c.paint||"text-occlusion-opacity"in c.paint)}_handleSpecialPaintPropertyUpdate(c){c!=="icon-occlusion-opacity"&&c!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(c,u){super.recalculate(c,u),this.appearances&&this.appearances.forEach(v=>{v.recalculate(c,u,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const g=this.layout.get("text-writing-mode");if(g){const v=[];for(const k of g)v.indexOf(k)<0&&v.push(k);this.layout._values["text-writing-mode"]=v}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(c,u,g,v){return this._saturation===c&&this._contrast===u&&this._brightnessMin===g&&this._brightnessMax===v||(this._colorAdjustmentMatrix=function(k,N,I,R){k=ma(k),N=Gs(N);const $=S(),W=k/3,G=1-2*W,X=[G,W,W,0,W,G,W,0,W,W,G,0,0,0,0,1],te=.5-.5*N,se=R-I;return T($,[se,0,0,0,0,se,0,0,0,0,se,0,I,I,I,1],[N,0,0,0,0,N,0,0,0,0,N,0,te,te,te,1]),T($,$,X),$}(c,u,g,v),this._saturation=c,this._contrast=u,this._brightnessMin=g,this._brightnessMax=v),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,u,g,v){const k=this.layout.get(c).evaluate(u,{},g,v),N=this._unevaluatedLayout._values[c];return N.isDataDriven()||Ev(N.value)||!k?k:f_e(u.properties,k)}getAppearanceValueAndResolveTokens(c,u,g,v,k){const N=c.getProperty(u);if(!N)return;const I=N.evaluate(g,{},v,k),R=c.getUnevaluatedProperties()._values[u];return R.isDataDriven()||Ev(R.value)||!I||typeof I!="string"?I:f_e(g.properties,I)}createBucket(c){return new k6(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of koe().paint.overridableProperties){if(!N6.hasPaintOverride(this.layout,c))continue;const u=this.paint.get(c),g=new g_e(u),v=new Vk(g,u.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let k=null;k=u.value.kind==="constant"||u.value.kind==="source"?new Oy("source",v):new Xg("composite",v,u.value.zoomStops,u.value.interpolationType),this.paint._values[c]=new Jg(u.property,k,u.parameters)}}_handleOverridablePaintPropertyUpdate(c,u,g){return!(!this.layout||u.isDataDriven()||g.isDataDriven())&&N6.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,u){const g=c.get("text-field"),v=koe().paint.properties[u];let k=!1;const N=I=>{for(const R of I)if(v.overrides&&v.overrides.hasOverride(R))return void(k=!0)};if(g.value.kind==="constant"&&g.value.value instanceof Xc)N(g.value.value.sections);else if(g.value.kind==="source"){const I=$=>{k||($ instanceof xp&&ml($.value)===gv?N($.value.sections):$ instanceof ff?N($.sections):$.eachChild(I))},R=g.value;R._styleExpression&&I(R._styleExpression.expression)}return k}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,u,g){return{config:new Wm(this,{zoom:u,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let x_e,y_e,v_e,__e;var Noe=As([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function S6(f,c,u,g,v,k,N,I){const R=[f,c,1,u,g,1,v,k,1],$=[N,I,1],W=w([],R),[G,X,te]=xe($,$,W);return j(R,R,[G,0,0,0,X,0,0,0,te])}function b_e(f,c,u,g,v,k,N,I){const R=function($,W,G,X,te,se,me,Se){const Ne=S6(0,0,1,0,1,1,0,1),Oe=S6($,W,G,X,te,se,me,Se);return j(Oe,Oe,w([],Ne))}(f,c,u,g,v,k,N,I);return[R[2]/R[8]/Mr,R[5]/R[8]/Mr]}function C6(f){return[f[0],Math.min(Math.max(f[1],-ce),ce)]}class w_e extends Hg{constructor(c,u,g,v){super(),this.id=c,this.dispatcher=g,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(v),this.options=u,this._dirty=!1}load(c,u){if(this._loaded=u||!1,this.fire(new uf("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=bs(this.map._requestManager.transformRequest(this.url,qg.Image),(g,v)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new fv(g)):v&&(this.image=v instanceof HTMLImageElement?zo.getImageData(v):v,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,c&&(this.coordinates=c),this._finishLoading())})}loaded(){return this._loaded}updateImage(c){return c.url?(this._imageRequest&&c.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=c.url,this.load(c.coordinates,this._loaded),this):this}setTexture(c){if(!(c.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Y5(this.map.painter.context,c.handle),this.width=c.dimensions[0],this.height=c.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new uf("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(c){this.map=c,this.load()}onRemove(c){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Y5||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(c){if(this.coordinates=c,this._boundsArray=void 0,this._unsupportedCoords=!1,!c.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let u=c[0][1],g=c[0][1];for(const k of c)k[1]>g&&(g=k[1]),k[1]ce?this.onNorthPole=!0:v<-ce&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const k=c.map($e.fromLngLat);this.tileID=function(N){let I=1/0,R=1/0,$=-1/0,W=-1/0;for(const me of N)I=Math.min(I,me.x),R=Math.min(R,me.y),$=Math.max($,me.x),W=Math.max(W,me.y);const G=Math.max($-I,W-R),X=Math.max(0,Math.floor(-Math.log2(G))),te=Math.pow(2,X);let se=Math.floor((I+$)/2*te);return se>1&&(se-=1),new Vi(X,se,Math.floor((R+W)/2*te))}(k),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new uf("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Y5||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(c){for(const Ne in this.tiles){const Oe=this.tiles[Ne];Oe.state!=="loaded"&&(Oe.state="loaded",Oe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const u=iM(new Vi(0,0,0),this.map.transform.projection),g=[u.projection.project(this.coordinates[0][0],this.coordinates[0][1]),u.projection.project(this.coordinates[1][0],this.coordinates[1][1]),u.projection.project(this.coordinates[2][0],this.coordinates[2][1]),u.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(Ne){const Oe=Ne[1].x-Ne[0].x,Fe=Ne[1].y-Ne[0].y,He=Ne[2].x-Ne[1].x,dt=Ne[2].y-Ne[1].y,it=Ne[3].x-Ne[2].x,gt=Ne[3].y-Ne[2].y,Nt=Ne[0].x-Ne[3].x,Tt=Ne[0].y-Ne[3].y,Gt=Oe*dt-He*Fe,Dt=He*gt-it*dt,tr=it*Tt-Nt*gt,or=Nt*Fe-Oe*Tt;return Gt>0&&Dt>0&&tr>0&&or>0||Gt<0&&Dt<0&&tr<0&&or<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const v=iM(this.tileID,this.map.transform.projection),[k,N,I,R]=this.coordinates.map(Ne=>{const Oe=v.projection.project(Ne[0],Ne[1]);return o_e(v,Oe)._round()});this.perspectiveTransform=b_e(k.x,k.y,N.x,N.y,I.x,I.y,R.x,R.y);const $=this._boundsArray=new zy;$.emplaceBack(k.x,k.y,0,0),$.emplaceBack(N.x,N.y,Mr,0),$.emplaceBack(R.x,R.y,0,Mr),$.emplaceBack(I.x,I.y,Mr,Mr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,Noe.members),this.boundsSegments=Aa.simpleSegment(0,0,4,2);const W=[],G=[C6((X=this.coordinates)[0]),C6(X[1]),C6(X[2]),C6(X[3])];var X;const[te,se,me,Se]=function(Ne){let Oe=Ne[0][0],Fe=Oe,He=Ne[0][1],dt=He;for(let it=1;itFe&&(Fe=Ne[it][0]),Ne[it][1]dt&&(dt=Ne[it][1]);return[Oe,He,Fe-Oe,dt-He]}(G);{const Ne=new zy,[Oe,Fe,He,dt]=function(hr){let pr=hr[0].x,er=pr,Zt=hr[0].y,mr=Zt;for(let Tr=1;Trer&&(er=hr[Tr].x),hr[Tr].ymr&&(mr=hr[Tr].y);return[pr,Zt,er-pr,mr-Zt]}(g),it=hr=>[(hr.x-Oe)/He,(hr.y-Fe)/dt],[gt,Nt,Tt,Gt]=g.map(it),Dt=function(hr,pr,er,Zt,mr,Tr,jr,hn){const Ur=S6(0,0,1,0,1,1,0,1);return j(Ur,Ur,w([],S6(hr,pr,er,Zt,mr,Tr,jr,hn)))}(gt[0],gt[1],Nt[0],Nt[1],Tt[0],Tt[1],Gt[0],Gt[1]);this.elevatedGlobePerspectiveTransform=b_e(gt[0],gt[1],Nt[0],Nt[1],Tt[0],Tt[1],Gt[0],Gt[1]);const tr=(hr,pr)=>{W.push(hr.lng);const er=Math.round((hr.lng-te)/me*Mr),Zt=Math.round((hr.lat-se)/Se*Mr),mr=it(pr),Tr=xe([],[mr[0],mr[1],1],Dt),jr=Math.round(Tr[0]/Tr[2]*Mr),hn=Math.round(Tr[1]/Tr[2]*Mr);Ne.emplaceBack(er,Zt,jr,hn)},or=g[3].x-g[0].x,lr=g[3].y-g[0].y,xr=g[2].x-g[1].x,vr=g[2].y-g[1].y;for(let hr=0;hr<65;hr++){const pr=hr/64,er=[g[0].x+pr*or,g[0].y+pr*lr],Zt=[g[1].x+pr*xr,g[1].y+pr*vr],mr=Zt[0]-er[0],Tr=Zt[1]-er[1];for(let jr=0;jr<65;jr++){const hn=jr/64,Ur={x:er[0]+mr*hn,y:er[1]+Tr*hn};tr(u.projection.unproject(Ur.x,Ur.y),Ur)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(Ne,Noe.members)}{this.maxLongitudeTriangleSize=0;let Ne=[],Oe=new Bo;const Fe=(He,dt,it)=>{Oe.emplaceBack(He,dt,it);const gt=W[He],Nt=W[dt],Tt=W[it],Gt=Math.min(Math.min(gt,Nt),Tt),Dt=Math.max(Math.max(gt,Nt),Tt)-Gt;Dt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Dt),Ne.push(Gt+Dt/2)};for(let He=0;He<64;He++)for(let dt=0;dt<64;dt++){const it=65*He+dt,gt=it+1,Nt=it+65,Tt=Nt+1;Fe(it,Nt,gt),Fe(gt,Nt,Tt)}[Ne,Oe]=function(He,dt){const it=Array.from({length:He.length},(Tt,Gt)=>Gt);it.sort((Tt,Gt)=>He[Tt]-He[Gt]);const gt=[],Nt=new Bo;for(let Tt=0;Tt{N.segments.push({vertexOffset:0,primitiveOffset:G,vertexLength:u.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},R=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-v)<=R){const G=wa(g,0,g.length,v+R);return G===g.length||I(G,ho(g,G+1,g.length,v+360-R)-G),N}vMr?v-Mr:v,new ir(Math.trunc(v),Math.trunc(g[u+1]))}translationForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+4],g[u+5],g[u+6]]}rotationScaleForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+10],g[u+11],g[u+12],g[u+13],g[u+14],g[u+15]]}transformForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+4],g[u+10],g[u+11],g[u+12],g[u+5],g[u+13],g[u+14],g[u+15],g[u+6],0,0,0,1]}}class Moe{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaledZ=this.canonical.z+Math.log2(c.overscaling),this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.projection=c.projection,this.index=c.index,this.worldview=c.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=c.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.tileToMeter=Pe(g);const k=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:N,id:I,index:R,sourceLayerIndex:$}of c){const W=I??(N.properties&&N.properties.hasOwnProperty("id")?N.properties.id:void 0),G=Ot(N,k);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:W,sourceLayerIndex:$,index:R,geometry:k?G.geometry:bt(N,g,v),properties:N.properties,type:N.type,patterns:{}},te=this.addFeature(X,X.geometry,G);te&&u.featureIndex.insert(N,X.geometry,R,$,this.index,this.instancesPerModel[te].instancedDataArray.length,Mr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,u=this.layers[0].scope;let g=0;for(const v of this.modelUris){const k=c.getModel(v,u);if(!k)continue;const N=this.instancesPerModel[v];if(N){const I=.5*Me(k.aabb.max,k.aabb.min)*N.maxScale+N.maxXYTranslationDistance,R=Math.min(Mr,Math.max(I/this.tileToMeter,Mr/32));g=Math.max(R,g)}}return g}update(c,u,g,v){for(const k in this.instancesPerModel){const N=this.instancesPerModel[k];for(const I in c)N.idToFeaturesIndex.hasOwnProperty(I)&&(this.evaluate(N.features[N.idToFeaturesIndex[I]],c[I],N,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];for(const v of g.features){const k=this.layers[0],N=v.feature,I=this.canonical,R=k.paint.get("model-rotation").evaluate(N,{},I),$=k.paint.get("model-scale").evaluate(N,{},I),W=k.paint.get("model-translation").evaluate(N,{},I);nt(v.rotation,R)&&nt(v.scale,$)&&nt(v.translation,W)||(this.evaluate(v,v.featureStates,g,!0),c=!0)}}return c}updateReplacement(c,u,g,v){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const k=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(QP(this.activeReplacements,k))return!1;this.activeReplacements=k;let N=!1;for(const I in this.instancesPerModel){const R=this.instancesPerModel[I],$=R.instancedDataArray;for(const W of R.features){const G=W.instancedDataOffset,X=W.instancedDataCount;for(let te=0;teMr;me=Se?me-Mr:me;const Ne=Math.floor(me),Oe=Math.floor($.float32[se+1]);let Fe=!1;for(const He of this.activeReplacements)if(!y1e(He,g,A_e.Model,v)&&!(He.min.x>Ne||Ne>He.max.x||He.min.y>Oe||Oe>He.max.y)&&(Fe=j1e(w1e(Ne,Oe,c.canonical,He.footprintTileId.canonical),He.footprint),Fe))break;$.float32[se]=Fe?me+Mr:me,N=N||Fe!==Se}}}return N}isEmpty(){for(const c in this.instancesPerModel)if(this.instancesPerModel[c].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(c){if(!this.uploaded)for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=c.createVertexBuffer(g.instancedDataArray,gqe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(c){for(const g in this.instancesPerModel){const v=this.instancesPerModel[g];v.instancedDataArray.length!==0&&v.instancedDataBuffer&&v.instancedDataBuffer.destroy()}const u=this.layers[0].modelManager;if(c&&u&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)u.removeModel(g,"",!0)}addFeature(c,u,g){const v=this.layers[0],k=v.layout.get("model-id").evaluate(g,{},this.canonical);if(!k)return Vr(`modelId is not evaluated for layer ${v.id} and it is not going to get rendered.`),k;(Coe(k,!1)||this.styleDefinedModelURLs[k]!==void 0)&&(this.modelUris.includes(k)||this.modelUris.push(k)),this.instancesPerModel[k]||(this.instancesPerModel[k]=new I_e);const N=this.instancesPerModel[k],I=N.instancedDataArray,R=new E_e(g,I.length);for(const $ of u)for(const W of $){if(W.x<0||W.x>=Mr||W.y<0||W.y>=Mr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Mr,te=this.lookupDim*(W.y*X|0)+W.x*X|0;if(this.lookup){if(this.lookup[te]!==0)continue;this.lookup[te]=1}}this.instanceCount++;const G=I.length;I.resize(G+1),N.instancesEvaluatedElevation.push(0),I.float32[16*G]=W.x,I.float32[16*G+1]=W.y}return R.instancedDataCount=N.instancedDataArray.length-R.instancedDataOffset,R.instancedDataCount>0&&(c.id&&(N.idToFeaturesIndex[c.id]=N.features.length),N.features.push(R),this.evaluate(R,{},N,!1)),k}getModelUris(){return this.modelUris}evaluate(c,u,g,v){const k=this.layers[0],N=c.feature,I=this.canonical,R=c.rotation=k.paint.get("model-rotation").evaluate(N,u,I),$=c.scale=k.paint.get("model-scale").evaluate(N,u,I),W=c.translation=k.paint.get("model-translation").evaluate(N,u,I),G=Object.assign({},k.paint.get("model-color").evaluate(N,u,I));G.a=k.paint.get("model-color-mix-intensity").evaluate(N,u,I);const X=[];this.maxVerticalOffset0?Math.sqrt(te):0;g.maxScale=Math.max(Math.max(g.maxScale,$[0]),Math.max($[1],$[2])),g.maxXYTranslationDistance=Math.max(g.maxXYTranslationDistance,se),this.maxScale=Math.max(Math.max(this.maxScale,$[0]),Math.max($[1],$[2])),cve(X,R,$);const me=Math.round(100*G.a)+G.b/1.05;for(let Se=0;Se10?this.tileToMeter:Pe(I,dt)),Fe[Oe+4]=W[0],Fe[Oe+5]=W[1],Fe[Oe+6]=W[2]+He,Fe[Oe+7]=X[0],Fe[Oe+8]=X[1],Fe[Oe+9]=X[2],Fe[Oe+10]=X[4],Fe[Oe+11]=X[5],Fe[Oe+12]=X[6],Fe[Oe+13]=X[8],Fe[Oe+14]=X[9],Fe[Oe+15]=X[10],g.instancesEvaluatedElevation[Ne]=W[2]}}}let P_e,L_e;Qr(Moe,"ModelBucket",{omit:["layers"]}),Qr(I_e,"PerModelAttributes"),Qr(E_e,"ModelFeature");class FN{constructor(c,u,g){this._demTile=c,this._dem=this._demTile.dem,this._scale=u,this._offset=g}static create(c,u,g){const v=g||c.findDEMTileFor(u);if(!v||!v.dem)return;const k=v.dem,N=v.tileID,I=1<$.fqid),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id),this.modelTraits|=TN.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,v&&(this.modelTraits|=TN.HasMapboxMeshFeatures),k&&(this.modelTraits|=TN.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=N,this.worldview=R,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const $ of u)this.nodesInfo.push(new F_e($)),D_e($,I.featureIndexArray.length,I.grid),I.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,I.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(c,u){for(const g of this.getNodesInfo()){const v=g.node;v.footprint&&u.push({footprint:v.footprint,id:c})}}updateAppearances(c,u,g,v){}update(c){const u=Object.keys(c).length!==0;if(u&&!this.stateDependentLayers.length)return;const g=u?this.stateDependentLayers:this.layers;if(!xo(c,this.states))for(const v of g)this.evaluate(v,c);this.states=structuredClone(c)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(c){if(!this.needsUpload)return;const u=this.getNodesInfo();for(const g of u){const v=g.node;this.uploaded?this.updatePbrBuffer(v):Jae(v,c,!0)}for(const g of u)d6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let u=!1;if(!c.meshes)return u;for(const g of c.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),u=!0);return u}needsReEvaluation(c,u,g){const v=c.transform.projectionOptions,k=c.style.getBrightness(),N=this.brightness!==k;if(!this.uploaded||this.dirty||v.name!==this.projection.name||fM(g.paint.get("model-color").value,N)||fM(g.paint.get("model-color-mix-intensity").value,N)||fM(g.paint.get("model-roughness").value,N)||fM(g.paint.get("model-emissive-strength").value,N)||fM(g.paint.get("model-height-based-emissive-strength-multiplier").value,N)){this.projection=v,this.brightness=k;const I=this.getNodesInfo();for(const R of I)R.state=null;return!0}return!1}evaluateTransform(c,u){if(c.transform.zoom===this.zoom)return;this.zoom=c.transform.zoom;const g=this.getNodesInfo(),v=this.id.canonical;for(const k of g){const N=k.feature;k.evaluatedTranslation=u.paint.get("model-translation").evaluate(N,{},v),k.evaluatedScale=u.paint.get("model-scale").evaluate(N,{},v)}}evaluate(c,u){const g=this.getNodesInfo();for(const v of g){if(!v.node.meshes)continue;const k=v.feature,N=u&&u[k.id];if(xo(N,v.state))continue;v.state=structuredClone(N);const I=v.node.meshes&&v.node.meshes[0].featureData,R=v.evaluatedColor[2],$=v.evaluatedRMEA[2],W=this.id.canonical;if(v.hasTranslucentParts=!1,I){for(let G=0;G=it)continue;const hr=Toe[vr],pr=Math.abs(hr);pr>Dt&&(Gt=hr,Dt=pr,tr=xr,or=lr)}if(Dt>.1){const lr=1-(it+.5*Math.abs(tr*or))/se;let xr=u._dem.get(Nt,gt)+Gt*lr;const vr=u._dem.get(Nt+tr,gt+or),hr=u._dem.get(Nt-tr,gt-or,!0);(xr-vr)*(xr-hr)>0&&(xr=(vr+hr)/2),Toe[Tt]=u._dem.set(Nt,gt,xr),Jv[Tt]=it}}}}}I&&(u._demTile.needsDEMTextureUpload=!0,u._dem._timestamp=zo.now())}setFilter(c){this.filter=c?Jk(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new Ji(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const u of c)d6(u.node),eoe(u.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped());for(const v of this.getNodesInfo()){const k=v.node.footprint;v.hiddenByReplacement=!!k&&!g.find(N=>N.footprint===k)}}getHeightAtTileCoord(c,u){const g=[],v=[0,0,0],k=A([]);for(const N of this.getNodesInfo()){const I=N.node.meshes[0],R=I.transformedAabb;if(cR.max[0]||u>R.max[1])continue;if(N.node.hidden===!0)return{height:1/0,maxHeight:N.feature.properties.height,hidden:!1,verticalScale:N.evaluatedScale[2]};E(k,N.node.globalMatrix),v[0]=c,v[1]=u,Ye(v,v,k);const $=(v[0]-I.aabb.min[0])/(I.aabb.max[0]-I.aabb.min[0])*Yv|0,W=Math.min(63,(v[1]-I.aabb.min[1])/(I.aabb.max[1]-I.aabb.min[1])*Yv|0)*Yv+Math.min(63,$),G=I.heightmap[W];if(!(G<0&&N.node.footprint))return N.hiddenByReplacement?void 0:{height:G,maxHeight:N.feature.properties.height,hidden:!1,verticalScale:N.evaluatedScale[2]};if(N.node.footprint.grid.query(new ir(c,u),new ir(c,u),g),g.length>0)return{height:void 0,maxHeight:N.feature.properties.height,hidden:N.hiddenByReplacement,verticalScale:N.evaluatedScale[2]}}}}function fM(f,c){return f instanceof Oy&&!f.isLightConstant&&c}function KVe(f,c,u,g,v,k,N,I){let R=(61440&c|(61440&c)>>4)>>8,$=(3840&c|(3840&c)>>4)>>4,W=240&c|(240&c)>>4;u[3]>0&&(R=Fn(R,255*u[0],u[3]),$=Fn($,255*u[1],u[3]),W=Fn(W,255*u[2],u[3]));const G=R<<8|$,X=W<<8|Math.floor(255*g[3]),te=function(it){const gt=we(it,0,2);return Math.min(Math.round(.5*gt*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],se=we(v[0],0,1),me=we(v[1],0,1),Se=we(v[2],0,1),Ne=we(v[3],0,1);let Oe,Fe,He,dt;if(se!==me&&N!==k&&me!==se){const it=N-k;Fe=1/(it*(me-se)),He=-(k+it*se)/(it*(me-se));const gt=we(v[4],-1,1);dt=Math.pow(10,gt),Oe=255*Se<<8|255*Ne}else Oe=65535,Fe=0,He=1,dt=1;if(f.emplaceBack(G,X,te,Oe,Fe,He,dt),I){const it=I.length;I.clear();for(let gt=0;gt>16&65535,W=k?R>>16&65535:65535&R,G=(15&W)<8?15&W:0,X=f.evaluatedRMEA[G],te=f.evaluatedColor[G],se=f.emissionHeightBasedParams[G];let me;if(I&&G===2&&g.lights&&(me=new dN,me.resize(10*g.lights.length)),KVe(N.featureArray,$,te,X,se,N.aabb.min[2],N.aabb.max[2],me),me&&I){I=!1;const Se=g.meshes[g.lightMeshIndex];Se.featureArray=me,Se.featureArray._trim()}}N.featureArray._trim(),v++}}Qr(T6,"Tiled3dModelBucket",{omit:["layers"]}),Qr(F_e,"Tiled3dModelFeature");const YVe=["id","tile","layer","source","sourceLayer","state"];class e_{constructor(c,u,g,v,k){this.type="Feature",this._vectorTileFeature=c,this._z=u,this._x=g,this._y=v,this.properties=c?c.properties:{},this.id=k}clone(){const c=new e_(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(c.state=Object.assign({},this.state)),this.layer&&(c.layer=Object.assign({},this.layer)),this.source&&(c.source=this.source),this.sourceLayer&&(c.sourceLayer=this.sourceLayer),c}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(c){this._geometry=c}toJSON(){const c={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const u of YVe)this[u]!==void 0&&(c[u]=this[u]);return c}}class t_ extends Hg{constructor(c,u,g,v){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=u,this._modelsInfo=new Map}load(){const c=[];for(const u in this._options.models){const g=this._options.models[u],v=this._modelsInfo.get(u);if(v){const k=v.model;k.position=g.position!=null?new m(g.position[0],g.position[1]):new m(0,0),k.orientation=g.orientation!=null?g.orientation:[0,0,0],v.modelSpec=g,t_.applyModelSpecification(k,g),k.computeBoundsAndApplyParent(),this.models.push(k)}else{const k=ive(this.map._requestManager.transformRequest(g.uri,qg.Model).url).then(N=>{if(!N)return;const I=roe(N),R=new dve(u,g.uri,g.position,g.orientation,I);t_.applyModelSpecification(R,g),R.computeBoundsAndApplyParent(),this.models.push(R),this._modelsInfo.set(u,{modelSpec:g,model:R})}).catch(N=>{this.fire(new fv(new Error(`Could not load model ${u} from ${g.uri}: ${N.message}`)))});c.push(k)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new uf("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(u=>{this._loaded=!0,this.fire(new fv(new Error(`Could not load models: ${u.message}`)))})}static applyModelSpecification(c,u){u.nodeOverrides&&t_.convertNodeOverrides(c,u.nodeOverrides),u.materialOverrides&&t_.convertMaterialOverrides(c,u.materialOverrides),u.nodeOverrideNames&&(c.nodeOverrideNames=[...u.nodeOverrideNames]),u.materialOverrideNames&&(c.materialOverrideNames=[...u.materialOverrideNames]),u.featureProperties&&(c.featureProperties=u.featureProperties)}static convertNodeOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.nodeOverrideNames=[];for(const g of u)c.nodeOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={orientation:[0,0,0]};if(v.hasOwnProperty("orientation")){const N=v.orientation;N&&(k.orientation=N)}c.nodeOverrides.set(g,k)})}static convertMaterialOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.materialOverrideNames=[];for(const g of u)c.materialOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={color:new wi(1,1,1),colorMix:0,emissionStrength:0,opacity:1},N=v["model-color"];N!==void 0&&(k.color.r=N[0],k.color.g=N[1],k.color.b=N[2]);const I=v["model-color-mix-intensity"];I!==void 0&&(k.colorMix=I);const R=v["model-emissive-strength"];R!==void 0&&(k.emissionStrength=R);const $=v["model-opacity"];$!==void 0&&(k.opacity=$),c.materialOverrides.set(g,k)})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,u){}serialize(){return this._options}setProperty(c,u){return!1}reload(){const c=Mh(this.id,this.scope);this.map.style.clearSource(c),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(c){this.models=[];const u=new Map;for(const g in c){const v=c[g];if(this._modelsInfo.has(g)){const k=this._modelsInfo.get(g);k&&k.modelSpec.uri===v.uri&&u.set(g,k)}}this._modelsInfo=u,this._options.models=c,this._loaded=!1,this.load()}}function Aoe(f,c,u,g){const v=1<He.polygon).flat());const Se=te?I:null,[Ne,Oe]=G1e(k,g,G,W,$,N,Se,X,se,k.center.lat,f.tileID.canonical),Fe=f.queryGeometry;return W1e(Ne,Oe,Fe.isPointQuery()?Fe.screenBounds:Fe.screenGeometry)}},building:class extends td{constructor(f,c,u,g){super(f,{layout:xve||(xve=new $a({visibility:new Nr(Rt.layout_building.visibility),"building-facade":new Lr(Rt.layout_building["building-facade"]),"building-facade-floors":new Lr(Rt.layout_building["building-facade-floors"]),"building-facade-unit-width":new Lr(Rt.layout_building["building-facade-unit-width"]),"building-facade-window":new Lr(Rt.layout_building["building-facade-window"]),"building-roof-shape":new Lr(Rt.layout_building["building-roof-shape"]),"building-height":new Lr(Rt.layout_building["building-height"]),"building-base":new Lr(Rt.layout_building["building-base"]),"building-flood-light-wall-radius":new Lr(Rt.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Lr(Rt.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Lr(Rt.layout_building["building-flip-roof-orientation"])})),paint:yve||(yve=new $a({"building-opacity":new Nr(Rt.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Nr(Rt.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Nr(Rt.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Nr(Rt.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Nr(Rt.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Nr(Rt.paint_building["building-vertical-scale"]),"building-cast-shadows":new Nr(Rt.paint_building["building-cast-shadows"]),"building-color":new Lr(Rt.paint_building["building-color"]),"building-emissive-strength":new Lr(Rt.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Nr(Rt.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Nr(Rt.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Nr(Rt.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Nr(Rt.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Nr(Rt.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"})}))},c,u,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new gve(f)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(f){return!0}queryRadius(f){return 0}queryIntersectsFeature(f,c,u,g,v,k,N,I,R){let $=this.layout.get("building-height").evaluate(c,u);const W=this.layout.get("building-base").evaluate(c,u),G=f.tile.getBucket(this).getFootprint(c);if(G){if(G.hiddenFlags!==0)return!1;$=G.height}const[X,te]=G1e(k,g,W,$,new ir(0,0),N,null,[0,0],1,k.center.lat,f.tileID.canonical),se=f.queryGeometry;return W1e(X,te,se.isPointQuery()?se.screenBounds:se.screenGeometry)}},line:class extends td{constructor(f,c,u,g){const v=Mve();super(f,v,c,u,g),v.layout&&(this.layout=new ex(v.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(f){if(f==="line-gradient"){const c=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=c._styleExpression&&c._styleExpression.expression instanceof Nv,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(f,c){super.recalculate(f,c),this.paint._values["line-floorwidth"]=(()=>{if(Q5)return Q5;const u=Mve();return Q5=new Wqe(u.paint.properties["line-width"].specification),Q5.useIntegerZoom=!0,Q5})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new ioe(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,u){const g=Sve(this);return{config:new Wm(this,{zoom:c,lut:u}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,u=Tve(xc("line-width",this,c),xc("line-gap-width",this,c)),g=xc("line-offset",this,c);return u/2+Math.abs(g)+Fl(this.paint.get("line-translate"))}queryIntersectsFeature(f,c,u,g,v,k){if(f.queryGeometry.isAboveHorizon)return!1;const N=uu(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,f.pixelToTileUnitsFactor),I=f.pixelToTileUnitsFactor/2*Tve(this.paint.get("line-width").evaluate(c,u),this.paint.get("line-gap-width").evaluate(c,u)),R=this.paint.get("line-offset").evaluate(c,u);return R&&(g=function($,W){const G=[],X=new ir(0,0);for(let te=0;te<$.length;te++){const se=$[te],me=[];for(let Se=0;Se=3){for(let se=0;se>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function uHe(f,c,u){f===1?(c.rgb_color=P6(u.readVarint()),c.paint="rgb_color"):f===2?(c.linear_gradient_idx=u.readVarint(),c.paint="linear_gradient_idx"):f===3?(c.radial_gradient_idx=u.readVarint(),c.paint="radial_gradient_idx"):f===5?u.readPackedFloat(c.dasharray):f===6?c.dashoffset=u.readFloat():f===7?c.miterlimit=u.readFloat():f===8?c.opacity=u.readVarint():f===9?c.width=u.readFloat():f===10?c.linecap=u.readVarint():f===11&&(c.linejoin=u.readVarint())}function hHe(f,c,u){f===1?c.transform=I6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(U_e(u,u.readVarint()+u.pos)):f===4?c.x1=u.readFloat():f===5?c.y1=u.readFloat():f===6?c.x2=u.readFloat():f===7&&(c.y2=u.readFloat())}function U_e(f,c){return f.readFields(fHe,{offset:0,opacity:255,rgb_color:Eoe},c)}function fHe(f,c,u){f===1?c.offset=u.readFloat():f===2?c.opacity=u.readVarint():f===3&&(c.rgb_color=P6(u.readVarint()))}function pHe(f,c,u){f===1?c.transform=I6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(U_e(u,u.readVarint()+u.pos)):f===4?c.cx=u.readFloat():f===5?c.cy=u.readFloat():f===6?c.r=u.readFloat():f===7?c.fx=u.readFloat():f===8?c.fy=u.readFloat():f===9&&(c.fr=u.readFloat())}function mHe(f,c,u){f===1?c.transform=I6(u,u.readVarint()+u.pos):f===2?c.clip_path_idx=u.readVarint():f===3&&c.children.push(E6(u,u.readVarint()+u.pos))}function gHe(f,c,u){f===1?c.left=c.top=u.readFloat():f===2?c.width=c.height=u.readFloat():f===3?c.top=u.readFloat():f===4?c.height=u.readFloat():f===5?c.mask_type=u.readVarint():f===6?c.mask_idx=u.readVarint():f===7&&c.children.push(E6(u,u.readVarint()+u.pos))}class xHe{static calculate(c={},u=[]){const g=new Map,v=new Map;if(Object.keys(c).length===0)return g;u.forEach(k=>{v.set(k.name,k.rgb_color||new wi(0,0,0))});for(const[k,N]of Object.entries(c))v.has(k)?g.set(v.get(k).toString(),N):console.warn(`Ignoring unknown image variable "${k}"`);return g}}function zN(f,c=255,u){const g=c/255,v=f.toString(),k=u.has(v)?u.get(v).clone():f.clone();return k.a*=g,k.toString()}function mM(f,c){if(!iu()){const u=document.createElement("canvas");return u.width=f,u.height=c,u}return new OffscreenCanvas(f,c)}let Loe,gM=null;function Ooe(f,c,u,g,v){for(const k of g.children)q_e(f,c,u,k,v)}function q_e(f,c,u,g,v){g.group?(f.save(),function(k,N,I,R,$){const W=R.mask_idx!=null?I.masks[R.mask_idx]:null,G=R.clip_path_idx!=null?I.clip_paths[R.clip_path_idx]:null;if(R.transform&&(N=BN(R.transform).preMultiplySelf(N)),!function(se,me,Se){return se.opacity!==255||me||Se}(R,G!=null,W!=null))return void Ooe(k,N,I,R,$);const X=mM(k.canvas.width,k.canvas.height),te=X.getContext("2d");Ooe(te,N,I,R,$),G&&Y_e(te,N,I,G),W&&X_e(te,N,I,W,$),k.globalAlpha=R.opacity/255,k.drawImage(X,0,0)}(f,c,u,g.group,v),f.restore()):g.path&&(f.save(),function(k,N,I,R,$){k.setTransform(N),R.paint_order===JVe.PAINT_ORDER_FILL_AND_STROKE?(V_e(k,I,R,$),W_e(k,I,R,$)):(W_e(k,I,R,$),V_e(k,I,R,$))}(f,c,u,g.path,v),f.restore())}function V_e(f,c,u,g){const v=u.fill;if(!v)return;const k=v.opacity/255;switch(f.save(),f.beginPath(),Q_e(u,f),v.paint){case"rgb_color":f.fillStyle=zN(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":{const N=c.linear_gradients[v.linear_gradient_idx];N.transform&&f.setTransform(BN(N.transform).preMultiplySelf(f.getTransform())),f.fillStyle=G_e(f,N,k,g);break}case"radial_gradient_idx":{const N=c.radial_gradients[v.radial_gradient_idx];N.transform&&f.setTransform(BN(N.transform).preMultiplySelf(f.getTransform())),f.fillStyle=K_e(f,N,k,g)}}f.fill(H_e(u)),f.restore()}function H_e(f){return f.rule===Ioe.PATH_RULE_NON_ZERO?"nonzero":f.rule===Ioe.PATH_RULE_EVEN_ODD?"evenodd":void 0}function W_e(f,c,u,g){const v=u.stroke;if(!v)return;const k=J_e(u);f.lineWidth=v.width,f.miterLimit=v.miterlimit,f.setLineDash(v.dasharray),f.lineDashOffset=v.dashoffset;const N=v.opacity/255;switch(v.paint){case"rgb_color":f.strokeStyle=zN(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=G_e(f,c.linear_gradients[v.linear_gradient_idx],N,g,!0);break;case"radial_gradient_idx":f.strokeStyle=K_e(f,c.radial_gradients[v.radial_gradient_idx],N,g,!0)}switch(v.linejoin){case A6.LINE_JOIN_MITER_CLIP:case A6.LINE_JOIN_MITER:f.lineJoin="miter";break;case A6.LINE_JOIN_ROUND:f.lineJoin="round";break;case A6.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(v.linecap){case Poe.LINE_CAP_BUTT:f.lineCap="butt";break;case Poe.LINE_CAP_ROUND:f.lineCap="round";break;case Poe.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(k)}function G_e(f,c,u,g,v=!1){if(c.stops.length===1){const X=c.stops[0];return zN(X.rgb_color,X.opacity*u,g)}const{x1:k,y1:N,x2:I,y2:R}=c;let $=new DOMPoint(k,N),W=new DOMPoint(I,R);if(v){const X=BN(c.transform);$=X.transformPoint($),W=X.transformPoint(W)}const G=f.createLinearGradient($.x,$.y,W.x,W.y);for(const X of c.stops)G.addColorStop(X.offset,zN(X.rgb_color,X.opacity*u,g));return G}function K_e(f,c,u,g,v=!1){if(c.stops.length===1){const Ne=c.stops[0];return zN(Ne.rgb_color,Ne.opacity*u,g)}const k=BN(c.transform),{fx:N,fy:I,fr:R,cx:$,cy:W,r:G}=c;let X=new DOMPoint(N,I),te=new DOMPoint($,W),se=R,me=G;if(v){X=k.transformPoint(X),te=k.transformPoint(te);const Ne=(k.a+k.d)/2;se=R*Ne,me=c.r*Ne}const Se=f.createRadialGradient(X.x,X.y,se,te.x,te.y,me);for(const Ne of c.stops)Se.addColorStop(Ne.offset,zN(Ne.rgb_color,Ne.opacity*u,g));return Se}function Z_e(f,c,u,g){const v=g.transform?BN(g.transform).preMultiplySelf(c):c,k=mM(f.canvas.width,f.canvas.height),N=k.getContext("2d");for(const R of g.children)if(R.group)Z_e(N,v,u,R.group);else if(R.path){const $=R.path,W=new Path2D;W.addPath(J_e($),v),N.fill(W,H_e($))}const I=g.clip_path_idx!=null?u.clip_paths[g.clip_path_idx]:null;I&&Y_e(N,v,u,I),f.globalCompositeOperation="source-over",f.drawImage(k,0,0)}function Y_e(f,c,u,g){const v=mM(f.canvas.width,f.canvas.height);Z_e(v.getContext("2d"),c,u,g),f.globalCompositeOperation="destination-in",f.drawImage(v,0,0)}function X_e(f,c,u,g,v){if(g.children.length===0)return;const k=g.mask_idx!=null?u.masks[g.mask_idx]:null;k&&X_e(f,c,u,k,v);const N=f.canvas.width,I=f.canvas.height,R=mM(N,I),$=R.getContext("2d"),W=g.width,G=g.height,X=g.left,te=g.top,se=new Path2D,me=new Path2D;me.rect(X,te,W,G),se.addPath(me,c),$.clip(se);for(const Oe of g.children)q_e($,c,u,Oe,v);const Se=$.getImageData(0,0,N,I),Ne=Se.data;if(g.mask_type===z_e.MASK_TYPE_LUMINANCE)for(let Oe=0;Oec[N])return null}else{const I=1/g[N];let R=(f[N]-u[N])*I,$=(c[N]-u[N])*I;if(R>$){const W=R;R=$,$=W}if(R>v&&(v=R),$k)return null}return v}function r2e(f,c,u,g,v,k,N,I,R,$,W){const G=g-f,X=v-c,te=k-u,se=N-f,me=I-c,Se=R-u,Ne=W[1]*Se-W[2]*me,Oe=W[2]*se-W[0]*Se,Fe=W[0]*me-W[1]*se,He=G*Ne+X*Oe+te*Fe;if(Math.abs(He)<1e-15)return null;const dt=1/He,it=$[0]-f,gt=$[1]-c,Nt=$[2]-u,Tt=(it*Ne+gt*Oe+Nt*Fe)*dt;if(Tt<0||Tt>1)return null;const Gt=gt*te-Nt*X,Dt=Nt*G-it*te,tr=it*X-gt*G,or=(W[0]*Gt+W[1]*Dt+W[2]*tr)*dt;return or<0||Tt+or>1?null:(se*Gt+me*Dt+Se*tr)*dt}function n2e(f,c,u){return(f-c)/(u-c)}function s2e(f,c,u,g,v,k,N,I,R){const $=1<{const Oe=Se?1:0,Fe=(te+1)*me-Oe,He=se*me,dt=(se+1)*me-Oe;Ne[0]=te*me,Ne[1]=He,Ne[2]=Fe,Ne[3]=dt};let G=new e2e(R);const X=[];for(let te=0;te=1;R/=2){const te=I[I.length-1];G=new e2e(R);for(let se=0;se0;){const{idx:se,t:me,nodex:Se,nodey:Ne,depth:Oe}=te.pop();if(this.leaves[se]){s2e(Se,Ne,Oe,c,u,g,v,G,X);const He=1<=vr[2])return me}continue}let Fe=0;for(let He=0;He=$[W[Nt]]&&(W.splice(Nt,0,He),gt=!0);gt||(W[Fe]=He),Fe++}}for(let He=0;He=this.dim+1||u<-1||u>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(u+1)*this.stride+(c+1)}static pack(c,u){const g=[0,0,0,0],v=O6.getUnpackVector(u);let k=Math.floor((c+v[3])/v[2]);return g[2]=k%256,k=Math.floor(k/256),g[1]=k%256,k=Math.floor(k/256),g[0]=k,g}getPixels(){return new e1e({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,u,g){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let v=u*this.dim,k=u*this.dim+this.dim,N=g*this.dim,I=g*this.dim+this.dim;switch(u){case-1:v=k-1;break;case 1:k=v+1}switch(g){case-1:N=I-1;break;case 1:I=N+1}const R=-u*this.dim,$=-g*this.dim;for(let W=N;W=1;g--){const v=g===1?1:0,k=g===2?1:0;for(let N=0;N>>1^-(1&f[c]);return f}function EHe(f,c){switch(c){case"uint32":return f;case"uint16":for(let u=0;u>4|(61440&g)>>8|(240&v)<<4|61440&v,f[u+1]=15&g|(3840&g)>>4|(15&v)<<8|(3840&v)<<4}return f;case"uint8":for(let u=0;u>6|(192&v)>>4|(192&k)>>2|192&N,f[u+1]=(48&g)>>4|(48&v)>>2|48&k|(48&N)<<2,f[u+2]=(12&g)>>2|12&v|(12&k)<<2|(12&N)<<4,f[u+3]=3&g|(3&v)<<2|(3&k)<<4|(3&N)<<6}return f;default:throw new Error(`Invalid pixel format, "${c}"`)}}Qr(O6,"DEMData"),Qr(i2e,"DemMinMaxQuadTree",{omit:["dem"]});var Ih=Uint8Array,xM=Uint16Array,IHe=Int32Array,o2e=new Ih([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]),l2e=new Ih([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]),PHe=new Ih([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c2e=function(f,c){for(var u=new xM(31),g=0;g<31;++g)u[g]=c+=1<>1|(21845&al)<<1;h2e[al]=((65280&($N=(61680&($N=(52428&$N)>>2|(13107&$N)<<2))>>4|(3855&$N)<<4))>>8|(255&$N)<<8)>>1}var yM=function(f,c,u){for(var g=f.length,v=0,k=new xM(c);v>R]=$;return N},vM=new Ih(288);for(al=0;al<144;++al)vM[al]=8;for(al=144;al<256;++al)vM[al]=9;for(al=256;al<280;++al)vM[al]=7;for(al=280;al<288;++al)vM[al]=8;var f2e=new Ih(32);for(al=0;al<32;++al)f2e[al]=5;var DHe=yM(vM,9),RHe=yM(f2e,5),Roe=function(f){for(var c=f[0],u=1;uc&&(c=f[u]);return c},Op=function(f,c,u){var g=c/8|0;return(f[g]|f[g+1]<<8)>>(7&c)&u},Foe=function(f,c){var u=c/8|0;return(f[u]|f[u+1]<<8|f[u+2]<<16)>>(7&c)},FHe=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Dp=function(f,c,u){var g=new Error(c||FHe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Dp),!u)throw g;return g},zHe=new Ih(0),BHe=typeof TextDecoder<"u"&&new TextDecoder;try{BHe.decode(zHe,{stream:!0})}catch{}const $He={gzip_data:"gzip"};class wf extends Error{constructor(c){super(c),this.name="MRTError"}}const UHe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},p2e={uint32:1,uint16:2,uint8:4},qHe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let zoe;class D6{constructor(c=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=c}getLayer(c){const u=this.layers[c];if(!u)throw new wf(`Layer '${c}' not found`);return u}getHeaderLength(c){const u=new Uint8Array(c),g=new DataView(c);if(u[0]!==13)throw new wf("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(c){const u=new Uint8Array(c),g=this.getHeaderLength(c);if(u.length= ${g} but got buffer of length ${u.length}`);const v=new zoe(u.subarray(0,g)).readFields(bHe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==v.x||this.y!==v.y||this.z!==v.z))throw new wf(`Invalid attempt to parse header ${v.z}/${v.x}/${v.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=v.x,this.y=v.y,this.z=v.z;for(const k of v.layers)this.layers[k.name]=new m2e(k,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const u=[],g=this.getLayer(c.layerName);for(let v of c.blockIndices){const k=g.dataIndex[v],N=k.firstByte-c.firstByte,I=k.lastByte-c.firstByte;if(g._blocksInProgress.has(v))continue;const R={layerName:g.name,firstByte:N,lastByte:I,pixelFormat:g.pixelFormat,blockIndex:v,blockShape:[k.bands.length].concat(g.bandShape),buffer:g.buffer,codec:k.codec.codec,filters:k.filters.map($=>$.filter)};g._blocksInProgress.add(v),u.push(R)}return new g2e(u,()=>{u.forEach(v=>g._blocksInProgress.delete(v.blockIndex))},(v,k)=>{if(u.forEach(N=>g._blocksInProgress.delete(N.blockIndex)),v)throw v;k.forEach(N=>{this.getLayer(N.layerName).processDecodedData(N)})})}}class m2e{constructor({version:c,name:u,units:g,tileSize:v,pixelFormat:k,buffer:N,dataIndex:I},R){if(this.version=c,this.version!==1)throw new wf(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=u,this.units=g,this.tileSize=v,this.buffer=N,this.pixelFormat=UHe[k],this.dataIndex=I,this.bandShape=[v+2*N,v+2*N,p2e[this.pixelFormat]],this._decodedBlocks=new L6(R?R.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return p2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:c})=>c).flat()}processDecodedData(c){const u=c.blockIndex.toString();this._decodedBlocks.get(u)||this._decodedBlocks.put(u,c.data)}getBlockForBand(c){let u=0;switch(typeof c){case"string":for(const[g,v]of this.dataIndex.entries()){for(const[k,N]of v.bands.entries())if(N===c)return{bandIndex:u+k,blockIndex:g,blockBandIndex:k};u+=v.bands.length}break;case"number":for(const[g,v]of this.dataIndex.entries()){if(c>=u&&cthis.cacheSize)throw new wf(`Number of blocks to decode (${k.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:u,lastByte:g,blockIndices:v}}hasBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0}hasDataForBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0&&!!this._decodedBlocks.get(u.toString())}getBandView(c){const{blockIndex:u,blockBandIndex:g}=this.getBlockForBand(c);if(u<0)throw new wf(`Band not found: ${JSON.stringify(c)}`);const v=this._decodedBlocks.get(u.toString());if(!v)throw new wf(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const k=this.dataIndex[u],N=this.bandShape.reduce(($,W)=>$*W,1),I=g*N,R=v.subarray(I,I+N);return{data:R,bytes:new Uint8Array(R.buffer).subarray(R.byteOffset,R.byteOffset+R.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:k.offset,scale:k.scale}}}D6.setPbf=function(f){zoe=f};class g2e{constructor(c,u,g){this.tasks=c,this._onCancel=u,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,u){this._finalized||(this._onComplete(c,u),this._finalized=!0)}}D6.performDecoding=function(f,c){const u=new Uint8Array(f);return Promise.all(c.tasks.map(g=>{const{layerName:v,firstByte:k,lastByte:N,pixelFormat:I,blockShape:R,blockIndex:$,filters:W,codec:G}=g,X=u.subarray(k,N+1),te=new Uint32Array(R[0]*R[1]*R[2]);let se;if(G!=="gzip_data")throw new wf(`Unhandled codec: ${G}`);return se=function(me,Se){if(!globalThis.DecompressionStream&&Se==="gzip_data")return Promise.resolve(((He=function(gt){gt[0]==31&>[1]==139&>[2]==8||Dp(6,"invalid gzip data");var Nt=gt[3],Tt=10;4&Nt&&(Tt+=2+(gt[10]|gt[11]<<8));for(var Gt=(Nt>>3&1)+(Nt>>4&1);Gt>0;Gt-=!gt[Tt++]);return Tt+(2&Nt)}(Fe=me))+8>Fe.length&&Dp(6,"invalid gzip data"),function(gt,Nt,Tt,Gt){var Dt=gt.length;if(!Dt||Nt.f&&!Nt.l)return Tt||new Ih(0);var tr=!Tt,or=tr||Nt.i!=2,lr=Nt.i;tr&&(Tt=new Ih(3*Dt));var xr,vr,hr=function(Di){var hi=Tt.length;if(Di>hi){var yi=new Ih(Math.max(2*hi,Di));yi.set(Tt),Tt=yi}},pr=Nt.f||0,er=Nt.p||0,Zt=Nt.b||0,mr=Nt.l,Tr=Nt.d,jr=Nt.m,hn=Nt.n,Ur=8*Dt;do{if(!mr){pr=Op(gt,er,1);var Zr=Op(gt,er+1,3);if(er+=3,!Zr){var rn=gt[(nr=4+((er+7)/8|0))-4]|gt[nr-3]<<8,gs=nr+rn;if(gs>Dt){lr&&Dp(0);break}or&&hr(Zt+rn),Tt.set(gt.subarray(nr,gs),Zt),Nt.b=Zt+=rn,Nt.p=er=8*gs,Nt.f=pr;continue}if(Zr==1)mr=DHe,Tr=RHe,jr=9,hn=5;else if(Zr==2){var kr=Op(gt,er,31)+257,sn=Op(gt,er+10,15)+4,qn=kr+Op(gt,er+5,31)+1;er+=14;for(var Ds=new Ih(qn),Us=new Ih(19),rs=0;rs>4)<16)Ds[rs++]=nr;else{var Dr=0,Rr=0;for(nr==16?(Rr=3+Op(gt,er,3),er+=2,Dr=Ds[rs-1]):nr==17?(Rr=3+Op(gt,er,7),er+=3):nr==18&&(Rr=11+Op(gt,er,127),er+=7);Rr--;)Ds[rs++]=Dr}}var pn=Ds.subarray(0,kr),xn=Ds.subarray(kr);jr=Roe(pn),hn=Roe(xn),mr=yM(pn,jr),Tr=yM(xn,hn)}else Dp(1);if(er>Ur){lr&&Dp(0);break}}or&&hr(Zt+131072);for(var Jn=(1<>4;if((er+=15&Dr)>Ur){lr&&Dp(0);break}if(Dr||Dp(2),Es<256)Tt[Zt++]=Es;else{if(Es==256){ps=er,mr=null;break}var Ln=Es-254;Es>264&&(Ln=Op(gt,er,(1<<(ai=o2e[rs=Es-257]))-1)+u2e[rs],er+=ai);var Un=Tr[Foe(gt,er)&cs],ti=Un>>4;if(Un||Dp(3),er+=15&Un,xn=OHe[ti],ti>3){var ai=l2e[ti];xn+=Foe(gt,er)&(1<Ur){lr&&Dp(0);break}or&&hr(Zt+131072);var oi=Zt+Ln;if(Ztxr.length)&&(vr=xr.length),new Ih(xr.subarray(0,vr))):Tt.subarray(0,Zt)}(Fe.subarray(He,-8),{i:2},new Ih(((Ne=Fe)[(Oe=Ne.length)-4]|Ne[Oe-3]<<8|Ne[Oe-2]<<16|Ne[Oe-1]<<24)>>>0))));var Ne,Oe,Fe,He;const dt=$He[Se];if(!dt)throw new Error(`Unhandled codec: ${Se}`);const it=new globalThis.DecompressionStream(dt);return new Response(new Blob([me]).stream().pipeThrough(it)).arrayBuffer().then(gt=>new Uint8Array(gt))}(X,G).then(me=>(function(Se,Ne){Se.readFields(CHe,Ne)}(new zoe(me),te),new qHe[I](te.buffer))),se.then(me=>{for(let Se=W.length-1;Se>=0;Se--)switch(W[Se]){case"delta_filter":THe(me,R);break;case"zigzag_filter":AHe(me);break;case"bitshuffle_filter":EHe(me,I);break;default:throw new wf(`Unhandled filter "${W[Se]}"`)}return{layerName:v,blockIndex:$,data:me}}).catch(me=>{throw me})}))},Qr(g2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Qr(D6,"MapboxRasterTile"),Qr(m2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class x2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let u=0;u=0&&X[3]>=0&&$.insert(R,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new zt(new h6(this.rawTileData)).layers,this.sourceLayerCoder=new x2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const c in this.vtLayers)this.vtFeatures[c]=[]}return this.vtLayers}query(c,u){const{tilespaceGeometry:g,transform:v,tileTransform:k,pixelPosMatrix:N,availableImages:I,worldview:R}=u;this.loadVTLayers(),this.serializedLayersCache.clear();const $=u.queryRadius?u.queryRadius:0,W=g.bufferedTilespaceBounds,G=this.grid.query(W.min.x,W.min.y,W.max.x,W.max.y,(me,Se,Ne,Oe)=>rd(g.bufferedTilespaceGeometry,me-$,Se-$,Ne+$,Oe+$));G.sort(VHe);let X=null;v.elevation&&G.length>0&&(X=FN.create(v.elevation,this.tileID));const te={};let se;for(let me=0;me(Oe||(Oe=bt(Fe,this.tileID.canonical,k)),He.queryIntersectsFeature(g,Fe,dt,Oe,this.z,v,N,X,it)))}return te}loadMatchingFeature(c,u,g,v,k,N){const{featureIndex:I,bucketIndex:R,sourceLayerIndex:$,layoutVertexArrayOffset:W}=u,G=this.bucketLayerIDs[R],X=g.layers,te=Object.keys(X);if(te.length&&!Xr(te,G))return;const se=g.sourceCache,me=this.sourceLayerCoder.decode($),Se=this.vtLayers[me].feature(I),Ne=this.getId(Se,me);for(let Oe=0;Oe`${I.key}: ${I.message}`).join(", ");return void Vr(`Failed to create expression for promoteId: ${N}`)}this.promoteIdExpression=k.value}g=this.promoteIdExpression.evaluate({zoom:0},c)}else g=c.properties[v];typeof g=="boolean"&&(g=Number(g))}return g}}function v2e(f,c,u,g,v){return Ut(f,(k,N)=>{const I=c instanceof ex?c.get(N):null;return I&&I.evaluate?I.evaluate(u,g,void 0,v):I})}function VHe(f,c){return c-f}Qr(y2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const _2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Boe{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[u,g]=new Uint8Array(c,0,2);if(u!==219)throw new Error("Data does not appear to be in a KDBush format.");const v=g>>4;if(v!==1)throw new Error(`Got v${v} data when expected v1.`);const k=_2e[15&g];if(!k)throw new Error("Unrecognized array type.");const[N]=new Uint16Array(c,2,1),[I]=new Uint32Array(c,4,1);return new Boe(I,N,k,c)}constructor(c,u=64,g=Float64Array,v){if(isNaN(c)||c<0)throw new Error(`Unpexpected numItems value: ${c}.`);this.numItems=+c,this.nodeSize=Math.min(Math.max(+u,2),65535),this.ArrayType=g,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const k=_2e.indexOf(this.ArrayType),N=2*c*this.ArrayType.BYTES_PER_ELEMENT,I=c*this.IndexArrayType.BYTES_PER_ELEMENT,R=(8-I%8)%8;if(k<0)throw new Error(`Unexpected typed array class: ${g}.`);v&&v instanceof ArrayBuffer?(this.data=v,this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+I+R,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+N+I+R),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+I+R,2*c),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=u,new Uint32Array(this.data,4,1)[0]=c)}add(c,u){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=c,this.coords[this._pos++]=u,g}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return $oe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,u,g,v){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:N,nodeSize:I}=this,R=[0,k.length-1,0],$=[];for(;R.length;){const W=R.pop()||0,G=R.pop()||0,X=R.pop()||0;if(G-X<=I){for(let Se=X;Se<=G;Se++){const Ne=N[2*Se],Oe=N[2*Se+1];Ne>=c&&Ne<=g&&Oe>=u&&Oe<=v&&$.push(k[Se])}continue}const te=X+G>>1,se=N[2*te],me=N[2*te+1];se>=c&&se<=g&&me>=u&&me<=v&&$.push(k[te]),(W===0?c<=se:u<=me)&&(R.push(X),R.push(te-1),R.push(1-W)),(W===0?g>=se:v>=me)&&(R.push(te+1),R.push(G),R.push(1-W))}return $}within(c,u,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:k,nodeSize:N}=this,I=[0,v.length-1,0],R=[],$=g*g;for(;I.length;){const W=I.pop()||0,G=I.pop()||0,X=I.pop()||0;if(G-X<=N){for(let Se=X;Se<=G;Se++)w2e(k[2*Se],k[2*Se+1],c,u)<=$&&R.push(v[Se]);continue}const te=X+G>>1,se=k[2*te],me=k[2*te+1];w2e(se,me,c,u)<=$&&R.push(v[te]),(W===0?c-g<=se:u-g<=me)&&(I.push(X),I.push(te-1),I.push(1-W)),(W===0?c+g>=se:u+g>=me)&&(I.push(te+1),I.push(G),I.push(1-W))}return R}}function $oe(f,c,u,g,v,k){if(v-g<=u)return;const N=g+v>>1;b2e(f,c,N,g,v,k),$oe(f,c,u,g,N-1,1-k),$oe(f,c,u,N+1,v,1-k)}function b2e(f,c,u,g,v,k){for(;v>g;){if(v-g>600){const $=v-g+1,W=u-g+1,G=Math.log($),X=.5*Math.exp(2*G/3),te=.5*Math.sqrt(G*X*($-X)/$)*(W-$/2<0?-1:1);b2e(f,c,u,Math.max(g,Math.floor(u-W*X/$+te)),Math.min(v,Math.floor(u+($-W)*X/$+te)),k)}const N=c[2*u+k];let I=g,R=v;for(_M(f,c,g,u),c[2*v+k]>N&&_M(f,c,g,v);IN;)R--}c[2*g+k]===N?_M(f,c,g,R):(R++,_M(f,c,R,v)),R<=u&&(g=R+1),u<=R&&(v=R-1)}}function _M(f,c,u,g){Uoe(f,u,g),Uoe(c,2*u,2*g),Uoe(c,2*u+1,2*g+1)}function Uoe(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function w2e(f,c,u,g){const v=f-u,k=c-g;return v*v+k*k}a.$=yk,a.A=gp,a.B=Mh,a.C=2,a.D=NN,a.E=Hg,a.F=tM,a.G=Kve,a.H=xk,a.I=Ic,a.J=MP,a.K=un,a.L=jy,a.M=Uk,a.N=Av,a.O=mP,a.P=ir,a.Q=Ev,a.R=qg,a.S=Qk,a.T=Yae,a.U=$m,a.V=M6,a.W=l5,a.X=My,a.Y=Cy,a.Z=kv,a._=Jc,a.a=function(f){return Cs.API_CDN_URL_REGEX.test(f)},a.a$=le,a.a0=$n,a.a1=Wu,a.a2=xf,a.a3=class extends M6{},a.a4=qk,a.a5=pP,a.a6=Rt,a.a7=function(f){const c=f.value;return c?$n(c)?Coe(c,!0)?[]:[new M6(f.key,c,`invalid url "${c}"`)]:[new M6(f.key,c,`string expected, "${un(c)}" found`)]:[]},a.a8=kP,a.a9=$a,a.aA=we,a.aB=T,a.aC=wt,a.aD=mc,a.aE=qi,a.aF=B,a.aG=qe,a.aH=function(f,c){const u={};for(let g=0;g{g(k,N)},c):g(k,N),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=u((k,N)=>{v.result=[k,N];for(const I of v.callbacks)this.scheduler?this.scheduler.add(()=>{I(k,N)},c):I(k,N);setTimeout(()=>delete this.entries[f],3e3)})),()=>{v.result||(v.callbacks=v.callbacks.filter(k=>k!==g),v.callbacks.length||(v.cancel(),delete this.entries[f]))}}},a.aL=function(f,c,u){const g=JSON.stringify(f.request);return f.data&&(this.deduped.entries[g]={result:[null,f.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:f.isSymbolTile,zoom:f.tileZoom},v=>{const k=Hu(f.request,(N,I,R)=>{N?v(N):I&&v(null,{rawData:I,vectorTile:u?void 0:new zt(new h6(I)),responseHeaders:new Map(R.entries())})});return()=>{k.cancel(),v()}},c)},a.aM=function(f){return f?{cacheControl:f.get("Cache-Control"),expires:f.get("Expires")}:{cacheControl:void 0,expires:void 0}},a.aN=Yc,a.aO=function(f){$d++,$d>Am&&(f.getActor().send("enforceCacheSizeLimit",up),$d=0)},a.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},a.aQ=Ra,a.aR=j_e,a.aS=T_e,a.aT=m,a.aU=w_e,a.aV=function(f,c){const u=document.createElement("video");u.muted=!0,u.onloadstart=function(){c(null,u)};for(let g=0;g{}}},a.aW=Y5,a.aX=t_,a.aY=Lt,a.aZ=iM,a.a_=Q,a.aa=Nr,a.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return Qn(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u),azimuthal:Fn(f.azimuthal,c.azimuthal,u),polar:Fn(f.polar,c.polar,u)}}},a.ac=Ji,a.ad=Xg,a.ae=$e,a.af=Ye,a.ag=ye,a.ah=De,a.ai=ex,a.aj=Gy,a.ak=Fn,a.al=Mr,a.am=E3,a.an=ss,a.ao=wi,a.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([u,g]){const v=Qn([1,u,g]);return{x:v.x,y:v.y,z:v.z}}(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u)}}},a.aq=function(f,c,u=0,g=!0){const v=new ir(u,u),k=f.sub(v),N=c.add(v),I=[k,new ir(N.x,k.y),N,new ir(k.x,N.y)];return g&&I.push(k.clone()),I},a.ar=function(f,c){const u=[];for(let g=0;g1)return!1;const u=c.getSource().maxzoom,g=1<1)return c;const v=g.getSource().maxzoom,k=1<{const I=this.getAtTileOffset(f,v,k,N),R=g.upVector(f.canonical,v.x,v.y);return ae(R,R,I*g.upVectorScale(f.canonical,c,u).metersToTile),R}}getForTilePoints(f,c,u,g){if(this.isUsingMockSource())return!1;const v=FN.create(this,f,g);return!!v&&(c.forEach(k=>{k[2]=this.exaggeration()*v.getElevationAt(k[0],k[1],u)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(f);if(!c||!c.dem)return null;const u=c.dem.tree,g=c.tileID,v=1<0&&(g+=(f[v]-0)*(f[v]-0)),c[v]<0&&(g+=(0-c[v])*(0-c[v]));return g},a.c0=j1e,a.c1=uoe,a.c2=t_e,a.c3=voe,a.c4=Boe,a.c5=ae,a.c6=Be,a.c7=It,a.c8=function(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],N=c[3],I=Math.sin(u),R=Math.cos(u);return f[0]=g*R+v*I,f[1]=v*R-g*I,f[2]=k*R+N*I,f[3]=N*R-k*I,f},a.c9=jt,a.cA=be,a.cB=ui,a.cC=ove,a.cD=Vi,a.cE=F0e,a.cF=function(f,c,u,g,v,k,N,I,R){if(R.name==="globe")return F0e(f,c,new Vi(u,g,v),!1);const $=iM({z:u,x:g,y:v},R);return new dn([(k+$.x/$.scale)*c,c*($.y/$.scale),N],[(k+$.x2/$.scale)*c,c*($.y2/$.scale),I])},a.cG=function(f,c,u){return f[0]=Math.min(c[0],u[0]),f[1]=Math.min(c[1],u[1]),f[2]=Math.min(c[2],u[2]),f[3]=Math.min(c[3],u[3]),f},a.cH=function(f,c,u){return f[0]=Math.max(c[0],u[0]),f[1]=Math.max(c[1],u[1]),f[2]=Math.max(c[2],u[2]),f[3]=Math.max(c[3],u[3]),f},a.cI=function(f){const c=Math.round((f+45+360)%360/90)%4;return Bd[c]},a.cJ=ce,a.cK=tt,a.cL=wN,a.cM=function(f){const c=A(new Float64Array(16));T(c,f.pixelMatrix,f.globeMatrix);const u=[0,Qu,0],g=[0,Ju,0];return Ye(u,u,c),Ye(g,g,c),[u[0]>0&&u[0]<=f.width&&u[1]>0&&u[1]<=f.height&&!Cae(f,new m(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!Cae(f,new m(f.center.lat,-90))]},a.cN=function(f,c){const{scale:u}=f.tileTransform,g=u*Mr/(f.tileSize*Math.pow(2,c.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(v,k,N){var I=k[1],R=k[2],$=k[3],W=N[0],G=N[1];return v[0]=k[0]*W,v[1]=I*W,v[2]=R*G,v[3]=$*G,v}(new Float32Array(4),c.inverseAdjustmentMatrix,[g,g])},a.cO=a6,a.cP=he,a.cQ=ave,a.cR=function(f){const c=ave(f,!0);return x([],[c[0],c[1],c[4],c[5]])},a.cS=z,a.cT=$r,a.cU=F,a.cV=function(f){const{x:c,y:u}=f.point,{lng:g,lat:v}=f._center;return $0e(c,u,f.worldSize,g,v)},a.cW=Ee,a.cX=vo,a.cY=Ia,a.cZ=ec,a.c_=Xu,a.ca=Oa,a.cb=function(f,c){return f[0]=-c[0],f[1]=-c[1],f[2]=-c[2],f[3]=c[3],f},a.cc=ue,a.cd=function(f,c,u,g,v){var k=1/Math.tan(c/2);if(f[0]=k/u,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=k,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=-1,f[12]=0,f[13]=0,f[15]=0,v!=null&&v!==1/0){var N=1/(g-v);f[10]=(v+g)*N,f[14]=2*v*g*N}else f[10]=-1,f[14]=-2*g;return f},a.ce=function(f,c,u,g,v,k,N){var I=1/(c-u),R=1/(g-v),$=1/(k-N);return f[0]=-2*I,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*R,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*$,f[11]=0,f[12]=(c+u)*I,f[13]=(v+g)*R,f[14]=(N+k)*$,f[15]=1,f},a.cf=Y,a.cg=function(f,c,u){f[4*c+0]=u[0],f[4*c+1]=u[1],f[4*c+2]=u[2],f[4*c+3]=u[3]},a.ch=yN,a.ci=Bv,a.cj=$o,a.ck=_f,a.cl=Uv,a.cm=h_e,a.cn=function(){var f=new p(4);return p!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f},a.co=function(f,c,u){var g=c[0],v=c[1],k=c[2],N=c[3],I=Math.sin(u),R=Math.cos(u);return f[0]=g*R+k*I,f[1]=v*R+N*I,f[2]=g*-I+k*R,f[3]=v*-I+N*R,f},a.cp=function(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]&&f[3]===c[3]},a.cq=nt,a.cr=function(f){var c=f[0],u=f[1],g=f[2],v=f[3];return Math.sqrt(c*c+u*u+g*g+v*v)},a.cs=Jr,a.ct=mt,a.cu=_o,a.cv=3,a.cw=2,a.cx=7,a.cy=6,a.cz=Te,a.d=function(f){return Cs.API_TILEJSON_REGEX.test(f)},a.d$=class{constructor(f,c,u,g){this.context=f,this.format=g,this.size=u,this.texture=f.gl.createTexture();const[v,k,N]=this.size,{gl:I}=f;I.bindTexture(I.TEXTURE_3D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&I.texImage3D(I.TEXTURE_3D,0,this.format,v,k,N,0,Kae(this.format),Zae(this.format),c.data)}bind(f,c){const{context:u}=this,{gl:g}=u;g.bindTexture(g.TEXTURE_3D,this.texture),f!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,f),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,f),this.minFilter=f),c!==this.wrapS&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_S,c),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_T,c),this.wrapS=c)}destroy(){const{gl:f}=this.context;f.deleteTexture(this.texture),this.texture=null}},a.d0=function(f){return f*f*f*f*f},a.d1=D,a.d2=45,a.d3=vN,a.d4=function(f,c,u){const g=Math.sqrt(f*f+c*c+u*u),v=g>0?Math.acos(u/g)*yo:0;let k=f!==0||c!==0?Math.atan2(-c,-f)*yo+90:0;return k<0&&(k+=360),[g,k,v]},a.d5=ie,a.d6=Qn,a.d7=Pe,a.d8=de,a.d9=dn,a.dA=function(f){return f({pluginStatus:ed,pluginURL:wp}),Yk.on("pluginStateChange",f),f},a.dB=$v,a.dC=class extends Np{constructor(f){super(f),this.current=_N}set(f,c,u){if(this.fetchUniformLocation(f,c)){for(let g=0;g<9;g++)if(u[g]!==this.current[g]){this.current=u,this.gl.uniformMatrix3fv(this.location,!1,u);break}}}},a.dD=_r,a.dE=function(f,c,u){const g=Gy(u.zoom),v=f.style.map._antialias,k=f.terrain&&f.terrain.exaggeration()>0;return g===0&&!v&&!k},a.dF=function(f){const c=f.pixelsPerMeter,u=c/Y(1,f.center.lat),g=A(new Float64Array(16));return O(g,g,[f.point.x,f.point.y,0]),z(g,g,[u,u,c]),Float32Array.from(g)},a.dG=VP,a.dH=function(f){const c=ce-5;f=we(f,-c,c)/c*90;const u=Math.pow(Math.abs(Math.sin(ss(f))),3);return Math.round(u*(P5.length-1))},a.dI=function(f,c,u,g){const v=c.getNorth(),k=c.getSouth(),N=c.getWest(),I=c.getEast(),R=1<0){const se=180/g;j(te,te,[se/$+1,0,0,0,se/W+1,0,-.5*se/G,.5*se/X,1])}return te[2]=R,te[5]=f.x,te[8]=f.y,te},a.dJ=Eh,a.dK=function(f,c,u){const g=A(new Float64Array(16)),v=(c/(1<({u_matrix:new Uv(f),u_texsize:new _f(f),u_pixels_to_tile_units:new bN(f),u_device_pixel_ratio:new $o(f),u_width_scale:new $o(f),u_floor_width_scale:new $o(f),u_image:new yN(f),u_units_to_pixels:new _f(f),u_tile_units_to_pixels:new $o(f),u_alpha_discard_threshold:new $o(f),u_trim_offset:new _f(f),u_trim_fade_range:new _f(f),u_trim_color:new vN(f),u_zbias_factor:new $o(f),u_tile_to_meter:new $o(f),u_ground_shadow_factor:new Bv(f),u_pattern_transition:new $o(f)}),a.dX=f=>({u_matrix:new Uv(f),u_pixels_to_tile_units:new bN(f),u_device_pixel_ratio:new $o(f),u_width_scale:new $o(f),u_floor_width_scale:new $o(f),u_units_to_pixels:new _f(f),u_dash_image:new yN(f),u_gradient_image:new yN(f),u_image_height:new $o(f),u_texsize:new _f(f),u_tile_units_to_pixels:new $o(f),u_alpha_discard_threshold:new $o(f),u_trim_offset:new _f(f),u_trim_fade_range:new _f(f),u_trim_color:new vN(f),u_zbias_factor:new $o(f),u_tile_to_meter:new $o(f),u_ground_shadow_factor:new Bv(f)}),a.dY=f=>({u_camera_to_center_distance:new $o(f),u_extrude_scale:new bN(f),u_device_pixel_ratio:new $o(f),u_matrix:new Uv(f),u_inv_rot_matrix:new Uv(f),u_merc_center:new _f(f),u_tile_id:new Bv(f),u_zoom_transition:new $o(f),u_up_dir:new Bv(f),u_emissive_strength:new $o(f)}),a.dZ=cN,a.d_=tVe,a.da=_e,a.db=function(f){return[Math.pow(f[0],1/2.2),Math.pow(f[1],1/2.2),Math.pow(f[2],1/2.2)]},a.dc=ive,a.dd=roe,a.de=dve,a.df=Coe,a.dg=function(f,c){return f.readFields(eHe,{icons:[]},c)},a.dh=r6,a.di=LN,a.dj=goe,a.dk=_y,a.dl=Lv,a.dm=Uu,a.dn=hk,a.dp=ar,a.dq=function(f){const c=f.indexOf(nx);return c>=0?f.slice(0,c):f},a.dr=function(f){return f.indexOf(nx)>=0},a.ds=function(f){const c=f.lastIndexOf(nx);return c>=0?f.slice(c+1):""},a.dt=function(f){const c=[],u=f.id;return u===void 0&&c.push({message:`layers.${u}: missing required property "id"`}),f.render===void 0&&c.push({message:`layers.${u}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&c.push({message:`layers.${u}: property "renderingMode" must be either "2d" or "3d"`}),c},a.du=function(f,c,u,g){return f.type==="custom"?new GVe(f,c):new QVe[f.type](f,c,u,g)},a.dv=gr,a.dw=function(f){const c=f.indexOf(nx);return c>=0?f.slice(c+1):""},a.dx=class extends e_{constructor(f,c){super(f._vectorTileFeature,f._z,f._x,f._y,f.id),f.state&&(this.state=Object.assign({},f.state)),this.target=c.target,this.namespace=c.namespace,c.properties&&(this.properties=c.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=f.source,this.sourceLayer=f.sourceLayer,this.layer=f.layer)}toJSON(){const f=super.toJSON();return f.target=this.target,f.namespace=this.namespace,f}},a.dy=Yk,a.dz=mp,a.e=Cs,a.e$=fe,a.e0=V0e,a.e1=(f,c,u,g,v,k)=>{const N=f.transform,I=N.projection.name==="globe";let R;if(k.paint.get("circle-pitch-alignment")==="map")if(I){const W=B0e(N.zoom,c.canonical)*N._pixelsPerMercatorPixel;R=Float32Array.from([W,0,0,W])}else R=N.calculatePixelsToTileUnitsMatrix(u);else R=new Float32Array([N.pixelsToGLUnits[0],0,0,N.pixelsToGLUnits[1]]);const $={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(N.projection),u_matrix:f.translatePosMatrix(c.projMatrix,u,k.paint.get("circle-translate"),k.paint.get("circle-translate-anchor")),u_device_pixel_ratio:zo.devicePixelRatio,u_extrude_scale:R,u_inv_rot_matrix:xUe,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:k.paint.get("circle-emissive-strength")};if(I){$.u_inv_rot_matrix=g,$.u_merc_center=v,$.u_tile_id=[c.canonical.x,c.canonical.y,1<{const W=f.transform,G=W.pitch<15?jve(.07,.7,we((14-W.zoom)/5,0,1)):.07,X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Nve(f,c,u,g),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:W.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:v,u_width_scale:k,u_floor_width_scale:N,u_image:0,u_tile_units_to_pixels:kve(c,W),u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:I,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:G,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:R,u_pattern_transition:$}},a.e5=(f,c,u,g,v,k,N,I,R,$)=>{const W=f.transform,G=W.calculatePixelsToTileUnitsMatrix(c),X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none",te=W.pitch<15?jve(.07,.7,we((14-W.zoom)/5,0,1)):.07;return{u_matrix:Nve(f,c,u,g),u_pixels_to_tile_units:G,u_device_pixel_ratio:k,u_width_scale:N,u_floor_width_scale:I,u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:Cve(u)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:kve(c,f.transform),u_alpha_discard_threshold:0,u_trim_offset:R,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:te,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:$}},a.e6=Bt,a.e7=O5,a.e8=oe,a.e9=th,a.eA=function(f,c){var u=2*Math.acos(c[3]),g=Math.sin(u/2);return g>h?(f[0]=c[0]/g,f[1]=c[1]/g,f[2]=c[2]/g):(f[0]=1,f[1]=0,f[2]=0),u},a.eB=Aoe,a.eC=c6,a.eD=l6,a.eE=[1,1,1],a.eF=FN,a.eG=Qe,a.eH=function(f,c,u,g){var v=c[0],k=c[1],N=c[2],I=c[3];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=N+g*(u[2]-N),f[3]=I+g*(u[3]-I),f},a.eI=TN,a.eJ=du,a.eK=vf,a.eL=function(f,c,u,g,v,k,N,I,R,$,W,G,X,te,se,me){var Se=new p(16);return Se[0]=f,Se[1]=c,Se[2]=u,Se[3]=g,Se[4]=v,Se[5]=k,Se[6]=N,Se[7]=I,Se[8]=R,Se[9]=$,Se[10]=W,Se[11]=G,Se[12]=X,Se[13]=te,Se[14]=se,Se[15]=me,Se},a.eM=_,a.eN=$y,a.eO=j5,a.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ir(1/0,1/0),max:new ir(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(f,c=!1){const u=_1e(new ir(0,0),new ir(Mr,Mr),f),g=[];if(c&&!Dae(u,this._globalClipBounds))return g;for(const v of this._activeRegions){if(v.hiddenByOverlap||!Dae(u,v))continue;const k=WUe(v.min,v.max,f);g.push({min:k.min,max:k.max,sourceId:this._sourceIds[v.priority],footprint:v.footprint,footprintTileId:v.tileId,order:v.order,clipMask:v.clipMask,clipScope:v.clipScope})}return g}setSources(f){this._setSources(f.map(c=>({getSourceId:()=>c.cache.id,getFootprints:()=>{const u=[];for(const g of c.cache.getVisibleCoordinates()){const v=c.cache.getTile(g).buckets[c.layer];v&&v.updateFootprints(g.toUnwrapped(),u)}return u},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(f){const c=f.getFootprints();if(c.length===0)return;const u=f.getOrder(),g=f.getClipMask(),v=f.getClipScope();for(const k of c){if(!k.footprint)continue;const N=_1e(k.footprint.min,k.footprint.max,k.id);this._activeRegions.push({min:N.min,max:N.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:k.id,footprint:k.footprint,order:u,clipMask:g,clipScope:v})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,u)=>c.priority-u.priority||XP(c.min,u.min)||XP(c.max,u.max)||c.order-u.order||c.clipMask-u.clipMask||function(g,v){const k=(N,I)=>N+I;return g.length-v.length||g.reduce(k,"").localeCompare(v.reduce(k,""))}(c.clipScope,u.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let c=0;for(;!f&&c!==this._activeRegions.length;){const u=this._activeRegions[c],g=this._prevRegions[c];f=u.priority!==g.priority||!v1e(u,g)||u.order!==g.order||u.clipMask!==g.clipMask||!xo(u.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const u of this._activeRegions)u.order!==$5&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,u.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,u.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,u.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,u.max.y));const c=u=>{const g=this._activeRegions;if(u>=g.length)return u;const v=g[u].priority;for(;u1){let u=0,g=c(u);for(;u!==g;){let v=u;const k=u;for(;v!==g;){const N=this._activeRegions[v];N.hiddenByOverlap=!1;for(let I=0;I=0;c--)this._addSource(f[c]);this._computeReplacement()}},a.eQ=$5,a.eR=class{constructor(f){this._createGrid(f),this._createPoles(f)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const f of this._poleSegments)f.destroy();for(const f of this._gridSegments)f.withSkirts.destroy(),f.withoutSkirts.destroy()}_fillGridMeshWithLods(f,c){const u=new qm,g=new Bo,v=[],k=f+1+2,N=c[0]+1,I=c[0]+1+(1+c.length),R=($,W,G)=>{let X=$===k-1?$-2:$===0?$:$-1;return X+=G?24575:0,[X,W]};for(let $=0;$0?(Se=2*Math.sqrt(me+1),f[3]=.25*Se,f[0]=(G-te)/Se,f[1]=(X-R)/Se,f[2]=(I-$)/Se):N>W&&N>se?(Se=2*Math.sqrt(1+N-W-se),f[3]=(G-te)/Se,f[0]=.25*Se,f[1]=(I+$)/Se,f[2]=(X+R)/Se):W>se?(Se=2*Math.sqrt(1+W-N-se),f[3]=(X-R)/Se,f[0]=(I+$)/Se,f[1]=.25*Se,f[2]=(G+te)/Se):(Se=2*Math.sqrt(1+se-N-W),f[3]=(I-$)/Se,f[0]=(X+R)/Se,f[1]=(G+te)/Se,f[2]=.25*Se),f},a.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(c,u)=>String.fromCharCode(+("0x"+u))))},a.f0=function([f,c,u]){const g=Math.hypot(f,c,u),v=Math.atan2(f,u),k=.5*Math.PI-Math.acos(-c/g);return new m(vo(v),vo(k))},a.f1=ht,a.f2=Xae,a.f3=function(f){const c=f.navigator?f.navigator.userAgent:null;return!!function(u){if(Ka==null){const g=u.navigator?u.navigator.userAgent:null;Ka=!!u.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return Ka}(f)&&!(!c||!(c.match("Version/15.4")||c.match("Version/15.5")||c.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},a.f4=function(f,c){up=f,Am=c},a.f5=Cae,a.f6=U0e,a.f7=function(f){const c=[0,0,0],u=A(new Float64Array(16));return T(u,f.pixelMatrix,f.globeMatrix),Ye(c,c,u),new ir(c[0],c[1])},a.f8=function(){const f=G5;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Uae),G5=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},a.f9=function(){r6().acquire(Uae)},a.fA=O6,a.fB=Pt,a.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==eve){const u=new Uint32Array(f,0,7),[,,g,v,k,N]=u;c=u.byteLength+v+k+N+k,(g!==f.byteLength||c>=f.byteLength)&&Vr("Invalid b3dm header information.")}return sve(f,c)},a.fD=function(f,c){const u=roe(f);for(const g of u){for(const v of g.meshes)jqe(v);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(kqe(g.lights,c)))}return u},a.fE=T6,a.fF=Fs,a.fG=Z1e,a.fH=jp,a.fI=Ud,a.fJ=function(f){vd(),qu!=null&&qu.then(c=>{c.keys().then(u=>{for(let g=0;gVr(v.message))}).catch(u=>Vr(u.message))}).catch(c=>Vr(c.message))},a.fa=Ov,a.fb=function(f,c,u=!1){if(ed===Ud.deferred||ed===Ud.loading||ed===Ud.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");wp=zo.resolveURL(f),ed=Ud.deferred,h5=c,Zk(),u||jP()},a.fc=function(f){SN=zo.resolveURL(f),CN||(CN=new NN(r6(),new Hg)),CN.broadcast("setMeshoptUrl",SN)},a.fd=Q1e,a.fe=function(f){Hae=zo.resolveURL(f),CN||(CN=new NN(r6(),new Hg)),CN.broadcast("setDracoUrl",Hae)},a.ff=X1e,a.fg=W5,a.fh=function(f){const c=Zc();if(!c)return;const u=c.delete(Jl);f&&u.then(()=>f()).catch(f)},a.fi=Zv,a.fj=Qr,a.fk=Ky,a.fl=Lp,a.fm=x2e,a.fn=y2e,a.fo=vve,a.fp=Yt,a.fq="hd_road_elevation",a.fr=gi,a.fs=Ut,a.ft=ox,a.fu=moe,a.fv=Qv,a.fw=function(f,c,u,g,v,k,N,I=1,R,$,W){f.createArrays(),f.tilePixelRatio=Mr/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const G=f.layers[0].layout,X=f.layers[0]._unevaluatedLayout._values,te={};te.scaleFactor=I,te.textSizeScaleRange=G.get("text-size-scale-range"),te.iconSizeScaleRange=G.get("icon-size-scale-range");const[se,me]=te.textSizeScaleRange,[Se,Ne]=te.iconSizeScaleRange;te.textScaleFactor=we(te.scaleFactor,se,me),te.iconScaleFactor=we(te.scaleFactor,Se,Ne);const Oe=X["text-size"],Fe=X["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Tt,maxZoom:Gt}=f.textSizeData;te.compositeTextSizes=[Oe.possiblyEvaluate(new Ji(Tt,{worldview:W}),k),Oe.possiblyEvaluate(new Ji(Gt,{worldview:W}),k)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Tt,maxZoom:Gt}=f.iconSizeData;te.compositeIconSizes=[Fe.possiblyEvaluate(new Ji(Tt,{worldview:W}),k),Fe.possiblyEvaluate(new Ji(Gt,{worldview:W}),k)]}te.layoutTextSize=Oe.possiblyEvaluate(new Ji(N+1,{worldview:W}),k),te.layoutIconSize=Fe.possiblyEvaluate(new Ji(N+1,{worldview:W}),k),te.textMaxSize=Oe.possiblyEvaluate(new Ji(18,{worldview:W}),k);const He=G.get("symbol-placement"),dt=G.get("text-rotation-alignment")==="map"&&He!=="point",it=G.get("text-size");let gt=!1;const Nt=[];for(const Tt of f.features){const Gt=G.get("text-font").evaluate(Tt,{},k).join(","),Dt=it.evaluate(Tt,{},k)*te.textScaleFactor,tr=te.layoutTextSize.evaluate(Tt,{},k)*te.textScaleFactor,or=te.layoutIconSize.evaluate(Tt,{},k)*te.iconScaleFactor,lr={horizontal:{},vertical:void 0},xr=Tt.text;let vr,hr=[0,0];if(xr){const rs=xr.toString(),Oi=G.get("text-letter-spacing").evaluate(Tt,{},k)*gl,at=G.get("text-line-height").evaluate(Tt,{},k)*gl,ut=d5(rs)?Oi:0,nr=G.get("text-anchor").evaluate(Tt,{},k),yr=G.get("text-variable-anchor");if(!yr){const Jn=G.get("text-radial-offset").evaluate(Tt,{},k);if(Jn)hr=t_e(nr,[Jn*gl,yoe]);else{const cs=G.get("text-offset").evaluate(Tt,{},k);hr=[cs[0]*gl,cs[1]*gl]}}let Dr=dt?"center":G.get("text-justify").evaluate(Tt,{},k);const Rr=He==="point",pn=Rr?G.get("text-max-width").evaluate(Tt,{},k)*gl:1/0,xn=Jn=>{f.allowVerticalPlacement&&Pv(rs)&&(lr.vertical=doe(xr,c,u,v,Gt,pn,at,nr,Jn,ut,hr,fu.vertical,!0,tr,Dt,R))};if(!dt&&yr){const Jn=Dr==="auto"?yr.map(ps=>voe(ps)):[Dr];let cs=!1;for(let ps=0;ps=0||!Pv(rs)){const Jn=doe(xr,c,u,v,Gt,pn,at,nr,Dr,ut,hr,fu.horizontal,!1,tr,Dt,R);Jn&&(lr.horizontal[Dr]=Jn)}xn(Rr?"left":Dr)}}let pr,er,Zt,mr,Tr,jr,hn=!1;const Ur=G.get("icon-text-fit").evaluate(Tt,{},k);if(Tt.icon&&Tt.icon.hasPrimary()){const rs=nM(Tt.icon,f.iconSizeData,X["icon-size"],k,f.zoom,Tt,R,te.iconScaleFactor,W);pr=rs.iconPrimary,Zt=rs.iconSecondary;const Oi=pr.toString();if(er=g.get(Oi),er&&(Tr=G.get("icon-offset").evaluate(Tt,{},k),jr=G.get("icon-anchor").evaluate(Tt,{},k),vr=p6(v.get(Oi),Zt?v.get(Zt.toString()):void 0,Tr,jr),hn=er.sdf,f.sdfIcons===void 0?f.sdfIcons=er.sdf:f.sdfIcons!==er.sdf&&Vr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(er.pixelRatio!==f.pixelRatio||G.get("icon-rotate").constantOr(1)!==0)&&(f.iconsNeedLinear=!0)),Zt){const at=Zt.toString();mr=g.get(at)}}gt=gt||!(!Tt.icon||!Tt.icon.hasSecondary());const Zr=v6(lr.horizontal)||lr.vertical;f.iconsInText||(f.iconsInText=!!Zr&&Zr.iconsInText);const rn=tr*te.textScaleFactor/gl,{defaultShapedIcon:gs,verticallyShapedIcon:kr}=IVe(f,vr,G,Tt,k,lr,rn,Tr,Ur);Ur!=="none"&&vr&&(Bve(vr)||$ve(vr))&&(y6(0,er,pr,vr,gs,Ur,$,g,v),y6(0,mr,Zt,vr,gs,Ur,$,g,v),kr&&(y6(0,er,pr,vr,kr,Ur,$,g,v),y6(0,mr,Zt,vr,kr,Ur,$,g,v))),vr=gs;const{iconBBox:sn,iconVerticalBBox:qn,textBBox:Ds,textVerticalBBox:Us}=CVe(f,vr,kr,G,Tt,k,or,Tr,te,v,jr,lr,tr,hr);Nt.push({feature:Tt,shapedTextOrientations:lr,shapedText:Zr,shapedIcon:vr,iconPrimary:pr,iconSecondary:Zt,iconOffset:Tr,iconAnchor:jr,verticallyShapedIcon:kr,layoutTextSize:tr,layoutIconSize:or,textOffset:hr,isSDFIcon:hn,iconTextFit:Ur,iconCollisionBounds:sn,iconVerticalCollisionBounds:qn,textCollisionBounds:Ds,textVerticalCollisionBounds:Us})}return{featureData:Nt,sizes:te,hasAnySecondaryIcon:gt,textAlongLine:dt,symbolPlacement:He}},a.fx=Zve,a.fy=function(f,c,u,g,v,k,N,I,R,$){f.iconAtlasPositions=$.iconPositions;const{featureData:W,hasAnySecondaryIcon:G,sizes:X,textAlongLine:te,symbolPlacement:se}=c;for(const me of W){const{shapedIcon:Se,verticallyShapedIcon:Ne,feature:Oe,shapedTextOrientations:Fe,shapedText:He,layoutTextSize:dt,textOffset:it,isSDFIcon:gt,iconPrimary:Nt,iconSecondary:Tt,iconTextFit:Gt,iconOffset:Dt,iconCollisionBounds:tr,iconVerticalCollisionBounds:or,textCollisionBounds:lr}=me;n_e(Se,$.iconPositions,Nt,Tt),n_e(Ne,$.iconPositions,Nt,Tt),EVe(Fe,$.iconPositions),AVe(Nt,Tt,$.iconPositions),(He||Se)&&PVe(f,Oe,Fe,Se,Ne,R,X,dt,0,it,gt,g,v,N,I,G,Gt,Dt,te,se,tr,or,lr)}u&&f.generateCollisionDebugBuffers(k,f.collisionBoxArray,X.textScaleFactor)},a.fz=zt,a.g=function(f,c){return mp(Object.assign(f,{method:"GET"}),c)},a.h=function(f){return f.indexOf("mapbox:")===0},a.i=function(f){return Cs.API_STYLE_REGEX.test(f)&&!Nl(f)},a.j=Ba,a.k=au,a.l=function(f){return decodeURIComponent(atob(f).split("").map(c=>"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)).join(""))},a.m=function(f,c){return mp(Object.assign(f,{type:"json"}),c)},a.n=bs,a.o=zo,a.p=function(f,c){return mp(Object.assign(f,{method:"POST"}),c)},a.q=yc,a.r=iu,a.s=function(f){try{const c=self[f];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}},a.t=function(){return qae||(qae=new Zv("ImageRasterizer")),qae},a.u=function(){return function f(c){return c?(c^Math.random()*(16>>c/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,f)}()},a.v=function(f){return!!f&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(f)},a.w=Vr,a.x=Doe,a.y=fv,a.z=uf}),o(["./shared"],function(a){function h(kt){const we=kt?kt.url.toString():void 0;return we?performance.getEntriesByName(we):[]}function p(kt){if(typeof kt=="number"||typeof kt=="boolean"||typeof kt=="string"||kt==null)return JSON.stringify(kt);if(Array.isArray(kt)){let De="[";for(const Ge of kt)De+=`${p(Ge)},`;return`${De}]`}let we="{";for(const De of Object.keys(kt).sort())we+=`${De}:${p(kt[De])},`;return`${we}}`}function x(kt){let we="";for(const De of a.bx)we+=`/${p(kt[De])}`;return we}class y{constructor(we){this.keyCache={},this._layers={},this._layerConfigs={},we&&this.replace(we)}replace(we,De){this._layerConfigs={},this._layers={},this.update(we,[],De)}update(we,De,Ge){this._options=Ge;for(const yt of we)this._layerConfigs[yt.id]=yt,(this._layers[yt.id]=a.du(yt,this.scope,null,this._options)).compileFilter(Ge),this.keyCache[yt.id]&&delete this.keyCache[yt.id];for(const yt of De)delete this.keyCache[yt],delete this._layerConfigs[yt],delete this._layers[yt];this.familiesBySource={};const _t=function(yt,At){const Bt={};for(let Ut=0;Utthis._layers[Xr.id]),Bt=At[0];if(Bt.visibility==="none")continue;const Lt=Bt.source||"";let Ut=this.familiesBySource[Lt];Ut||(Ut=this.familiesBySource[Lt]={});const gr=Bt.sourceLayer||"_geojsonTileLayer";let ar=Ut[gr];ar||(ar=Ut[gr]=[]),ar.push(At)}}}const w=1*a.fl;class j{constructor(we){const De={},Ge=[];for(const Bt in we){const Lt=we[Bt],Ut=De[Bt]={};for(const gr in Lt.glyphs){const ar=Lt.glyphs[+gr];if(!ar||ar.bitmap.width===0||ar.bitmap.height===0)continue;const Xr=ar.metrics.localGlyph?w:1,tn={x:0,y:0,w:ar.bitmap.width+2*Xr,h:ar.bitmap.height+2*Xr};Ge.push(tn),Ut[gr]=tn}}const{w:_t,h:yt}=a.G(Ge),At=new a.fk({width:_t||1,height:yt||1});for(const Bt in we){const Lt=we[Bt];for(const Ut in Lt.glyphs){const gr=Lt.glyphs[+Ut];if(!gr||gr.bitmap.width===0||gr.bitmap.height===0)continue;const ar=De[Bt][Ut],Xr=gr.metrics.localGlyph?w:1;a.fk.copy(gr.bitmap,At,{x:0,y:0},{x:ar.x+Xr,y:ar.y+Xr},gr.bitmap)}}this.image=At,this.positions=De}}function S(kt,we,De){kt[we]?De&&(kt[we].center=De):kt[we]={floorIds:new Set,center:De||[0,0],floors:{}}}function C(kt,we,De,Ge){for(const _t of we)S(kt,_t),kt[_t].floors[De]=Ge,kt[_t].floorIds.add(De)}function A(kt){return{id:kt.properties.id.toString(),center:kt.properties.center.toString().split(";").map(Number)}}function E(kt){return{id:kt.properties.id.toString(),isDefault:!!kt.properties.is_default&&kt.properties.is_default,connections:kt.properties.connected_floor_ids?new Set(kt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:kt.properties.conflicted_floor_ids?new Set(kt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:kt.properties.building_ids?new Set(kt.properties.building_ids.toString().split(";")):new Set,name:kt.properties.name.toString(),zIndex:kt.properties.z_index}}function T(kt,we){return we.every(De=>kt.properties&&kt.properties[De]!=null)}function O(kt){return T(kt,["type","id","name"])&&kt.properties.type==="building"}function z(kt){return T(kt,["type","id","name","z_index"])&&kt.properties.type==="floor"}a.fj(j,"GlyphAtlas");class F{constructor(we){this.tileID=new a.aQ(we.tileID.overscaledZ,we.tileID.wrap,we.tileID.canonical.z,we.tileID.canonical.x,we.tileID.canonical.y),this.tileZoom=we.tileZoom,this.uid=we.uid,this.zoom=we.zoom,this.lut=we.lut,this.canonical=we.tileID.canonical,this.pixelRatio=we.pixelRatio,this.tileSize=we.tileSize,this.source=we.source,this.scope=we.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=we.showCollisionBoxes,this.collectResourceTiming=!!we.request&&we.request.collectResourceTiming,this.promoteId=we.promoteId,this.isSymbolTile=we.isSymbolTile,this.tileTransform=a.aZ(we.tileID.canonical,we.projection),this.projection=we.projection,this.worldview=we.worldview,this.localizableLayerIds=we.localizableLayerIds,this.brightness=we.brightness,this.extraShadowCaster=!!we.extraShadowCaster,this.tessellationStep=we.tessellationStep,this.scaleFactor=we.scaleFactor,this.worldview=we.worldview,this.indoor=we.indoor}parse(we,De,Ge,_t,yt,At){this.status="parsing",this.data=we,this.collisionBoxArray=new a.b3;const Bt=new a.fm(Object.keys(we.layers).sort()),Lt=new a.fn(this.tileID,this.promoteId);Lt.bucketLayerIDs=[];const Ut={},gr=new a.fo(256,256),ar={featureIndex:Lt,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:gr,availableImages:Ge,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const ts=this.indoor.indoorState.activeFloorsVisible,Xn=function(Qn,Fs,Ta){const Ka=function(wa,Gs){if(!wa)return a.w("No source layers defined in indoor specification"),Gs;if(wa.size===0)return Gs;const ma=wa.difference(Gs);for(const zi of ma)a.w(`Missing source layer required in indoor specification: ${zi}`);return Gs.intersection(Gs)}(Fs.sourceLayers,new Set(Object.keys(Qn.layers))),Oa=Fs.indoorState,ho=function(wa,Gs,ma,zi){const Cs=new Set,Ba=new Set,Nl=new Set,Rl=new Map,Ac={},dp=nl=>{const yd=Rl.get(nl)||new Set;for(const sl of Cs)if((Rl.get(sl)||new Set).has(nl)||yd.has(sl))return!0;return!1};for(const nl of Gs){const yd=wa.layers[nl];if(yd)for(let sl=0;sl=ma.maxzoom||ma.visibility==="none")continue;q(Gs,this.zoom,ar.brightness,Ge,this.worldview);const zi=Ut[ma.id]=ma.createBucket({index:Lt.bucketLayerIDs.length,layers:Gs,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ka,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:_t,worldview:this.worldview,localizable:ho});Lt.bucketLayerIDs.push(Gs.map(Ba=>a.B(Ba.id,Ba.scope)));let Cs=zi.prepare?zi.prepare():null;Cs!=null?(Cs=Cs.then(()=>zi.populate(Oa,ar,this.tileID.canonical,this.tileTransform)),Xr.push(Cs)):zi.populate(Oa,ar,this.tileID.canonical,this.tileTransform)}}const Vr=()=>{let ts,Xn,Qn,Fs,Ta,Ka;gr.trim();const Oa={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},ho=()=>{if(ts)return this.status="done",At(ts);if(this.extraShadowCaster)this.status="done",At(null,{buckets:Object.values(Ut).filter(Gs=>!Gs.isEmpty()),featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ar.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Xn&&Qn&&Fs){const Gs=new j(Xn),ma=new Map;for(const[Ba,Nl]of Qn.entries()){const{imagePosition:Rl}=a.fu(Ba,Nl,a.fv);ma.set(Ba,Rl)}const zi={};for(const Ba in Ut){const Nl=Ut[Ba];Nl instanceof a.b4&&(q(Nl.layers,this.zoom,ar.brightness,Ge,this.worldview),zi[Ba]=a.fw(Nl,Xn,Gs.positions,Qn,ma,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Ta,this.worldview))}const Cs={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(yt,Qn,Ta,()=>{Cs.iconsPending=!1,wa(zi,Gs,Cs)}),this.rasterizeIfNeeded(yt,Fs,Ka,()=>{Cs.patternsPending=!1,wa(zi,Gs,Cs)})}},wa=(Gs,ma,zi,Cs)=>{if(zi.iconsPending||zi.patternsPending)return;const Ba=new a.fx(Qn,Fs,this.lut);for(const Nl in Ut){const Rl=Ut[Nl];if(Nl in Gs)a.fy(Rl,Gs[Nl],this.showCollisionBoxes,Ge,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Qn,Ba);else if(Rl.hasPattern&&(Rl instanceof a.ba||Rl instanceof a.bb||Rl instanceof a.ea)){q(Rl.layers,this.zoom,ar.brightness,Ge,this.worldview);const Ac=Object.fromEntries(Ba.patternPositions);Rl.addFeatures(ar,this.tileID.canonical,Ac,Ge,this.tileTransform,this.brightness)}}this.status="done",At(null,{buckets:Object.values(Ut).filter(Nl=>!Nl.isEmpty()),featureIndex:Lt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ma.image,lineAtlas:gr,imageAtlas:Ba,brightness:ar.brightness})};if(!this.extraShadowCaster){const Gs=a.fs(ar.glyphDependencies,Cs=>Object.keys(Cs).map(Number));Object.keys(Gs).length?yt.send("getGlyphs",{uid:this.uid,stacks:Gs},(Cs,Ba)=>{ts||(ts=Cs,Xn=Ba,ho())},void 0,!1,Oa):Xn={};const ma=Array.from(ar.iconDependencies.keys()).map(Cs=>a.I.parse(Cs));ma.length?yt.send("getImages",{images:ma,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Cs,Ba)=>{ts||(ts=Cs,Qn=new Map,Ta=this.updateImageMapAndGetImageTaskQueue(Qn,Ba,ar.iconDependencies),ho())},void 0,!1,Oa):(Qn=new Map,Ta=new Map);const zi=Array.from(ar.patternDependencies.keys()).map(Cs=>a.I.parse(Cs));zi.length?yt.send("getImages",{images:zi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Cs,Ba)=>{ts||(ts=Cs,Fs=new Map,Ka=this.updateImageMapAndGetImageTaskQueue(Fs,Ba,ar.patternDependencies),ho())},void 0,!1,Oa):(Fs=new Map,Ka=new Map)}if(ar.elevationFeatures&&ar.elevationFeatures.length>0){const Gs=[];for(const zi of Object.values(Ut))if(zi instanceof a.bb){const Cs=zi.getUnevaluatedPortalGraph();Cs&&Gs.push(Cs)}const ma=a.ft.evaluate(Gs);for(const zi of Object.values(Ut))if(zi instanceof a.bb){const Cs=we.layers[Bt.decode(zi.sourceLayerIndex)];zi.setEvaluatedPortalGraph(ma,Cs,this.tileID.canonical,ar.availableImages,ar.brightness)}}ho()};Xr.length>0?Promise.allSettled(Xr).then(Vr).catch(At):Vr()}updateParameters(we){this.scaleFactor=we.scaleFactor,this.showCollisionBoxes=we.showCollisionBoxes,this.projection=we.projection,this.brightness=we.brightness,this.tileTransform=a.aZ(we.tileID.canonical,we.projection),this.extraShadowCaster=we.extraShadowCaster,this.lut=we.lut,this.worldview=we.worldview,this.indoor=we.indoor}rasterizeIfNeeded(we,De,Ge,_t){Array.from(De.values()).some(yt=>yt.usvg)?this.rasterize(we,De,Ge,_t):_t()}updateImageMapAndGetImageTaskQueue(we,De,Ge){const _t=new Map;for(const yt of De.keys()){const At=Ge.get(yt)||[];for(const Bt of At){const Lt=Bt.toString(),Ut=De.get(Bt.id.toString());Ut.usvg?_t.has(Lt)||(_t.set(Lt,Bt),we.set(Lt,Object.assign({},Ut))):we.set(Lt,Ut)}}return _t}rasterize(we,De,Ge,_t){this.rasterizeTask=we.send("rasterizeImages",{scope:this.scope,tasks:Ge},(yt,At)=>{if(!yt)for(const[Bt,Lt]of At.entries()){const Ut=Object.assign(De.get(Bt),{data:Lt});De.set(Bt,Ut)}_t()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function q(kt,we,De,Ge,_t){const yt=new a.ac(we,{brightness:De,worldview:_t});for(const At of kt)At.recalculate(yt,Ge)}class H extends a.E{constructor(we,De,Ge,_t,yt,At,Bt){super(),this.actor=we,this.layerIndex=De,this.availableImages=Ge,this.availableModels=_t,this.loadVectorData=At||a.aL,this.loading={},this.loaded={},this.deduped=new a.aK(we.scheduler),this.isSpriteLoaded=yt,this.scheduler=we.scheduler,this.brightness=Bt}loadTile(we,De){const Ge=we.uid,_t=we&&we.request,yt=_t&&_t.collectResourceTiming,At=this.loading[Ge]=new F(we);At.abort=this.loadVectorData(we,(Bt,Lt)=>{const Ut=!this.loading[Ge];if(delete this.loading[Ge],At.cancelRasterize(),Ut||Bt||!Lt)return At.status="done",Ut||(this.loaded[Ge]=At),De(Bt);const gr=Lt.rawData,ar={},Xr=a.aM(Lt.responseHeaders);Xr&&Xr.expires&&(ar.expires=Xr.expires),Xr&&Xr.cacheControl&&(ar.cacheControl=Xr.cacheControl),At.vectorTile=Lt.vectorTile||new a.fz(new a.bt(gr));const tn=()=>{At.parse(At.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Vr,ts)=>{if(Vr||!ts)return De(Vr);const Xn={};if(yt){const Qn=h(_t);Qn.length>0&&(Xn.resourceTiming=JSON.parse(JSON.stringify(Qn)))}De(null,Object.assign({rawTileData:gr.slice(0),responseHeaders:Lt.responseHeaders},ts,ar,Xn))})};this.isSpriteLoaded?tn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(tn,{type:"parseTile",isSymbolTile:we.isSymbolTile,zoom:we.tileZoom}):tn()}),this.loaded=this.loaded||{},this.loaded[Ge]=At})}reloadTile(we,De){const Ge=this.loaded,_t=we.uid;if(Ge&&Ge[_t]){const yt=Ge[_t];yt.updateParameters(we);const At=(Bt,Lt)=>{const Ut=yt.reloadCallback;Ut&&(delete yt.reloadCallback,yt.parse(yt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ut)),De(Bt,Lt)};yt.status==="parsing"?yt.reloadCallback=At:yt.status==="done"&&(yt.vectorTile?yt.parse(yt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,At):At())}else De(null,void 0)}abortTile(we,De){const Ge=we.uid,_t=this.loading[Ge];_t&&(_t.abort&&_t.abort(),delete this.loading[Ge]),De()}removeTile(we,De){const Ge=this.loaded,_t=we.uid;Ge&&Ge[_t]&&delete Ge[_t],De()}}class K{loadTile(we,De){const{uid:Ge,encoding:_t,rawImageData:yt,padding:At}=we,Bt=ImageBitmap&&yt instanceof ImageBitmap?this.getImageData(yt,At):yt;De(null,new a.fA(Ge,Bt,_t,At<1))}reloadTile(we,De){De(null,null)}abortTile(we,De){De()}removeTile(we,De){De()}getImageData(we,De){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(we.width,we.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=we.width,this.offscreenCanvas.height=we.height,this.offscreenCanvasContext.drawImage(we,0,0,we.width,we.height);const Ge=this.offscreenCanvasContext.getImageData(-De,-De,we.width+2*De,we.height+2*De);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ge}}a.bs.setPbf(a.bt);class Z{constructor(we){this._mrt=new a.bs(we.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=we.uid,this.tileID=we.tileID,this.source=we.source}parse(we,De){const Ge=this._mrt;this.status="parsing",this._entireBuffer=we;try{Ge.parseHeader(we),this._isHeaderLoaded=!0;const _t=[];for(const yt in Ge.layers){const At=Ge.getLayer(yt),Bt=At.getDataRange(At.getBandList()),Lt=Ge.createDecodingTask(Bt),Ut=we.slice(Bt.firstByte,Bt.lastByte+1),gr=a.bs.performDecoding(Ut,Lt).then(ar=>Lt.complete(null,ar)).catch(ar=>Lt.complete(ar,null));_t.push(gr)}Promise.allSettled(_t).then(()=>De(null,Ge)).catch(yt=>De(yt))}catch(_t){De(_t)}}}class re{constructor(we){this.actor=we,this.loading={},this.loaded={}}loadTile(we,De){const Ge=we.uid,_t=we.request,yt=this.loading[Ge]=new Z(we),{cancel:At}=a.bu(_t,(Bt,Lt,Ut)=>{const gr=!this.loading[Ge];if(delete this.loading[Ge],gr||Bt||!Lt)return yt.status="done",gr||(this.loaded[Ge]=yt),De(Bt);yt.parse(Lt,(ar,Xr)=>{if(ar||!Xr)return De(ar);De(null,Xr,Ut)}),this.loaded[Ge]=yt});yt.abort=At}reloadTile(we,De){De(null,void 0)}abortTile(we,De){const Ge=we.uid,_t=this.loading[Ge];_t&&(_t.abort&&_t.abort(),delete this.loading[Ge]),De()}removeTile(we,De){const Ge=we.uid;this.loaded[Ge]&&delete this.loaded[Ge],De()}decodeRasterArray(we,De){a.bs.performDecoding(we.buffer,we.task).then(Ge=>De(null,Ge)).catch(Ge=>De(Ge))}}const ue=a.fB.prototype.toGeoJSON;class he{constructor(we){this._feature=we,this.extent=a.al,this.type=we.type,this.properties=we.tags,"id"in we&&!isNaN(we.id)&&(this.id=parseInt(we.id,10))}loadGeometry(){if(this._feature.type===1){const we=[];for(const De of this._feature.geometry)we.push([new a.P(De[0],De[1])]);return we}{const we=[];for(const De of this._feature.geometry){const Ge=[];for(const _t of De)Ge.push(new a.P(_t[0],_t[1]));we.push(Ge)}return we}}toGeoJSON(we,De,Ge){return ue.call(this,we,De,Ge)}}class be{constructor(we,De){this.name=we,this.extent=a.al,this.length=De.length,this._jsonFeatures=De}feature(we){return new he(this._jsonFeatures[we])}}class ne{constructor(we){this.layers={},this.extent=a.al;for(const De of Object.keys(we))this.layers[De]=new be(De,we[De])}}const ye=64/4096,ie=128;class fe{constructor(){this.features=new Map}clear(){this.features.clear()}load(we=[],De){for(const Ge of we){const _t=Ge.id;if(_t==null)continue;let yt=this.features.get(_t);yt&&this.updateCache(yt,De),Ge.geometry?(yt=_e(Ge),this.updateCache(yt,De),this.features.set(_t,yt)):this.features.delete(_t),this.updateCache(yt,De)}}updateCache(we,De){for(const{canonical:Ge,uid:_t}of Object.values(De)){const{z:yt,x:At,y:Bt}=Ge;de(we,Math.pow(2,yt),At,Bt)&&delete De[_t]}}getTile(we,De,Ge){const _t=Math.pow(2,we),yt=[];for(const At of this.features.values())de(At,_t,De,Ge)&&yt.push(ae(At,_t,De,Ge));return{features:yt}}getFeatures(){return[...this.features.values()]}}function de({minX:kt,minY:we,maxX:De,maxY:Ge},_t,yt,At){return kt<(yt+1+ye)/_t&&we<(At+1+ye)/_t&&De>(yt-ye)/_t&&Ge>(At-ye)/_t}function _e(kt){const{id:we,geometry:De,properties:Ge}=kt;if(!De)return;if(De.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:_t,coordinates:yt}=De,At={id:we,type:1,geometry:[],tags:Ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Bt=At.geometry;if(_t==="Point")Ee(yt,Bt,At);else if(_t==="MultiPoint")for(const Lt of yt)Ee(Lt,Bt,At);else if(_t==="LineString")At.type=2,ke(yt,Bt,At);else if(_t==="MultiLineString")At.type=2,pe(yt,Bt,At);else if(_t==="Polygon")At.type=3,pe(yt,Bt,At,!0);else{if(_t!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");At.type=3;for(const Lt of yt)pe(Lt,Bt,At,!0)}return At}function Ee([kt,we],De,Ge){const _t=a.aF(kt);let yt=a.aJ(we);yt=yt<0?0:yt>1?1:yt,De.push(_t,yt),Ge.minX=Math.min(Ge.minX,_t),Ge.minY=Math.min(Ge.minY,yt),Ge.maxX=Math.max(Ge.maxX,_t),Ge.maxY=Math.max(Ge.maxY,yt)}function ke(kt,we,De,Ge=!1,_t=!1){const yt=[];for(const At of kt)Ee(At,yt,De);we.push(yt),Ge&&function(At,Bt){let Lt=0;for(let Ut=0,gr=At.length,ar=gr-2;Ut0===Bt)for(let Ut=0,gr=At.length;Ut=At&&ar>=At||(Ut>=At?(gr+=Math.round(Vr*((At-Ut)/tn)),Ut=At):ar>=At&&(Xr=gr+Math.round(Vr*((At-Ut)/tn)),ar=At),gr>=At&&Xr>=At||(gr>=At?(Ut+=Math.round(tn*((At-gr)/Vr)),gr=At):Xr>=At&&(ar=Ut+Math.round(tn*((At-gr)/Vr)),Xr=At),Bt&&Ut===Bt[Bt.length-1][0]&&gr===Bt[Bt.length-1][1]||(Bt=[[Ut,gr]],_t.push(Bt)),Bt.push([ar,Xr])))))}}function Me(kt,we,De,Ge,_t){const yt=(De-ye)/we,At=(Ge-ye)/we,Bt=(De+1+ye)/we,Lt=(Ge+1+ye)/we;function Ut(Xr,tn){let Vr=0;return XrBt&&(Vr|=2),tnLt&&(Vr|=8),Vr}let gr=[];for(let Xr=1;Xr<=8;Xr*=2){let tn=kt[kt.length-2],Vr=kt[kt.length-1],ts=!(Ut(tn,Vr)&Xr);for(let Xn=0;Xn>31}function Je(kt,we){const{geometry:De,type:Ge}=kt;let _t=0,yt=0;if(Ge===1){we.writeVarint(Re(1,De.length));for(const At of De){const Bt=At[0]-_t,Lt=At[1]-yt;we.writeVarint(Ce(Bt)),we.writeVarint(Ce(Lt)),_t+=Bt,yt+=Lt}}else for(const At of De){we.writeVarint(Re(1,1));const Bt=At.length-(Ge===3?1:0);for(let Lt=0;Ltkt},xe=Math.fround||(mt=new Float32Array(1),kt=>(mt[0]=+kt,mt[0]));var mt;const et=3,nt=5,Ae=6;class pt{constructor(we){this.options=Object.assign(Object.create(Ye),we),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(we){const{log:De,minZoom:Ge,maxZoom:_t}=this.options;De&&console.time("total time");const yt=`prepare ${we.length} points`;De&&console.time(yt),this.points=we;const At=[];for(let Lt=0;Lt=Ge;Lt--){const Ut=+Date.now();Bt=this.trees[Lt]=this._createTree(this._cluster(Bt,Lt)),De&&console.log("z%d: %d clusters in %dms",Lt,Bt.numItems,+Date.now()-Ut)}return De&&console.timeEnd("total time"),this}getClusters(we,De){let Ge=((we[0]+180)%360+360)%360-180;const _t=Math.max(-90,Math.min(90,we[1]));let yt=we[2]===180?180:((we[2]+180)%360+360)%360-180;const At=Math.max(-90,Math.min(90,we[3]));if(we[2]-we[0]>=360)Ge=-180,yt=180;else if(Ge>yt){const ar=this.getClusters([Ge,_t,180,At],De),Xr=this.getClusters([-180,_t,yt,At],De);return ar.concat(Xr)}const Bt=this.trees[this._limitZoom(De)],Lt=Bt.range(tt(Ge),ht(At),tt(yt),ht(_t)),Ut=Bt.data,gr=[];for(const ar of Lt){const Xr=this.stride*ar;gr.push(Ut[Xr+nt]>1?Be(Ut,Xr,this.clusterProps):this.points[Ut[Xr+et]])}return gr}getChildren(we){const De=this._getOriginId(we),Ge=this._getOriginZoom(we),_t="No cluster with the specified id.",yt=this.trees[Ge];if(!yt)throw new Error(_t);const At=yt.data;if(De*this.stride>=At.length)throw new Error(_t);const Bt=this.options.radius/(this.options.extent*Math.pow(2,Ge-1)),Lt=yt.within(At[De*this.stride],At[De*this.stride+1],Bt),Ut=[];for(const gr of Lt){const ar=gr*this.stride;At[ar+4]===we&&Ut.push(At[ar+nt]>1?Be(At,ar,this.clusterProps):this.points[At[ar+et]])}if(Ut.length===0)throw new Error(_t);return Ut}getLeaves(we,De,Ge){const _t=[];return this._appendLeaves(_t,we,De=De||10,Ge=Ge||0,0),_t}getTile(we,De,Ge){const _t=this.trees[this._limitZoom(we)],yt=Math.pow(2,we),{extent:At,radius:Bt}=this.options,Lt=Bt/At,Ut=(Ge-Lt)/yt,gr=(Ge+1+Lt)/yt,ar={features:[]};return this._addTileFeatures(_t.range((De-Lt)/yt,Ut,(De+1+Lt)/yt,gr),_t.data,De,Ge,yt,ar),De===0&&this._addTileFeatures(_t.range(1-Lt/yt,Ut,1,gr),_t.data,yt,Ge,yt,ar),De===yt-1&&this._addTileFeatures(_t.range(0,Ut,Lt/yt,gr),_t.data,-1,Ge,yt,ar),ar.features.length?ar:null}getClusterExpansionZoom(we){let De=this._getOriginZoom(we)-1;for(;De<=this.options.maxZoom;){const Ge=this.getChildren(we);if(De++,Ge.length!==1)break;we=Ge[0].properties.cluster_id}return De}_appendLeaves(we,De,Ge,_t,yt){const At=this.getChildren(De);for(const Bt of At){const Lt=Bt.properties;if(Lt&&Lt.cluster?yt+Lt.point_count<=_t?yt+=Lt.point_count:yt=this._appendLeaves(we,Lt.cluster_id,Ge,_t,yt):yt<_t?yt++:we.push(Bt),we.length===Ge)break}return yt}_createTree(we){const De=new a.c4(we.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Ge=0;Ge1;let gr,ar,Xr;if(Ut)gr=Qe(De,Lt,this.clusterProps),ar=De[Lt],Xr=De[Lt+1];else{const ts=this.points[De[Lt+et]];gr=ts.properties;const[Xn,Qn]=ts.geometry.coordinates;ar=tt(Xn),Xr=ht(Qn)}const tn={type:1,geometry:[[Math.round(this.options.extent*(ar*yt-Ge)),Math.round(this.options.extent*(Xr*yt-_t))]],tags:gr};let Vr;Vr=Ut||this.options.generateId?De[Lt+et]:this.points[De[Lt+et]].id,Vr!==void 0&&(tn.id=Vr),At.features.push(tn)}}_limitZoom(we){return Math.max(this.options.minZoom,Math.min(Math.floor(+we),this.options.maxZoom+1))}_cluster(we,De){const{radius:Ge,extent:_t,reduce:yt,minPoints:At}=this.options,Bt=Ge/(_t*Math.pow(2,De)),Lt=we.data,Ut=[],gr=this.stride;for(let ar=0;arDe&&(Xn+=Lt[Fs+nt])}if(Xn>ts&&Xn>=At){let Qn,Fs=Xr*ts,Ta=tn*ts,Ka=-1;const Oa=(ar/gr<<5)+(De+1)+this.points.length;for(const ho of Vr){const wa=ho*gr;if(Lt[wa+2]<=De)continue;Lt[wa+2]=De;const Gs=Lt[wa+nt];Fs+=Lt[wa]*Gs,Ta+=Lt[wa+1]*Gs,Lt[wa+4]=Oa,yt&&(Qn||(Qn=this._map(Lt,ar,!0),Ka=this.clusterProps.length,this.clusterProps.push(Qn)),yt(Qn,this._map(Lt,wa)))}Lt[ar+4]=Oa,Ut.push(Fs/Xn,Ta/Xn,1/0,Oa,-1,Xn),yt&&Ut.push(Ka)}else{for(let Qn=0;Qn1)for(const Qn of Vr){const Fs=Qn*gr;if(!(Lt[Fs+2]<=De)){Lt[Fs+2]=De;for(let Ta=0;Ta>5}_getOriginZoom(we){return(we-this.points.length)%32}_map(we,De,Ge){if(we[De+nt]>1){const At=this.clusterProps[we[De+Ae]];return Ge?Object.assign({},At):At}const _t=this.points[we[De+et]].properties,yt=this.options.map(_t);return Ge&&yt===_t?Object.assign({},yt):yt}}function Be(kt,we,De){return{type:"Feature",id:kt[we+et],properties:Qe(kt,we,De),geometry:{type:"Point",coordinates:[(Ge=kt[we],360*(Ge-.5)),wt(kt[we+1])]}};var Ge}function Qe(kt,we,De){const Ge=kt[we+nt],_t=Ge>=1e4?`${Math.round(Ge/1e3)}k`:Ge>=1e3?Math.round(Ge/100)/10+"k":Ge,yt=kt[we+Ae],At=yt===-1?{}:Object.assign({},De[yt]);return Object.assign(At,{cluster:!0,cluster_id:kt[we+et],point_count:Ge,point_count_abbreviated:_t})}function tt(kt){return kt/360+.5}function ht(kt){const we=Math.sin(kt*Math.PI/180),De=.5-.25*Math.log((1+we)/(1-we))/Math.PI;return De<0?0:De>1?1:De}function wt(kt){const we=(180-360*kt)*Math.PI/180;return 360*Math.atan(Math.exp(we))/Math.PI-90}function Ct(kt,we,De,Ge){let _t=Ge;const yt=we+(De-we>>1);let At,Bt=De-we;const Lt=kt[we],Ut=kt[we+1],gr=kt[De],ar=kt[De+1];for(let Xr=we+3;Xr_t)At=Xr,_t=tn;else if(tn===_t){const Vr=Math.abs(Xr-yt);VrGe&&(At-we>3&&Ct(kt,we,At,Ge),kt[At+2]=_t,De-At>3&&Ct(kt,At,De,Ge))}function It(kt,we,De,Ge,_t,yt){let At=_t-De,Bt=yt-Ge;if(At!==0||Bt!==0){const Lt=((kt-De)*At+(we-Ge)*Bt)/(At*At+Bt*Bt);Lt>1?(De=_t,Ge=yt):Lt>0&&(De+=At*Lt,Ge+=Bt*Lt)}return At=kt-De,Bt=we-Ge,At*At+Bt*Bt}function jt(kt,we,De,Ge){const _t={id:kt??null,type:we,geometry:De,tags:Ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(we==="Point"||we==="MultiPoint"||we==="LineString")rr(_t,De);else if(we==="Polygon")rr(_t,De[0]);else if(we==="MultiLineString")for(const yt of De)rr(_t,yt);else if(we==="MultiPolygon")for(const yt of De)rr(_t,yt[0]);return _t}function rr(kt,we){for(let De=0;De0&&(At+=Ge?(_t*gr-Ut*yt)/2:Math.sqrt(Math.pow(Ut-_t,2)+Math.pow(gr-yt,2))),_t=Ut,yt=gr}const Bt=we.length-3;we[2]=1,Ct(we,0,Bt,De),we[Bt+2]=1,we.size=Math.abs(At),we.start=0,we.end=we.size}function Jr(kt,we,De,Ge){for(let _t=0;_t1?1:De}function fr(kt,we,De,Ge,_t,yt,At,Bt){if(Ge/=we,yt>=(De/=we)&&At=Ge)return null;const Lt=[];for(const Ut of kt){const gr=Ut.geometry;let ar=Ut.type;const Xr=_t===0?Ut.minX:Ut.minY,tn=_t===0?Ut.maxX:Ut.maxY;if(Xr>=De&&tn=Ge)continue;let Vr=[];if(ar==="Point"||ar==="MultiPoint")xs(gr,Vr,De,Ge,_t);else if(ar==="LineString")bi(gr,Vr,De,Ge,_t,!1,Bt.lineMetrics);else if(ar==="MultiLineString")La(gr,Vr,De,Ge,_t,!1);else if(ar==="Polygon")La(gr,Vr,De,Ge,_t,!0);else if(ar==="MultiPolygon")for(const ts of gr){const Xn=[];La(ts,Xn,De,Ge,_t,!0),Xn.length&&Vr.push(Xn)}if(Vr.length){if(Bt.lineMetrics&&ar==="LineString"){for(const ts of Vr)Lt.push(jt(Ut.id,ar,ts,Ut.tags));continue}ar!=="LineString"&&ar!=="MultiLineString"||(Vr.length===1?(ar="LineString",Vr=Vr[0]):ar="MultiLineString"),ar!=="Point"&&ar!=="MultiPoint"||(ar=Vr.length===3?"Point":"MultiPoint"),Lt.push(jt(Ut.id,ar,Vr,Ut.tags))}}return Lt.length?Lt:null}function xs(kt,we,De,Ge,_t){for(let yt=0;yt=De&&At<=Ge&&da(we,kt[yt],kt[yt+1],kt[yt+2])}}function bi(kt,we,De,Ge,_t,yt,At){let Bt=mi(kt);const Lt=_t===0?tl:rl;let Ut,gr,ar=kt.start;for(let Xn=0;XnDe&&(gr=Lt(Bt,Qn,Fs,Ka,Oa,De),At&&(Bt.start=ar+Ut*gr)):ho>Ge?wa=De&&(gr=Lt(Bt,Qn,Fs,Ka,Oa,De),Gs=!0),wa>Ge&&ho<=Ge&&(gr=Lt(Bt,Qn,Fs,Ka,Oa,Ge),Gs=!0),!yt&&Gs&&(At&&(Bt.end=ar+Ut*gr),we.push(Bt),Bt=mi(kt)),At&&(ar+=Ut)}let Xr=kt.length-3;const tn=kt[Xr],Vr=kt[Xr+1],ts=_t===0?tn:Vr;ts>=De&&ts<=Ge&&da(Bt,tn,Vr,kt[Xr+2]),Xr=Bt.length-3,yt&&Xr>=3&&(Bt[Xr]!==Bt[0]||Bt[Xr+1]!==Bt[1])&&da(Bt,Bt[0],Bt[1],Bt[2]),Bt.length&&we.push(Bt)}function mi(kt){const we=[];return we.size=kt.size,we.start=kt.start,we.end=kt.end,we}function La(kt,we,De,Ge,_t,yt){for(const At of kt)bi(At,we,De,Ge,_t,yt,!1)}function da(kt,we,De,Ge){kt.push(we,De,Ge)}function tl(kt,we,De,Ge,_t,yt){const At=(yt-we)/(Ge-we);return da(kt,yt,De+(_t-De)*At,1),At}function rl(kt,we,De,Ge,_t,yt){const At=(yt-De)/(_t-De);return da(kt,we+(Ge-we)*At,yt,1),At}function Ws(kt,we){const De=[];for(let Ge=0;Ge0&&we.size<(_t?At:Ge))return void(De.numPoints+=we.length/3);const Bt=[];for(let Lt=0;LtAt)&&(De.numSimplified++,Bt.push(we[Lt],we[Lt+1])),De.numPoints++;_t&&function(Lt,Ut){let gr=0;for(let ar=0,Xr=Lt.length,tn=Xr-2;ar0===Ut)for(let ar=0,Xr=Lt.length;ar24)throw new Error("maxZoom should be in the 0-24 range");if(De.promoteId&&De.generateId)throw new Error("promoteId and generateId cannot be used together.");let _t=function(yt,At){const Bt=[];if(yt.type==="FeatureCollection")for(let Lt=0;Lt1&&console.time("creation"),tn=this.tiles[Xr]=Ii(we,De,Ge,_t,Ut),this.tileCoords.push({z:De,x:Ge,y:_t}),gr)){gr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",De,Ge,_t,tn.numFeatures,tn.numPoints,tn.numSimplified),console.timeEnd("creation"));const Gs=`z${De}`;this.stats[Gs]=(this.stats[Gs]||0)+1,this.total++}if(tn.source=we,yt==null){if(De===Ut.indexMaxZoom||tn.numPoints<=Ut.indexMaxPoints)continue}else{if(De===Ut.maxZoom||De===yt)continue;if(yt!=null){const Gs=yt-De;if(Ge!==At>>Gs||_t!==Bt>>Gs)continue}}if(tn.source=null,we.length===0)continue;gr>1&&console.time("clipping");const Vr=.5*Ut.buffer/Ut.extent,ts=.5-Vr,Xn=.5+Vr,Qn=1+Vr;let Fs=null,Ta=null,Ka=null,Oa=null,ho=fr(we,ar,Ge-Vr,Ge+Xn,0,tn.minX,tn.maxX,Ut),wa=fr(we,ar,Ge+ts,Ge+Qn,0,tn.minX,tn.maxX,Ut);we=null,ho&&(Fs=fr(ho,ar,_t-Vr,_t+Xn,1,tn.minY,tn.maxY,Ut),Ta=fr(ho,ar,_t+ts,_t+Qn,1,tn.minY,tn.maxY,Ut),ho=null),wa&&(Ka=fr(wa,ar,_t-Vr,_t+Xn,1,tn.minY,tn.maxY,Ut),Oa=fr(wa,ar,_t+ts,_t+Qn,1,tn.minY,tn.maxY,Ut),wa=null),gr>1&&console.timeEnd("clipping"),Lt.push(Fs||[],De+1,2*Ge,2*_t),Lt.push(Ta||[],De+1,2*Ge,2*_t+1),Lt.push(Ka||[],De+1,2*Ge+1,2*_t),Lt.push(Oa||[],De+1,2*Ge+1,2*_t+1)}}getTile(we,De,Ge){we=+we,De=+De,Ge=+Ge;const _t=this.options,{extent:yt,debug:At}=_t;if(we<0||we>24)return null;const Bt=1<1&&console.log("drilling down to z%d-%d-%d",we,De,Ge);let Ut,gr=we,ar=De,Xr=Ge;for(;!Ut&&gr>0;)gr--,ar>>=1,Xr>>=1,Ut=this.tiles[yo(gr,ar,Xr)];return Ut&&Ut.source?(At>1&&(console.log("found parent tile z%d-%d-%d",gr,ar,Xr),console.time("drilling down")),this.splitTile(Ut.source,gr,ar,Xr,we,De,Ge),At>1&&console.timeEnd("drilling down"),this.tiles[Lt]?ks(this.tiles[Lt],yt):null):null}}function yo(kt,we,De){return 32*((1<Ut.tags&&"3d_elevation_id"in Ut.tags&&"source"in Ut.tags&&Ut.tags.source==="elevation",yt=Ge.features.filter(Ut=>_t(Ut));let At={_geojsonTileLayer:Ge.features};yt.length>0&&(At={_geojsonTileLayer:Ge.features.filter(Ut=>!_t(Ut)),hd_road_elevation:yt});const Bt=new ne(At),Lt=function(Ut){const gr=new a.bt;for(const ar of Object.keys(Ut))gr.writeMessage(3,Ue,{name:ar,features:Ut[ar]});return gr.finish()}(At).buffer;we(null,{vectorTile:Bt,rawData:Lt})}class vo extends H{constructor(we,De,Ge,_t,yt,At,Bt){super(we,De,Ge,_t,yt,ss,Bt),At&&(this.loadGeoJSON=At),this._dynamicIndex=new fe}loadData(we,De){const Ge=we&&we.request,_t=Ge&&Ge.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(we,(yt,At)=>{if(yt||!At)return De(yt);if(typeof At!="object")return De(new Error(`Input data given to '${we.source}' is not a valid GeoJSON object.`));{try{if(we.filter){const Lt=a.U(we.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Lt.result==="error")throw new Error(Lt.value.map(Ut=>`${Ut.key}: ${Ut.message}`).join(", "));At.features=At.features.filter(Ut=>Lt.value.evaluate({zoom:0},Ut))}we.dynamic?(At.type==="Feature"&&(At={type:"FeatureCollection",features:[At]}),we.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(At.features,this.loaded),we.cluster&&(At.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=we.cluster?new pt(function({superclusterOptions:Lt,clusterProperties:Ut}){if(!Ut||!Lt)return Lt;const gr={},ar={},Xr={accumulated:null,zoom:0},tn={properties:null},Vr=Object.keys(Ut);for(const ts of Vr){const[Xn,Qn]=Ut[ts],Fs=a.U(Qn),Ta=a.U(typeof Xn=="string"?[Xn,["accumulated"],["get",ts]]:Xn);gr[ts]=Fs.value,ar[ts]=Ta.value}return Lt.map=ts=>{tn.properties=ts;const Xn={};for(const Qn of Vr)Xn[Qn]=gr[Qn].evaluate(Xr,tn);return Xn},Lt.reduce=(ts,Xn)=>{tn.properties=Xn;for(const Qn of Vr)Xr.accumulated=ts[Qn],ts[Qn]=ar[Qn].evaluate(Xr,tn)},Lt}(we)).load(At.features):we.dynamic?this._dynamicIndex:function(Lt,Ut){return new Tc(Lt,Ut)}(At,we.geojsonVtOptions)}catch(Lt){return De(Lt)}const Bt={};if(_t){const Lt=h(Ge);Lt&&(Bt.resourceTiming={},Bt.resourceTiming[we.source]=JSON.parse(JSON.stringify(Lt)))}De(null,Bt)}})}reloadTile(we,De){const Ge=this.loaded;return Ge&&Ge[we.uid]?we.partial?De(null,void 0):super.reloadTile(we,De):this.loadTile(we,De)}loadGeoJSON(we,De){if(we.request)a.m(we.request,De);else{if(typeof we.data!="string")return De(new Error(`Input data given to '${we.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return De(null,JSON.parse(we.data))}catch{return De(new Error(`Input data given to '${we.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(we,De){try{De(null,this._geoJSONIndex.getClusterExpansionZoom(we.clusterId))}catch(Ge){De(Ge)}}getClusterChildren(we,De){try{De(null,this._geoJSONIndex.getChildren(we.clusterId))}catch(Ge){De(Ge)}}getClusterLeaves(we,De){try{De(null,this._geoJSONIndex.getLeaves(we.clusterId,we.limit,we.offset))}catch(Ge){De(Ge)}}}class Bd{constructor(we,De,Ge){this.tileID=new a.aQ(we.tileID.overscaledZ,we.tileID.wrap,we.tileID.canonical.z,we.tileID.canonical.x,we.tileID.canonical.y),this.tileZoom=we.tileZoom,this.uid=we.uid,this.zoom=we.zoom,this.canonical=we.tileID.canonical,this.pixelRatio=we.pixelRatio,this.tileSize=we.tileSize,this.source=we.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=we.projection,this.brightness=De,this.worldview=Ge}parse(we,De,Ge,_t){this.status="parsing";const yt=new a.aQ(Ge.tileID.overscaledZ,Ge.tileID.wrap,Ge.tileID.canonical.z,Ge.tileID.canonical.x,Ge.tileID.canonical.y),At=[],Bt=De.familiesBySource[Ge.source],Lt=new a.fn(yt,Ge.promoteId);Lt.bucketLayerIDs=[],Lt.is3DTile=!0,a.fC(we).then(Ut=>{if(!Ut)return _t(new Error("Could not parse tile"));const gr=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ut.json.asset.extras&&Ut.json.asset.extras.MAPBOX_mesh_features,ar=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("EXT_meshopt_compression"),Xr=new a.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const tn in Bt)for(const Vr of Bt[tn]){const ts=Vr[0];Lt.bucketLayerIDs.push(Vr.map(Fs=>a.B(Fs.id,Fs.scope))),ts.recalculate(Xr,[]);const Xn=a.fD(Ut,1/a.d7(Ge.tileID.canonical)),Qn=new a.fE(Vr,Xn,yt,gr,ar,this.brightness,Lt,this.worldview);gr||(Qn.needsUpload=!0),At.push(Qn),Qn.evaluate(ts)}this.status="done",_t(null,{buckets:At,featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ut=>_t(new Error(Ut.message)))}}class _r{constructor(we,De,Ge,_t,yt,At,Bt,Lt){this.actor=we,this.layerIndex=De,this.availableImages=Ge,this.availableModels=_t,this.brightness=Bt,this.loading={},this.loaded={},this.worldview=Lt}loadTile(we,De){const Ge=we.uid,_t=this.loading[Ge]=new Bd(we,this.brightness,this.worldview);a.bu(we.request,(yt,At)=>{const Bt=!this.loading[Ge];return delete this.loading[Ge],Bt||yt?(_t.status="done",Bt||(this.loaded[Ge]=_t),De(yt)):At&&At.byteLength!==0?void _t.parse(At,this.layerIndex,we,(Lt,Ut)=>{_t.status="done",this.loaded=this.loaded||{},this.loaded[Ge]=_t,Lt||!Ut?De(Lt):De(null,Ut)}):(_t.status="done",this.loaded[Ge]=_t,De())})}reloadTile(we,De){const Ge=this.loaded,_t=we.uid;if(Ge&&Ge[_t]){const yt=Ge[_t];yt.projection=we.projection,yt.brightness=we.brightness;const At=(Bt,Lt)=>{yt.reloadCallback&&(delete yt.reloadCallback,this.loadTile(we,De)),De(Bt,Lt)};yt.status==="parsing"?yt.reloadCallback=At:yt.status==="done"&&this.loadTile(we,De)}}abortTile(we,De){const Ge=we.uid;this.loading[Ge]&&delete this.loading[Ge],De()}removeTile(we,De){const Ge=this.loaded,_t=we.uid;Ge&&Ge[_t]&&delete Ge[_t],De()}}class Vn{constructor(we){this.self=we,this.actor=new a.fG(we,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new a.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=a.cm({name:"mercator"}),this.workerSourceTypes={vector:H,geojson:vo,"raster-dem":K,"raster-array":re,"batched-model":_r},this.workerSources={},this.self.registerWorkerSource=(De,Ge)=>{if(this.workerSourceTypes[De])throw new Error(`Worker source with name "${De}" already registered.`);this.workerSourceTypes[De]=Ge},this.self.registerRTLTextPlugin=De=>{if(a.fH.isParsed())throw new Error("RTL text plugin already registered.");a.fH.setState({pluginStatus:a.fI.parsed,pluginURL:a.fH.getPluginURL()}),a.fH.applyArabicShaping=De.applyArabicShaping,a.fH.processBidirectionalText=De.processBidirectionalText,a.fH.processStyledBidirectionalText=De.processStyledBidirectionalText;for(const Ge of this.rtlPluginParsingListeners)Ge(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(we,De,Ge){delete this.layerIndexes[we],delete this.availableImages[we],delete this.availableModels[we],delete this.workerSources[we],Ge()}checkIfReady(we,De,Ge){Ge()}setReferrer(we,De){this.referrer=De}spriteLoaded(we,De){this.isSpriteLoaded[we]||(this.isSpriteLoaded[we]={});const{scope:Ge,isLoaded:_t}=De;if(this.isSpriteLoaded[we][Ge]=_t,this.workerSources[we]&&this.workerSources[we][Ge])for(const yt in this.workerSources[we][Ge]){const At=this.workerSources[we][Ge][yt];for(const Bt in At){const Lt=At[Bt];Lt instanceof H&&(Lt.isSpriteLoaded=_t,Lt.fire(new a.z("isSpriteLoaded")))}}}setImages(we,De,Ge){this.availableImages[we]||(this.availableImages[we]={});const{scope:_t,images:yt}=De;if(this.availableImages[we][_t]=yt,this.workerSources[we]&&this.workerSources[we][_t]){for(const At in this.workerSources[we][_t]){const Bt=this.workerSources[we][_t][At];for(const Lt in Bt)Bt[Lt].availableImages=yt}Ge()}else Ge()}setModels(we,{scope:De,models:Ge},_t){if(this.availableModels[we]||(this.availableModels[we]={}),this.availableModels[we][De]=Ge,this.workerSources[we]&&this.workerSources[we][De]){for(const yt in this.workerSources[we][De]){const At=this.workerSources[we][De][yt];for(const Bt in At)At[Bt].availableModels=Ge}_t()}else _t()}setProjection(we,De){this.projections[we]=a.cm(De)}setBrightness(we,De,Ge){this.brightness=De,Ge()}setWorldview(we,De,Ge){this.worldview=De,Ge()}setLayers(we,De,Ge){this.getLayerIndex(we,De.scope).replace(De.layers,De.options),Ge()}updateLayers(we,De,Ge){this.getLayerIndex(we,De.scope).update(De.layers,De.removedIds,De.options),Ge()}loadTile(we,De,Ge){De.projection=this.projections[we]||this.defaultProjection,this.getWorkerSource(we,De.type,De.source,De.scope).loadTile(De,Ge)}decodeRasterArray(we,De,Ge){this.getWorkerSource(we,De.type,De.source,De.scope).decodeRasterArray(De,Ge)}reloadTile(we,De,Ge){De.projection=this.projections[we]||this.defaultProjection,this.getWorkerSource(we,De.type,De.source,De.scope).reloadTile(De,Ge)}abortTile(we,De,Ge){this.getWorkerSource(we,De.type,De.source,De.scope).abortTile(De,Ge)}removeTile(we,De,Ge){this.getWorkerSource(we,De.type,De.source,De.scope).removeTile(De,Ge)}removeSource(we,De,Ge){if(!(this.workerSources[we]&&this.workerSources[we][De.scope]&&this.workerSources[we][De.scope][De.type]&&this.workerSources[we][De.scope][De.type][De.source]))return;const _t=this.workerSources[we][De.scope][De.type][De.source];delete this.workerSources[we][De.scope][De.type][De.source],_t.removeSource!==void 0?_t.removeSource(De,Ge):Ge()}loadWorkerSource(we,De,Ge){try{this.self.importScripts(De.url),Ge()}catch(_t){Ge(_t)}}syncRTLPluginState(we,De,Ge){if(a.fH.isParsed())Ge(null,!0);else if(a.fH.isParsing())this.rtlPluginParsingListeners.push(Ge);else try{a.fH.setState(De);const _t=a.fH.getPluginURL();!a.fH.isLoaded()||a.fH.isParsed()||a.fH.isParsing()||_t==null||(a.fH.setState({pluginStatus:a.fI.parsing,pluginURL:a.fH.getPluginURL()}),this.self.importScripts(_t),a.fH.isParsed()?Ge(null,!0):this.rtlPluginParsingListeners.push(Ge))}catch(_t){Ge(_t)}}setDracoUrl(we,De){this.dracoUrl=De}getAvailableImages(we,De){this.availableImages[we]||(this.availableImages[we]={});let Ge=this.availableImages[we][De];return Ge||(Ge=[]),Ge}getAvailableModels(we,De){this.availableModels[we]||(this.availableModels[we]={});let Ge=this.availableModels[we][De];return Ge||(Ge={}),Ge}getLayerIndex(we,De){this.layerIndexes[we]||(this.layerIndexes[we]={});let Ge=this.layerIndexes[we][De];return Ge||(Ge=this.layerIndexes[we][De]=new y,Ge.scope=De),Ge}getWorkerSource(we,De,Ge,_t){const yt=this.workerSources;return yt[we]||(yt[we]={}),yt[we][_t]||(yt[we][_t]={}),yt[we][_t][De]||(yt[we][_t][De]={}),this.isSpriteLoaded[we]||(this.isSpriteLoaded[we]={}),yt[we][_t][De][Ge]||(yt[we][_t][De][Ge]=new this.workerSourceTypes[De]({send:(At,Bt,Lt,Ut,gr,ar)=>this.actor.send(At,Bt,Lt,we,gr,ar),scheduler:this.actor.scheduler},this.getLayerIndex(we,_t),this.getAvailableImages(we,_t),this.getAvailableModels(we,_t),this.isSpriteLoaded[we][_t],void 0,this.brightness,this.worldview)),yt[we][_t][De][Ge]}rasterizeImagesWorker(we,De,Ge){const _t=new Map;for(const[yt,{image:At,imageVariant:Bt}]of De.tasks.entries()){const Lt=this.imageRasterizer.rasterize(Bt,At,De.scope,we);_t.set(yt,Lt)}Ge(void 0,_t)}removeRasterizedImages(we,De,Ge){this.imageRasterizer.removeImagesFromCacheByIds(De.imageIds,De.scope,we),Ge()}enforceCacheSizeLimit(we,De){a.fJ(De)}getWorkerPerformanceMetrics(we,De,Ge){Ge(void 0,void 0)}}return a.fF(self)&&(self.worker=new Vn(self)),Vn}),o(["./shared"],function(a){var h="3.17.0";const p={create:"create",load:"load",fullLoad:"fullLoad"},x={mark(_){performance.mark(_)},measure(_,d,m){performance.measure(_,d,m)}};function y(_){const d=_.name.split("?")[0];return a.a(d)&&d.includes("mapbox-gl.js")?"javascript":a.a(d)&&d.includes("mapbox-gl.css")?"css":a.b(d)?"fontRange":a.c(d)?"sprite":a.i(d)?"style":a.d(d)?"tilejson":"other"}var w,j={},S=function(){if(w)return j;function _(b){return!d(b)}function d(b){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var L,D,B=new Blob([""],{type:"text/javascript"}),V=URL.createObjectURL(B);try{D=new Worker(V),L=!0}catch{L=!1}return D&&D.terminate(),URL.revokeObjectURL(V),L}()?function(){var L=document.createElement("canvas");L.width=L.height=1;var D=L.getContext("2d");if(!D)return!1;var B=D.getImageData(0,0,1,1);return B&&B.width===L.width}()?(m[M=b&&b.failIfMajorPerformanceCaveat]===void 0&&(m[M]=function(L){var D,B=function(V){var Y=document.createElement("canvas"),Q=Object.create(_.webGLContextAttributes);return Q.failIfMajorPerformanceCaveat=V,Y.getContext("webgl2",Q)}(L);if(!B)return!1;try{D=B.createShader(B.VERTEX_SHADER)}catch{return!1}return!(!D||B.isContextLost())&&(B.shaderSource(D,"void main() {}"),B.compileShader(D),B.getShaderParameter(D,B.COMPILE_STATUS)===!0)}(M)),m[M]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var M}w=1,j.supported=_,j.notSupportedReason=d;var m={};return _.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},j}();function C(_,d,m){const b=document.createElement(_);return d!=null&&(b.className=d),m&&m.appendChild(b),b}function A(_,d,m){const b=document.createElementNS("http://www.w3.org/2000/svg",_);for(const M of Object.keys(d))b.setAttributeNS(null,M,String(d[M]));return m&&m.appendChild(b),b}const E=typeof document<"u"?document.documentElement&&document.documentElement.style:null,T=E&&E.userSelect!==void 0?"userSelect":"WebkitUserSelect";let O;function z(){E&&T&&(O=E[T],E[T]="none")}function F(){E&&T&&(E[T]=O)}function q(_){_.preventDefault(),_.stopPropagation(),window.removeEventListener("click",q,!0)}function H(){window.addEventListener("click",q,!0),window.setTimeout(()=>{window.removeEventListener("click",q,!0)},0)}function K(_,d){const m=_.getBoundingClientRect();return ue(_,m,d)}function Z(_,d){const m=_.getBoundingClientRect(),b=[];for(let M=0;Mthis._skuTokenExpiresAt}transformRequest(d,m){return this._transformRequestFn&&this._transformRequestFn(d,m)||{url:d}}normalizeStyleURL(d,m){if(!a.h(d))return d;const b=ie(d);return b.params.push(`sdk=js-${h}`),b.path=`/styles/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||m)}normalizeGlyphsURL(d,m){if(!a.h(d))return d;const b=ie(d);return b.path=`/fonts/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||m)}normalizeModelURL(d,m){if(!a.h(d))return d;const b=ie(d);return b.path=`/models/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||m)}normalizeSourceURL(d,m,b,M){if(!a.h(d))return d;const L=ie(d);return L.path=`/v4/${L.authority}.json`,L.params.push("secure"),b&&L.params.push(`language=${b}`),M&&L.params.push(`worldview=${M}`),this._makeAPIURL(L,this._customAccessToken||m)}normalizeIconsetURL(d,m){const b=ie(d);return a.h(d)?(b.path=`/styles/v1${b.path}/iconset.pbf`,this._makeAPIURL(b,this._customAccessToken||m)):fe(b)}normalizeSpriteURL(d,m,b,M){const L=ie(d);return a.h(d)?(L.path=`/styles/v1${L.path}/sprite${m}${b}`,this._makeAPIURL(L,this._customAccessToken||M)):(L.path+=`${m}${b}`,fe(L))}normalizeTileURL(d,m,b){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!a.h(d))return d;const M=ie(d);M.path=M.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${m||b&&M.authority!=="raster"&&b===512?"@2x":""}${a.k.supported?".webp":"$1"}`),M.authority==="raster"?M.path=`/${a.e.RASTER_URL_PREFIX}${M.path}`:M.authority==="rasterarrays"?M.path=`/${a.e.RASTERARRAYS_URL_PREFIX}${M.path}`:M.authority==="3dtiles"?M.path=`/${a.e.TILES3D_URL_PREFIX}${M.path}`:(M.path=M.path.replace(/^.+\/v4\//,"/"),M.path=`/${a.e.TILE_URL_VERSION}${M.path}`);const L=this._customAccessToken||function(D){for(const B of D){const V=B.match(/^access_token=(.*)$/);if(V)return V[1]}return null}(M.params)||a.e.ACCESS_TOKEN;return a.e.REQUIRE_ACCESS_TOKEN&&L&&this._skuToken&&M.params.push(`sku=${this._skuToken}`),this._makeAPIURL(M,L)}canonicalizeTileURL(d,m){const b=ie(d);if(!b.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!b.path.match(/\.[\w]+$/))return d;let M="mapbox://";b.path.match(/^\/raster\/v1\//)?M+=`raster/${b.path.replace(`/${a.e.RASTER_URL_PREFIX}/`,"")}`:b.path.match(/^\/rasterarrays\/v1\//)?M+=`rasterarrays/${b.path.replace(`/${a.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:M+=`tiles/${b.path.replace(`/${a.e.TILE_URL_VERSION}/`,"")}`;let L=b.params;return m&&(L=L.filter(D=>!D.match(/^access_token=/))),L.length&&(M+=`?${L.join("&")}`),M}canonicalizeTileset(d,m){const b=!!m&&a.h(m),M=[];for(const L of d.tiles||[])a.j(L)?M.push(this.canonicalizeTileURL(L,b)):M.push(L);return M}_makeAPIURL(d,m){const b="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",M=ie(a.e.API_URL);if(d.protocol=M.protocol,d.authority=M.authority,d.protocol==="http"){const L=d.params.indexOf("secure");L>=0&&d.params.splice(L,1)}if(M.path!=="/"&&(d.path=`${M.path}${d.path}`),!a.e.REQUIRE_ACCESS_TOKEN)return fe(d);if(m=m||a.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!m)throw new Error(`An API access token is required to use Mapbox GL. ${b}`);if(m[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${b}`)}return d.params=d.params.filter(L=>L.indexOf("access_token")===-1),d.params.push(`access_token=${m||""}`),fe(d)}}const ye=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ie(_){const d=_.match(ye);if(!d)throw new Error("Unable to parse URL object");return{protocol:d[1],authority:d[2],path:d[3]||"/",params:d[4]?d[4].split("&"):[]}}function fe(_){const d=_.params.length?`?${_.params.join("&")}`:"";return`${_.protocol}://${_.authority}${_.path}${d}`}const de="mapbox.eventData";function _e(_){if(!_)return null;const d=_.split(".");if(!d||d.length!==3)return null;try{return JSON.parse(a.l(d[1]))}catch{return null}}class Ee{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const m=_e(a.e.ACCESS_TOKEN);let b="";return b=m&&m.u?a.f(m.u):a.e.ACCESS_TOKEN||"",d?`${de}.${d}:${b}`:`${de}:${b}`}fetchEventData(){const d=a.s("localStorage"),m=this.getStorageKey(),b=this.getStorageKey("uuid"),M=this.getStorageKey("uuidTimestamp");if(d)try{const L=localStorage.getItem(m);L&&(this.eventData=JSON.parse(L));const D=localStorage.getItem(b);D&&(this.anonId=D);const B=localStorage.getItem(M);B&&(this.anonIdTimestamp=Number(B));const V=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(m,JSON.stringify(this.eventData)),D&&localStorage.setItem(M,D.toString())}catch{a.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,m,b,M){if(!a.e.EVENTS_URL)return;const L=ie(a.e.EVENTS_URL);L.params.push(`access_token=${M||a.e.ACCESS_TOKEN||""}`);const D={event:this.type,created:new Date(d).toISOString()},B=m?Object.assign(D,m):D,V={url:fe(L),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=a.p(V,Y=>{this.pendingRequest=null,b(Y),this.saveEventData(),this.processRequests(M)})}queueRequest(d,m){this.queue.push(d),this.processRequests(m)}}class ke extends Ee{constructor(d){super("metrics"),d&&(this.data=d)}postMetricsEvent(d){if(!a.e.EVENTS_URL||!d&&!a.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID();const m=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:m},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:m,payload:b}=this.queue.shift();this.postEvent(m,b,()=>{},d)}}const pe=new class extends Ee{constructor(_){super("appUserTurnstile"),this._customAccessToken=_}postTurnstileEvent(_,d){a.e.EVENTS_URL&&a.e.ACCESS_TOKEN&&Array.isArray(_)&&_.some(m=>a.h(m)||a.j(m))&&this.queueRequest(Date.now(),d)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=_e(a.e.ACCESS_TOKEN),m=d?d.u:a.e.ACCESS_TOKEN;let b=m!==this.eventData.tokenU;a.v(this.anonId)||(this.refreshUUID(),b=!0);const M=this.queue.shift();if(this.eventData.lastSuccess){const L=new Date(this.eventData.lastSuccess),D=new Date(M),B=(M-this.eventData.lastSuccess)/864e5;b=b||B>=1||B<-1||L.getDate()!==D.getDate()}else b=!0;b?this.postEvent(M,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:he,"enabled.telemetry":!1,userId:this.anonId},L=>{L||(this.eventData.lastSuccess=M,this.eventData.tokenU=m)},_):this.processRequests()}},ae=pe.postTurnstileEvent.bind(pe),ge=new class extends Ee{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(_,d,m,b){this.skuToken=d,this.errorCb=b,a.e.EVENTS_URL&&(m||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},m):this.errorCb(new Error(be)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID(),this.postEvent(m,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:he,skuToken:this.skuToken,userId:this.anonId},b=>{b?this.errorCb(b):d&&(this.success[d]=!0)},_))}remove(){this.errorCb=null}},Me=ge.postMapLoadEvent.bind(ge),Ue=new class extends Ee{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(_){let d=this.mapInstanceIdMap.get(_);return d||(d=a.u(),this.mapInstanceIdMap.set(_,d)),d}getEventId(_){const d=this.eventIdPerMapInstanceMap.get(_)||0;return this.eventIdPerMapInstanceMap.set(_,d+1),d}postStyleLoadEvent(_,d){const{map:m,style:b,importedStyles:M}=d;if(!a.e.EVENTS_URL||!_&&!a.e.ACCESS_TOKEN)return;const L=this.getMapInstanceId(m),D={mapInstanceId:L,eventId:this.getEventId(L),style:b};M.length&&(D.importedStyles=M),this.queueRequest({timestamp:Date.now(),payload:D},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:m}=this.queue.shift();this.postEvent(d,m,()=>{},_)}},Ie=Ue.postStyleLoadEvent.bind(Ue),Ke=new ke({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Re=Ke.postMetricsEvent.bind(Ke),Ce=new ke({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Je=Ce.postMetricsEvent.bind(Ce),Te=new class extends Ee{constructor(){super("gljs.performance")}postPerformanceEvent(_,d){a.e.EVENTS_URL&&(_||a.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:m}=this.queue.shift(),b=function(M){const L=performance.getEntriesByType("resource"),D=performance.getEntriesByType("mark"),B=function(ce){const je={};if(ce){for(const ve in ce)if(ve!=="other")for(const Le of ce[ve]){const Pe=`${ve}ResolveRangeMin`,$e=`${ve}ResolveRangeMax`,Ze=`${ve}RequestCount`,qe=`${ve}RequestCachedCount`;je[Pe]=Math.min(je[Pe]||1/0,Le.startTime),je[$e]=Math.max(je[$e]||-1/0,Le.responseEnd);const xt=lt=>{je[lt]===void 0&&(je[lt]=0),++je[lt]};Le.transferSize!==void 0&&Le.transferSize===0&&xt(qe),xt(Ze)}}return je}(function(ce,je){const ve={};if(ce)for(const Le of ce){const Pe=je(Le);ve[Pe]===void 0&&(ve[Pe]=[]),ve[Pe].push(Le)}return ve}(L,y)),V=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,Q=Y?Y.effectiveType:void 0,le={counters:[],metadata:[],attributes:[]},oe=(ce,je,ve)=>{ve!=null&&ce.push({name:je,value:ve.toString()})};for(const ce in B)oe(le.counters,ce,B[ce]);if(M.interactionRange[0]!==1/0&&M.interactionRange[1]!==-1/0&&(oe(le.counters,"interactionRangeMin",M.interactionRange[0]),oe(le.counters,"interactionRangeMax",M.interactionRange[1])),D)for(const ce of Object.values(p)){const je=D.find(ve=>ve.name===ce);je&&oe(le.counters,ce,je.startTime)}return oe(le.counters,"visibilityHidden",M.visibilityHidden),oe(le.attributes,"style",function(ce){if(ce)for(const je of ce){const ve=je.name.split("?")[0];if(a.i(ve)){const Le=ve.split("/").slice(-2);if(Le.length===2)return`mapbox://styles/${Le[0]}/${Le[1]}`}}}(L)),oe(le.attributes,"terrainEnabled",M.terrainEnabled?"true":"false"),oe(le.attributes,"fogEnabled",M.fogEnabled?"true":"false"),oe(le.attributes,"projection",M.projection),oe(le.attributes,"zoom",M.zoom),oe(le.metadata,"devicePixelRatio",V),oe(le.metadata,"connectionEffectiveType",Q),oe(le.metadata,"navigatorUserAgent",navigator.userAgent),oe(le.metadata,"screenWidth",window.screen.width),oe(le.metadata,"screenHeight",window.screen.height),oe(le.metadata,"windowWidth",window.innerWidth),oe(le.metadata,"windowHeight",window.innerHeight),oe(le.metadata,"mapWidth",M.width/V),oe(le.metadata,"mapHeight",M.height/V),oe(le.metadata,"webglRenderer",M.renderer),oe(le.metadata,"webglVendor",M.vendor),oe(le.metadata,"sdkVersion",h),oe(le.metadata,"sdkIdentifier","mapbox-gl-js"),le}(m);for(const M of b.metadata);for(const M of b.counters);for(const M of b.attributes);this.postEvent(d,b,()=>{},_)}},Ye=Te.postPerformanceEvent.bind(Te),xe=new class extends Ee{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(_,d,m,b){if(!a.e.API_URL||!a.e.SESSION_PATH)return;const M=ie(a.e.API_URL+a.e.SESSION_PATH);M.params.push(`sku=${d||""}`),M.params.push(`access_token=${b||a.e.ACCESS_TOKEN||""}`);const L={url:fe(M),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a.g(L,D=>{this.pendingRequest=null,m(D),this.saveEventData(),this.processRequests(b)})}getSessionAPI(_,d,m,b){this.skuToken=d,this.errorCb=b,a.e.SESSION_PATH&&a.e.API_URL&&(m||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},m):this.errorCb(new Error(be)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||this.getSession(m,this.skuToken,b=>{b?this.errorCb(b):d&&(this.success[d]=!0)},_)}remove(){this.errorCb=null}},mt=xe.getSessionAPI.bind(xe),et=new Set;function nt(_,d){d?et.add(_):et.delete(_)}class Ae{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(d,m){this._updatedSourceCaches[d]=m,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const m=d.scope;this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._updatedLayers[m].add(d.id),this.setDirty()}removeLayer(d){const m=d.scope;this._removedLayers[m]=this._removedLayers[m]||{},this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._removedLayers[m][d.id]=d,this._updatedLayers[m].delete(d.id),this._updatedPaintProps.delete(d.fqid),this.setDirty()}getRemovedLayer(d){return this._removedLayers[d.scope]?this._removedLayers[d.scope][d.id]:null}discardLayerRemoval(d){this._removedLayers[d.scope]&&delete this._removedLayers[d.scope][d.id]}getLayerUpdatesByScope(){const d={};for(const m in this._updatedLayers)d[m]=d[m]||{},d[m].updatedIds=Array.from(this._updatedLayers[m].values());for(const m in this._removedLayers)d[m]=d[m]||{},d[m].removedIds=Object.keys(this._removedLayers[m]);return d}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(d){this._updatedPaintProps.add(d.fqid),this.setDirty()}getUpdatedImages(d){return this._updatedImages[d]?Array.from(this._updatedImages[d].values()):[]}updateImage(d,m){this._updatedImages[m]=this._updatedImages[m]||new Set,this._updatedImages[m].add(a.I.toString(d)),this.setDirty()}resetUpdatedImages(d){this._updatedImages[d]&&this._updatedImages[d].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function pt(_){const{userImage:d}=_;return!!(d&&d.render&&d.render())&&(_.data.replace(new Uint8Array(d.data.buffer)),!0)}class Be extends a.E{constructor(d){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=d,d!=="raster"&&a.r()&&(this.imageRasterizerDispatcher=new a.D(a.t(),this,"Image Rasterizer Worker",1))}addScope(d){this.loaded.set(d,!1),this.imageProviders.set(d,new Map),this.images.set(d,new Map),this.updatedImages.set(d,new Set),this.callbackDispatchedThisFrame.set(d,new Set),this.patterns.set(d,new Map),this.atlasImage.set(d,new a.q({width:1,height:1}))}removeScope(d){this.loaded.delete(d),this.imageProviders.delete(d),this.images.delete(d),this.updatedImages.delete(d),this.callbackDispatchedThisFrame.delete(d),this.patterns.delete(d),this.atlasImage.delete(d);const m=this.atlasTexture.get(d);m&&(m.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,m){this.imageProviders.has(m)||this.imageProviders.set(m,new Map),this.imageProviders.get(m).set(d.id,d)}removeImageProvider(d,m){this.imageProviders.has(m)&&this.imageProviders.get(m).delete(d)}getPendingImageProviders(){const d=[];for(const m of this.imageProviders.values())for(const b of m.values())b.hasPendingRequests()&&d.push(b);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new a.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,m){if(this.loaded.get(m)!==d&&(this.loaded.set(m,d),d)){for(const{ids:b,callback:M}of this.requestors)this._notify(b,m,M);this.requestors=[]}}hasImage(d,m){return!!this.getImage(d,m)}getImage(d,m){return this.images.get(m).get(d.toString())}addImage(d,m,b){this._validate(d,b)&&this.images.get(m).set(d.toString(),b)}_validate(d,m){let b=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),b=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),b=!1),this._validateContent(m.content,m)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "content" value`))),b=!1),b}_validateStretch(d,m){if(!d)return!0;let b=0;for(const M of d){if(M[0]a.I.from(m))}getImages(d,m,b){const M=[],L=[],D=this.imageProviders.get(m);for(const Q of d){if(!Q.iconsetId){M.push(Q);continue}const le=D.get(Q.iconsetId);le&&(this.getImage(Q,m)?L.push(Q):le.addPendingRequest(Q))}if(M.length===0)return void this._notify(L,m,b);let B=!0;const V=!!this.loaded.get(m),Y=this.images.get(m);if(!V)for(const Q of M)Y.has(Q.toString())||(B=!1);V||B?this._notify(M,m,b):this.requestors.push({ids:M,scope:m,callback:b})}rasterizeImages(d,m){const b=new Map,{tasks:M,scope:L}=d;for(const[D,B]of M.entries()){const V=this.getImage(B.id,L);V&&b.set(D,{image:V,imageVariant:B})}this._rasterizeImages(L,b,m)}_rasterizeImages(d,m,b){if(a.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:m,scope:d},b);else{const M=new Map;for(const[L,{image:D,imageVariant:B}]of m.entries())M.set(L,this.imageRasterizer.rasterize(B,D,d,0));b(void 0,M)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,m,b){const M=this.images.get(m),L=new Map;for(const D of d){if(!M.get(D.toString())){if(D.iconsetId)continue;this.fire(new a.z("styleimagemissing",{id:D.name}))}const B=M.get(D.toString());if(!B){a.w(`Image "${D.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const V={data:B.usvg?null:B.data.clone(),pixelRatio:B.pixelRatio,sdf:B.sdf,usvg:B.usvg,version:B.version,stretchX:B.stretchX,stretchY:B.stretchY,content:B.content,hasRenderCallback:!!(B.userImage&&B.userImage.render)};B.usvg&&Object.assign(V,{width:B.icon.usvg_tree.width,height:B.icon.usvg_tree.height}),L.set(a.I.toString(D),V)}b(null,L)}getPixelSize(d){const{width:m,height:b}=this.atlasImage.get(d);return{width:m,height:b}}getPattern(d,m,b){const M=d.toString(),L=this.patterns.get(m),D=L.get(M),B=this.getImage(d,m);if(!B)return null;if(D){if(D.position.version===B.version)return D.position;D.position.version=B.version}else{if(B.usvg&&!B.data){const V=this.getPatternInFlightId(M,m);if(this.patternsInFlight.has(V))return null;this.patternsInFlight.add(V);const Y=new a.A(d).scaleSelf(a.o.devicePixelRatio),Q=new Map([[Y.toString(),{image:B,imageVariant:Y}]]);return this._rasterizeImages(m,Q,(le,oe)=>this.storePatternImage(Y,m,B,b,oe)),null}this.storePattern(d,m,B)}return this._updatePatternAtlas(m,b),L.get(M).position}getPatternInFlightId(d,m){return a.B(d,m)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,m,b,M,L){const D=d.toString(),B=L?L.get(D):void 0;B&&(b.data=B,this.storePattern(d.id,m,b),this._updatePatternAtlas(m,M),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),m)))}storePattern(d,m,b){const M={w:b.data.width+2*a.C,h:b.data.height+2*a.C,x:0,y:0},L=new a.F(M,b,a.C);this.patterns.get(m).set(d.toString(),{bin:M,position:L})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,m){const b=d.gl;let M=this.atlasTexture.get(m);M?this.dirty&&(M.update(this.atlasImage.get(m)),this.dirty=!1):(M=new a.T(d,this.atlasImage.get(m),b.RGBA8),this.atlasTexture.set(m,M)),M.bind(b.LINEAR,b.CLAMP_TO_EDGE)}_updatePatternAtlas(d,m){const b=this.patterns.get(d),M=Array.from(b.values()).map(({bin:Y})=>Y),{w:L,h:D}=a.G(M),B=this.atlasImage.get(d);B.resize({width:L||1,height:D||1});const V=this.images.get(d);for(const[Y,{bin:Q,position:le}]of b.entries()){let oe=le.padding;const ce=Q.x+oe,je=Q.y+oe,ve=V.get(Y).data,Le=ve.width,Pe=ve.height;oe=oe>1?oe-1:oe,a.q.copy(ve,B,{x:0,y:0},{x:ce,y:je},{width:Le,height:Pe},m),a.q.copy(ve,B,{x:0,y:Pe-oe},{x:ce,y:je-oe},{width:Le,height:oe},m),a.q.copy(ve,B,{x:0,y:0},{x:ce,y:je+Pe},{width:Le,height:oe},m),a.q.copy(ve,B,{x:Le-oe,y:0},{x:ce-oe,y:je},{width:oe,height:Pe},m),a.q.copy(ve,B,{x:0,y:0},{x:ce+Le,y:je},{width:oe,height:Pe},m),a.q.copy(ve,B,{x:Le-oe,y:Pe-oe},{x:ce-oe,y:je-oe},{width:oe,height:oe},m),a.q.copy(ve,B,{x:0,y:Pe-oe},{x:ce+Le,y:je-oe},{width:oe,height:oe},m),a.q.copy(ve,B,{x:0,y:0},{x:ce+Le,y:je+Pe},{width:oe,height:oe},m),a.q.copy(ve,B,{x:Le-oe,y:0},{x:ce-oe,y:je+Pe},{width:oe,height:oe},m)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,m){const b=this.images.get(m);for(const M of d){if(this.callbackDispatchedThisFrame.get(m).has(M.toString()))continue;this.callbackDispatchedThisFrame.get(m).add(M.toString());const L=b.get(M.toString());pt(L)&&this.updateImage(M,m,L)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Qe(_){const d=_.value,m=_.valueSpec,b=_.style,M=_.styleSpec,L=_.key,D=_.arrayElementValidator||Ws;if(!Array.isArray(d))return[new a.V(L,d,`array expected, ${a.K(d)} found`)];if(m.length&&d.length!==m.length)return[new a.V(L,d,`array length ${m.length} expected, length ${d.length} found`)];if(m["min-length"]&&d.lengthM)return[new a.V(d,m,`${m} is greater than the maximum value ${M}`)]}return[]}function ht(_){const d=_.key,m=_.value;if(!a.H(m))return[new a.V(d,m,`object expected, ${a.K(m)} found`)];const b=_.valueSpec,M=a.J(m.type);let L,D,B,V={};const Y=M!=="categorical"&&m.property===void 0,Q=!Y,le=function(ve){const Le=ve.stops;return Array.isArray(Le)&&Array.isArray(Le[0])&&a.H(Le[0][0])}(m),oe=Zi({key:_.key,value:_.value,valueSpec:_.styleSpec.function,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{stops:function(ve){if(M==="identity")return[new a.V(ve.key,ve.value,'identity function may not have a "stops" property')];let Le=[];const Pe=ve.value;return Le=Le.concat(Qe({key:ve.key,value:Pe,valueSpec:ve.valueSpec,style:ve.style,styleSpec:ve.styleSpec,arrayElementValidator:ce})),Array.isArray(Pe)&&Pe.length===0&&Le.push(new a.V(ve.key,Pe,"array must have at least one stop")),Le},default:function(ve){return Ws({key:ve.key,value:ve.value,valueSpec:b,style:ve.style,styleSpec:ve.styleSpec})}}});return M==="identity"&&Y&&oe.push(new a.V(_.key,_.value,'missing required property "property"')),M==="identity"||m.stops||oe.push(new a.V(_.key,_.value,'missing required property "stops"')),M==="exponential"&&b.expression&&!a.M(b)&&oe.push(new a.V(_.key,_.value,"exponential functions not supported")),_.styleSpec.$version>=8&&(Q&&!a.N(b)?oe.push(new a.V(_.key,_.value,"property functions not supported")):Y&&!a.O(b)&&oe.push(new a.V(_.key,_.value,"zoom functions not supported"))),M!=="categorical"&&!le||m.property!==void 0||oe.push(new a.V(_.key,_.value,'"property" property is required')),oe;function ce(ve){let Le=[];const Pe=ve.value,$e=ve.key;if(!Array.isArray(Pe))return[new a.V($e,Pe,`array expected, ${a.K(Pe)} found`)];if(Pe.length!==2)return[new a.V($e,Pe,`array length 2 expected, length ${Pe.length} found`)];if(le){if(!a.H(Pe[0]))return[new a.V($e,Pe,`object expected, ${a.K(Pe[0])} found`)];const Ze=Pe[0];if(Ze.zoom===void 0)return[new a.V($e,Pe,"object stop key must have zoom")];if(Ze.value===void 0)return[new a.V($e,Pe,"object stop key must have value")];const qe=a.J(Ze.zoom);if(typeof qe!="number")return[new a.V($e,Ze.zoom,"stop zoom values must be numbers")];if(B&&B>qe)return[new a.V($e,Ze.zoom,"stop zoom values must appear in ascending order")];qe!==B&&(B=qe,D=void 0,V={}),Le=Le.concat(Zi({key:`${$e}[0]`,value:Pe[0],valueSpec:{zoom:{}},style:ve.style,styleSpec:ve.styleSpec,objectElementValidators:{zoom:tt,value:je}}))}else Le=Le.concat(je({key:`${$e}[0]`,value:Pe[0],style:ve.style,styleSpec:ve.styleSpec},Pe));return a.Q(a.S(Pe[1]))?Le.concat([new a.V(`${$e}[1]`,Pe[1],"expressions are not allowed in function stops.")]):Le.concat(Ws({key:`${$e}[1]`,value:Pe[1],valueSpec:b,style:ve.style,styleSpec:ve.styleSpec}))}function je(ve,Le){const Pe=a.K(ve.value),$e=a.J(ve.value),Ze=ve.value!==null?ve.value:Le;if(L){if(Pe!==L)return[new a.V(ve.key,Ze,`${Pe} stop domain type must match previous stop domain type ${L}`)]}else L=Pe;if(Pe!=="number"&&Pe!=="string"&&Pe!=="boolean"&&typeof $e!="number"&&typeof $e!="string"&&typeof $e!="boolean")return[new a.V(ve.key,Ze,"stop domain value must be a number, string, or boolean")];if(Pe!=="number"&&M!=="categorical"){let qe=`number expected, ${Pe} found`;return a.N(b)&&M===void 0&&(qe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new a.V(ve.key,Ze,qe)]}return M!=="categorical"||Pe!=="number"||typeof $e=="number"&&isFinite($e)&&Math.floor($e)===$e?M!=="categorical"&&Pe==="number"&&typeof $e=="number"&&typeof D=="number"&&D!==void 0&&$enew a.V(`${_.key}${b.key}`,_.value,b.message));const m=d.value.expression||d.value._styleExpression.expression;if(_.expressionContext==="property"&&_.propertyKey==="text-font"&&!m.outputDefined())return[new a.V(_.key,_.value,`Invalid data expression for "${_.propertyKey}". Output values must be contained as literals within the expression.`)];if(_.expressionContext==="property"&&_.propertyType==="layout"&&!a.Z(m))return[new a.V(_.key,_.value,'"feature-state" data expressions are not supported with layout properties.')];if(_.expressionContext==="filter")return Ct(m,_);if(_.expressionContext==="appearance")return It(m,_);if(_.expressionContext&&_.expressionContext.indexOf("cluster")===0){if(!a.X(m,["zoom","feature-state"]))return[new a.V(_.key,_.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(_.expressionContext==="cluster-initial"&&!a.Y(m))return[new a.V(_.key,_.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ct(_,d){const m=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.delete(M);if(m.size===0)return[];const b=[];return _ instanceof a._&&m.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(_.eachChild(M=>{b.push(...Ct(M,d))}),b)}function It(_,d){const m=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.add(M);if(m.size===0)return[];const b=[];return _ instanceof a._&&!m.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] is not an allowed parameter`)]:(_.eachChild(M=>{b.push(...It(M,d))}),b)}function jt(_){const d=_.key,m=_.value,b=_.valueSpec,M=[];return Array.isArray(b.values)?b.values.indexOf(a.J(m))===-1&&M.push(new a.V(d,m,`expected one of [${b.values.join(", ")}], ${JSON.stringify(m)} found`)):Object.keys(b.values).indexOf(a.J(m))===-1&&M.push(new a.V(d,m,`expected one of [${Object.keys(b.values).join(", ")}], ${JSON.stringify(m)} found`)),M}function rr(_){return a.a2(a.S(_.value))?wt(Object.assign({},_,{expressionContext:"filter",valueSpec:_.styleSpec[`filter_${_.layerType||"fill"}`]})):Ar(_)}function Ar(_){const d=_.value,m=_.key;if(!Array.isArray(d))return[new a.V(m,d,`array expected, ${a.K(d)} found`)];if(d.length<1)return[new a.V(m,d,"filter array must have at least 1 element")];const b=_.styleSpec;let M=jt({key:`${m}[0]`,value:d[0],valueSpec:b.filter_operator});const L=()=>{d.length>=2&&(a.a0(d[1])||M.push(new a.V(`${m}[1]`,d[1],`string expected, ${a.K(d[1])} found`)));for(let D=2;D":case">=":d.length>=2&&a.J(d[1])==="$type"&&M.push(new a.V(m,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&M.push(new a.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),L();break;case"==":case"!=":d.length!==3&&M.push(new a.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),L();break;case"in":case"!in":L();break;case"any":case"all":case"none":for(let D=1;D{Y in m&&d.push(new a.V(b,m[Y],`"${Y}" is prohibited for ref layers`))}),M.layers.forEach(Y=>{a.J(Y.id)===B&&(V=Y)}),V?V.ref?d.push(new a.V(b,m.ref,"ref cannot reference another ref layer")):D=a.J(V.type):typeof B=="string"&&d.push(new a.V(b,m.ref,`ref layer "${B}" not found`))}else if(D!=="background"&&D!=="sky"&&D!=="slot")if(m.source)if(a.a0(m.source)){const V=M.sources&&M.sources[m.source],Y=V&&a.J(V.type);V?Y==="vector"&&D==="raster"?d.push(new a.V(b,m.source,`layer "${m.id}" requires a raster source`)):Y==="raster"&&D!=="raster"?d.push(new a.V(b,m.source,`layer "${m.id}" requires a vector source`)):Y!=="vector"||m["source-layer"]?Y==="raster-dem"&&D!=="hillshade"?d.push(new a.V(b,m.source,"raster-dem source can only be used with layer type 'hillshade'.")):Y!=="raster-array"||["raster","raster-particle"].includes(D)?D==="line"&&m.paint&&(m.paint["line-gradient"]||m.paint["line-trim-offset"])&&Y==="geojson"&&!V.lineMetrics?d.push(new a.V(b,m,`layer "${m.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):D==="raster-particle"&&Y!=="raster-array"&&d.push(new a.V(b,m.source,`layer "${m.id}" requires a 'raster-array' source.`)):d.push(new a.V(b,m.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new a.V(b,m,`layer "${m.id}" must specify a "source-layer"`)):d.push(new a.V(b,m.source,`source "${m.source}" not found`))}else d.push(new a.V(`${b}.source`,m.source,'"source" must be a string'));else d.push(new a.V(b,m,'missing required property "source"'));return d=d.concat(Zi({key:b,value:m,valueSpec:L.layer,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ws({key:`${b}.type`,value:m.type,valueSpec:L.layer.type,style:_.style,styleSpec:_.styleSpec,object:m,objectKey:"type"}),filter:V=>rr(Object.assign({layerType:D},V)),layout:V=>Zi({layer:m,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>Jr(Object.assign({layerType:D},Y))}}),paint:V=>Zi({layer:m,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>kn(Object.assign({layerType:D,layer:m},Y))}}),appearances(V){const Y=Qe({key:V.key,value:V.value,valueSpec:V.valueSpec,style:V.style,styleSpec:V.styleSpec,arrayElementValidator:oe=>function(ce){const{key:je,layer:ve,layerType:Le}=ce,Pe=a.J(ce.value),$e=a.J(Pe.name),Ze=a.J(Pe.condition),qe=Zi({key:je,value:Pe,valueSpec:ce.styleSpec.appearance,style:ce.style,styleSpec:ce.styleSpec,objectElementValidators:{condition:xt=>function(lt){const ft=[];return ft.push(...wt({key:lt.key,value:lt.object.condition,valueSpec:a.a6.appearance.condition,expressionContext:"appearance"})),ft}(Object.assign({layer:ve,layerType:Le},xt)),properties:xt=>function(lt){const ft=[],{styleSpec:ot,layer:st,layerType:bt}=lt,Ot=ot[`paint_${bt}`],Pt=ot[`layout_${bt}`],Vt=lt.object[lt.objectKey];for(const Ht in Vt){const sr=Ht in Ot?"paint":Ht in Pt?"layout":void 0;if(!sr){ft.push(new a.V(lt.key,Ht,`unknown property "${Ht}" for layer type "${bt}"`));continue}const br=Object.assign({},lt,{key:`${lt.key}.${Ht}`,object:Vt,objectKey:Ht,layer:st,layerType:bt,value:Vt[Ht],valueSpec:sr==="paint"?Ot[Ht]:Pt[Ht]});ft.push(...gn(br,sr))}return ft}(Object.assign({layer:ve,layerType:Le},xt))}});return $e!=="hidden"&&Ze===void 0&&qe.push(new a.V(ce.key,"name",'Appearance with name different than "hidden" must have a condition')),qe}(Object.assign({layerType:D,layer:m},oe))}),Q=Array.isArray(V.value)?V.value:[],le=new Set;return Q.forEach((oe,ce)=>{const je=a.J(oe.name);if(je)if(le.has(je)){const ve=a.J(m.id);Y.push(new a.V(V.key,je,`Duplicated appearance name "${je}" for layer "${ve}"`))}else le.add(je)}),Y}}})),d}function js({key:_,value:d}){return a.a0(d)?[]:[new a.V(_,d,`string expected, ${a.K(d)} found`)]}const fr={promoteId:function _({key:d,value:m}){if(a.a0(m))return js({key:d,value:m});if(Array.isArray(m)){const M=[],L=a.S(m),D=a.U(L);return D.result==="error"&&D.value.forEach(B=>{M.push(new a.V(`${d}${B.key}`,null,`${B.message}`))}),a.X(D.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||M.push(new a.V(`${d}`,null,"promoteId expression should be only feature dependent")),M}if(!a.H(m))return[new a.V(d,m,`string, expression or object expected, "${a.K(m)}" found`)];const b=[];for(const M in m)b.push(..._({key:`${d}.${M}`,value:m[M]}));return b}};function xs(_){const d=_.value,m=_.key,b=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(m,d,`object expected, ${a.K(d)} found`)];if(!("type"in d))return[new a.V(m,d,'"type" is required')];const L=a.J(d.type);let D=[];switch(["vector","raster","raster-dem","raster-array"].includes(L)&&("url"in d||"tiles"in d||D.push(new a.a3(m,d,'Either "url" or "tiles" is required.'))),L){case"vector":case"raster":case"raster-dem":case"raster-array":return D=D.concat(Zi({key:m,value:d,valueSpec:b[`source_${L.replace("-","_")}`],style:_.style,styleSpec:b,objectElementValidators:fr})),D;case"geojson":if(D=Zi({key:m,value:d,valueSpec:b.source_geojson,style:M,styleSpec:b,objectElementValidators:fr}),"cluster"in d&&"clusterProperties"in d){if(!a.H(d.clusterProperties))return[new a.V(`${m}.clusterProperties`,d,`object expected, ${a.K(d)} found`)];for(const B in d.clusterProperties){const V=d.clusterProperties[B];if(!Array.isArray(V))return[new a.V(`${m}.clusterProperties.${B}`,V,"array expected")];const[Y,Q]=V,le=typeof Y=="string"?[Y,["accumulated"],["get",B]]:Y;D.push(...wt({key:`${m}.${B}.map`,value:Q,expressionContext:"cluster-map"})),D.push(...wt({key:`${m}.${B}.reduce`,value:le,expressionContext:"cluster-reduce"}))}}return D;case"video":return Zi({key:m,value:d,valueSpec:b.source_video,style:M,styleSpec:b});case"image":return Zi({key:m,value:d,valueSpec:b.source_image,style:M,styleSpec:b});case"canvas":return[new a.V(m,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return jt({key:`${m}.type`,value:d.type,valueSpec:{values:bi(b)}})}}function bi(_){return _.source.reduce((d,m)=>{const b=_[m];return b.type.type==="enum"&&(d=d.concat(Object.keys(b.type.values||{}))),d},[])}function mi(_){const d=_.value,m=_.styleSpec,b=m.light,M=_.style;if(d===void 0)return[];if(!a.H(d))return[new a.V("light",d,`object expected, ${a.K(d)} found`)];let L=[];for(const D in d){const B=D.match(/^(.*)-transition$/),V=D.match(/^(.*)-use-theme$/);L=L.concat(V&&b[V[1]]?Ws({key:D,value:d[D],valueSpec:{type:"string"},style:M,styleSpec:m}):B&&b[B[1]]&&b[B[1]].transition?Ws({key:D,value:d[D],valueSpec:m.transition,style:M,styleSpec:m}):b[D]?Ws({key:D,value:d[D],valueSpec:b[D],style:M,styleSpec:m}):[new a.V(D,d[D],`unknown property "${D}"`)])}return L}function La(_){const d=_.value;if(!d)return[];const m=_.key;if(!a.H(d))return[new a.V(m,d,`object expected, ${a.K(d)} found`)];let b=[];const M=_.styleSpec,L=M["light-3d"],D=_.style,B=_.style.lights;for(const Q of["type","id"])if(!(Q in d))return b=b.concat([new a.V(m,d,`missing property "${Q}"`)]),b;if(!a.a0(d.type))return b=b.concat([new a.V(`${m}.type`,d.type,"string expected")]),b;if(B)for(let Q=0;Q<_.arrayIndex;Q++){const le=a.J(d.type),oe=B[Q];a.J(oe.type)===le&&b.push(new a.V(m,d.id,`duplicate light type "${d.type}", previously defined at line ${oe.id.__line__}`))}const V=`properties_light_${d.type}`;if(!(V in M))return b=b.concat([new a.V(`${m}.type`,d,`Invalid light type ${d.type}`)]),b;const Y=M[V];for(const Q in d)if(Q==="properties"){const le=d[Q];if(!a.H(le))return b=b.concat([new a.V("properties",le,`object expected, ${a.K(le)} found`)]),b;for(const oe in le){const ce=oe.match(/^(.*)-transition$/),je=oe.match(/^(.*)-use-theme$/);b=b.concat(je&&Y[je[1]]?Ws({key:Q,value:le[oe],valueSpec:{type:"string"},style:D,styleSpec:M}):ce&&Y[ce[1]]&&Y[ce[1]].transition?Ws({key:Q,value:d[Q],valueSpec:M.transition,style:D,styleSpec:M}):Y[oe]?Ws({key:oe,value:le[oe],valueSpec:Y[oe],style:D,styleSpec:M}):[new a.a3(_.key,le[oe],`unknown property "${oe}"`)])}}else b=b.concat(L[Q]?Ws({key:Q,value:d[Q],valueSpec:L[Q],style:D,styleSpec:M}):[new a.a3(Q,d[Q],`unknown property "${Q}"`)]);return b}function da(_){const d=_.value,m=_.key,b=_.style,M=_.styleSpec,L=M.terrain;if(d==null)return[];if(!a.H(d))return[new a.V("terrain",d,`object expected, ${a.K(d)} found`)];let D=[];for(const B in d){const V=B.match(/^(.*)-transition$/),Y=B.match(/^(.*)-use-theme$/);D=D.concat(Y&&L[Y[1]]?Ws({key:B,value:d[B],valueSpec:{type:"string"},style:b,styleSpec:M}):V&&L[V[1]]&&L[V[1]].transition?Ws({key:B,value:d[B],valueSpec:M.transition,style:b,styleSpec:M}):L[B]?Ws({key:B,value:d[B],valueSpec:L[B],style:b,styleSpec:M}):[new a.a3(B,d[B],`unknown property "${B}"`)])}if(d.source)if(a.a0(d.source)){const B=b.sources&&b.sources[d.source],V=B&&a.J(B.type);B?V!=="raster-dem"&&D.push(new a.V(`${m}.source`,d.source,`terrain cannot be used with a source of type ${V}, it only be used with a "raster-dem" source type`)):D.push(new a.V(`${m}.source`,d.source,`source "${d.source}" not found`))}else D.push(new a.V(`${m}.source`,d.source,"source must be a string"));else D.push(new a.V(m,d,'terrain is missing required property "source"'));return D}function tl(_){const d=_.value,m=_.style,b=_.styleSpec,M=b.fog;if(d===void 0)return[];if(!a.H(d))return[new a.V("fog",d,`object expected, ${a.K(d)} found`)];let L=[];for(const D in d){const B=D.match(/^(.*)-transition$/),V=D.match(/^(.*)-use-theme$/);L=L.concat(V&&M[V[1]]?Ws({key:D,value:d[D],valueSpec:{type:"string"},style:m,styleSpec:b}):B&&M[B[1]]&&M[B[1]].transition?Ws({key:D,value:d[D],valueSpec:b.transition,style:m,styleSpec:b}):M[D]?Ws({key:D,value:d[D],valueSpec:M[D],style:m,styleSpec:b}):[new a.a3(D,d[D],`unknown property "${D}"`)])}return L}const rl={"*":()=>[],array:Qe,boolean:function(_){const d=_.value,m=_.key;return a.$(d)?[]:[new a.V(m,d,`boolean expected, ${a.K(d)} found`)]},number:tt,color:function({key:_,value:d}){return a.a0(d)?a.a1.parseCSSColor(d)===null?[new a.V(_,d,`color expected, "${d}" found`)]:[]:[new a.V(_,d,`color expected, ${a.K(d)} found`)]},enum:jt,filter:rr,function:ht,layer:zn,object:Zi,source:xs,model:a.a7,light:mi,"light-3d":La,terrain:da,fog:tl,string:js,formatted:function(_){return js(_).length===0?[]:wt(_)},resolvedImage:function(_){return js(_).length===0?[]:wt(_)},projection:function(_){const d=_.value,m=_.styleSpec,b=m.projection,M=_.style;if(a.H(d)){let L=[];for(const D in d)L=L.concat(Ws({key:D,value:d[D],valueSpec:b[D],style:M,styleSpec:m}));return L}return a.a0(d)?[]:[new a.V("projection",d,`object or string expected, ${a.K(d)} found`)]},import:function(_){const d=_.key,{value:m,styleSpec:b}=_;if(!a.H(m))return[new a.V(d,m,"import must be an object")];const{data:M,...L}=m;Object.defineProperty(L,"__line__",{value:m.__line__,enumerable:!1});let D=Zi(Object.assign({},_,{value:L,valueSpec:b.import}));return a.J(L.id)===""&&D.push(new a.V(`${_.key}.id`,L,"import id can't be an empty string")),M&&(D=D.concat(Ei(M,b,{key:`${_.key}.data`}))),D},iconset:function(_){const d=_.value,m=_.key,b=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(m,d,"object expected")];if(!d.type)return[new a.V(m,d,'"type" is required')];const L=a.J(d.type);let D=[];if(D=D.concat(Zi({key:m,value:d,valueSpec:b[`iconset_${L}`],style:M,styleSpec:b})),function(B,V){return!(B!=="source"||!V.source)}(L,d)){const B=M.sources&&M.sources[d.source],V=B&&a.J(B.type);B?V!=="raster-array"&&D.push(new a.V(m,d.source,`iconset cannot be used with a source of type ${String(V)}, it only be used with a "raster-array" source type`)):D.push(new a.V(m,d.source,`source "${d.source}" not found`))}return D}};function Ws(_,d=!1){const m=_.value,b=_.valueSpec,M=_.styleSpec;if(b.expression){if(a.a4(a.J(m)))return ht(_);if(a.Q(a.S(m)))return wt(_)}if(b.type&&rl[b.type]){const L=rl[b.type](_);return d===!0&&L.length>0&&Array.isArray(_.value)?wt(_):L}return Zi(Object.assign({},_,{valueSpec:b.type?M[b.type]:b}))}function Zi(_){const d=_.key,m=_.value,b=_.valueSpec||{},M=_.objectElementValidators||{},L=_.style,D=_.styleSpec;if(!a.H(m))return[new a.V(d,m,`object expected, ${a.K(m)} found`)];let B=[];for(const V in m){const Y=V.split(".")[0];let Q;M[Y]?Q=M[Y]:b[Y]?Q=Ws:M["*"]?Q=M["*"]:b["*"]&&(Q=Ws),Q?B=B.concat(Q({key:(d&&`${d}.`)+V,value:m[V],valueSpec:b[Y]||b["*"],style:L,styleSpec:D,object:m,objectKey:V},m)):B.push(new a.a3(d,m[V],`unknown property "${V}"`))}for(const V in b){if(M[V])continue;const Y=b[V];Y.required&&Y.default===void 0&&m[V]===void 0&&B.push(new a.V(d,m,`missing required property "${V}"`))}return B}function ks({key:_,value:d}){const m=js({key:_,value:d});if(m.length)return m;const b=d;return b.indexOf("{fontstack}")===-1&&m.push(new a.V(_,d,'"glyphs" url must include a "{fontstack}" token')),b.indexOf("{range}")===-1&&m.push(new a.V(_,d,'"glyphs" url must include a "{range}" token')),m}function Ei(_,d=a.a6,m={}){return Zi({key:m.key||"",value:_,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:_,objectElementValidators:{glyphs:ks}})}function Ii(_,d=a.a6){return De(Ei(_,d))}const Oo=_=>De(xs(_)),ir=_=>De(mi(_)),xo=_=>De(La(_)),Tc=_=>De(da(_)),yo=_=>De(tl(_)),ss=_=>De(function(d){const m=d.value,b=d.style,M=d.styleSpec,L=M.snow;if(m===void 0)return[];if(!a.H(m))return[new a.V("snow",m,`object expected, ${a.K(m)} found`)];let D=[];for(const B in m){const V=B.match(/^(.*)-transition$/);D=D.concat(V&&L[V[1]]&&L[V[1]].transition?Ws({key:B,value:m[B],valueSpec:M.transition,style:b,styleSpec:M}):L[B]?Ws({key:B,value:m[B],valueSpec:L[B],style:b,styleSpec:M}):[new a.a3(B,m[B],`unknown property "${B}"`)])}return D}(_)),vo=_=>De(function(d){const m=d.value,b=d.style,M=d.styleSpec,L=M.rain;if(m===void 0)return[];if(!a.H(m))return[new a.V("rain",m,`object expected, ${a.K(m)} found`)];let D=[];for(const B in m){const V=B.match(/^(.*)-transition$/);D=D.concat(V&&L[V[1]]&&L[V[1]].transition?Ws({key:B,value:m[B],valueSpec:M.transition,style:b,styleSpec:M}):L[B]?Ws({key:B,value:m[B],valueSpec:L[B],style:b,styleSpec:M}):[new a.a3(B,m[B],`unknown property "${B}"`)])}return D}(_)),Bd=_=>De(zn(_)),_r=_=>De(rr(_)),Vn=_=>De(kn(_)),kt=_=>De(Jr(_)),we=_=>De(a.a7(_));function De(_){return _.slice().sort((d,m)=>d.line&&m.line?d.line-m.line:0)}function Ge(_,d){let m=!1;if(d&&d.length)for(const b of d)b instanceof a.a3?a.w(b.message):(_.fire(new a.y(new Error(b.message))),m=!0);return m}const _t=a.a6.light;let yt;class At extends a.E{constructor(d,m="flat"){super(),this._transitionable=new a.a8(yt||(yt=new a.a9({anchor:new a.aa(_t.anchor),position:new a.ab(_t.position),color:new a.aa(_t.color),intensity:new a.aa(_t.intensity)}))),this.setLight(d,m),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,m,b={}){this._validate(ir,d,b)||(this._transitionable.setTransitionOrValue(d),this.id=m)}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,b){return(!b||b.validate!==!1)&&Ge(this,d.call(Ii,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}const Bt=a.a6.terrain;let Lt=class extends a.E{constructor(_,d,m,b,M){super(),this.scope=m,this._transitionable=new a.a8(new a.a9({source:new a.aa(Bt.source),exaggeration:new a.aa(Bt.exaggeration)}),m,b),this._transitionable.setTransitionOrValue(_,b),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=M}get(){return this._transitionable.serialize()}set(_,d){this._transitionable.setTransitionOrValue(_,d)}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}getExaggeration(_){return this._transitioning.possiblyEvaluate(new a.ac(_,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const _=this._transitionable._values.exaggeration;if(!_)return null;const d=_.value.expression;if(!d)return null;let m=-1,b=-1,M=1;for(const L of d.zoomStops)M=d.evaluate(new a.ac(L,{worldview:this.worldview})),M>.01?(m=L,b=-1):b=L;return M<.01&&m>0&&b>m?[m,b]:null}isZoomDependent(){const _=this._transitionable._values.exaggeration;return _!=null&&_.value!=null&&_.value.expression!=null&&_.value.expression instanceof a.ad}};const Ut=45,gr=65,ar=.05;function Xr(_,d,m,b){const M=a.ah(Ut,gr,m),[L,D]=tn(_,b);let B=1-Math.min(1,Math.exp((d-L)/(D-L)*-6));return B*=B*B,B=Math.min(1,1.00747*B),B*M*_.alpha}function tn(_,d){const m=.5/Math.tan(.5*d);return[_.range[0]+m,_.range[1]+m]}function Vr(_,d,m,b,M){const L=a.af([],[d,m,b],M.mercatorFogMatrix);return Xr(_,a.ag(L),M.pitch,M._fov)}function ts(_,d,m,b,M,L,D){const B=[[m,b,0],[M,b,0],[M,L,0],[m,L,0]];let V=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const Q of B){const le=a.af([],Q,d),oe=a.ag(le);V=Math.min(V,oe),Y=Math.max(Y,oe)}return[Xr(_,V,D.pitch,D._fov),Xr(_,Y,D.pitch,D._fov)]}const Xn=a.a6.fog;class Qn extends a.E{constructor(d,m,b,M){super();const L=new a.a9({range:new a.aa(Xn.range),color:new a.aa(Xn.color),"color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new a.aa(Xn["high-color"]),"high-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new a.aa(Xn["space-color"]),"space-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new a.aa(Xn["horizon-blend"]),"star-intensity":new a.aa(Xn["star-intensity"]),"vertical-range":new a.aa(Xn["vertical-range"])});this._transitionable=new a.a8(L,b,new Map(M)),this.set(d,M),this._transitioning=this._transitionable.untransitioned(),this._transform=m,this.properties=new a.ai(L),this.scope=b}get state(){const d=this._transform,m=d.projection.name==="globe",b=a.aj(d.zoom),M=this.properties.get("range"),L=[.5,3];return{range:m?[a.ak(L[0],M[0],b),a.ak(L[1],M[1],b)]:M,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,m,b={}){if(this._validate(yo,d,b))return;const M=Object.assign({},d);for(const L of Object.keys(Xn))M[L]===void 0&&(M[L]=Xn[L].default);this._options=M,this._transitionable.setTransitionOrValue(this._options,m)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const m=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.ah(Ut,gr,d))*m.a}getOpacityAtLatLng(d,m){return this._transform.projection.supportsFog?function(b,M,L){const D=a.ae.fromLngLat(M),B=L.elevation?L.elevation.getAtPointOrZero(D):0;return Vr(b,D.x,D.y,B,L)}(this.state,d,m):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const m=this._transform.calculateFogTileMatrix(d.toUnwrapped());return ts(this.state,m,0,0,a.al,a.al,this._transform)}getOpacityForBounds(d,m,b,M,L){return this._transform.projection.supportsFog?ts(this.state,d,m,b,M,L,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?tn(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const m=[4,5,6,7];for(const b of m){const M=d.points[b];let L;if(M[2]>=0)L=M;else{const D=d.points[b-4];L=a.am(D,M,D[2]/(D[2]-M[2]))}if(Vr(this.state,L[0],L[1],0,this._transform)>=ar)return!0}return!1}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,b){return(!b||b.validate!==!1)&&Ge(this,d.call(Ii,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}let Fs,Ta,Ka,Oa,ho=class extends a.E{constructor(_,d,m,b){super();const M=Fs||(Fs=new a.a9({density:new a.aa(a.a6.snow.density),intensity:new a.aa(a.a6.snow.intensity),color:new a.aa(a.a6.snow.color),opacity:new a.aa(a.a6.snow.opacity),vignette:new a.aa(a.a6.snow.vignette),"vignette-color":new a.aa(a.a6.snow["vignette-color"]),"center-thinning":new a.aa(a.a6.snow["center-thinning"]),direction:new a.aa(a.a6.snow.direction),"flake-size":new a.aa(a.a6.snow["flake-size"])}));this._transitionable=new a.a8(M,m,new Map(b)),this.set(_,b),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=m}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),b=a.an(m[0]),M=-Math.max(a.an(m[1]),.01),L=[Math.cos(b)*Math.cos(M),Math.sin(b)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette"),B=this.properties.get("vignette-color");return B.a=D,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:L,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:B}}get(){return this._transitionable.serialize()}set(_,d,m={}){if(this._validate(ss,_,m))return;const b=Object.assign({},_),M=a.a6.snow;for(const L of Object.keys(M))b[L]===void 0&&(b[L]=M[L].default);this._options=b,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,m){return(!m||m.validate!==!1)&&Ge(this,_.call(Ii,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}},wa=class extends a.E{constructor(_,d,m,b){super();const M=Ta||(Ta=new a.a9({density:new a.aa(a.a6.rain.density),intensity:new a.aa(a.a6.rain.intensity),color:new a.aa(a.a6.rain.color),opacity:new a.aa(a.a6.rain.opacity),vignette:new a.aa(a.a6.rain.vignette),"vignette-color":new a.aa(a.a6.rain["vignette-color"]),"center-thinning":new a.aa(a.a6.rain["center-thinning"]),direction:new a.aa(a.a6.rain.direction),"droplet-size":new a.aa(a.a6.rain["droplet-size"]),"distortion-strength":new a.aa(a.a6.rain["distortion-strength"])}));this._transitionable=new a.a8(M,m,new Map(b)),this.set(_,b),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=m}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),b=a.an(m[0]),M=-Math.max(a.an(m[1]),.01),L=[Math.cos(b)*Math.cos(M),Math.sin(b)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette-color");return D.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:L,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:D}}get(){return this._transitionable.serialize()}set(_,d,m={}){if(this._validate(vo,_,m))return;const b=Object.assign({},_),M=a.a6.rain;for(const L of Object.keys(M))b[L]===void 0&&(b[L]=M[L].default);this._options=b,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,m){return(!m||m.validate!==!1)&&Ge(this,_.call(Ii,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}};class Gs extends a.E{constructor(d,m,b,M){super(),this.scope=b,this._options=d,this.properties=new a.ai(m),this._transitionable=new a.a8(m,b,new Map(M)),this._transitionable.setTransitionOrValue(d.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(d){this._transitionable.setTransitionOrValue(this._options.properties,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(d,m){this._options=d,this._transitionable.setTransitionOrValue(d.properties,m)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ma{constructor(d,m,b){this.screenBounds=d,this.cameraPoint=b.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=m,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,b)}static createFromScreenPoints(d,m){let b,M;if(d instanceof a.P||typeof d[0]=="number"){const L=a.P.convert(d);b=[L],M=m.isPointAboveHorizon(L)}else{const L=a.P.convert(d[0]),D=a.P.convert(d[1]),B=L.add(D)._div(2);b=[L,D],M=a.aq(L,D).every(V=>m.isPointAboveHorizon(V))&&m.isPointAboveHorizon(B)}return new ma(b,M,m)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return a.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const m=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(m,b,0,!1);return this.cameraPoint.y>b.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x=b.x?M[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(M[3]=this.cameraPoint)),a.ar(M,d)}bufferedCameraGeometryGlobe(d){const m=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(m,b,d),L=this.cameraPoint.clone();switch(3*((L.y>m.y)+(L.y>b.y))+((L.x>m.x)+(L.x>b.x))){case 0:M[0]=L,M[4]=L.clone();break;case 1:M.splice(1,0,L);break;case 2:M[1]=L;break;case 3:M.splice(4,0,L);break;case 5:M.splice(2,0,L);break;case 6:M[3]=L;break;case 7:M.splice(3,0,L);break;case 8:M[2]=L}return M}containsTile(d,m,b,M=0){const L=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/m._pixelsPerMercatorPixel+1,D=b?this._bufferedCameraMercator(L,m):this._bufferedScreenMercator(L,m);let B=d.tileID.wrap+(D.unwrapped?M:0);const V=D.polygon.map(Le=>a.as(d.tileTransform,Le,B));if(!a.at(V,0,0,a.al,a.al))return;B=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?M:0);const Y=this.screenGeometryMercator.polygon.map(Le=>a.au(d.tileTransform,Le,B)),Q=Y.map(Le=>new a.P(Le[0],Le[1])),le=m.getFreeCameraOptions().position||new a.ae(0,0,0),oe=a.au(d.tileTransform,le,B),ce=Y.map(Le=>{const Pe=a.av(Le,Le,oe);return a.aw(Pe,Pe),new a.ax(oe,Pe)}),je=a.ay(d,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:Q,tilespaceRays:ce,bufferedTilespaceGeometry:V,bufferedTilespaceBounds:(ve=a.az(V),ve.min.x=a.aA(ve.min.x,0,a.al),ve.min.y=a.aA(ve.min.y,0,a.al),ve.max.x=a.aA(ve.max.x,0,a.al),ve.max.y=a.aA(ve.max.y,0,a.al),ve),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:je};var ve}_bufferedScreenMercator(d,m){const b=Ba(d);if(this._screenRaycastCache[b])return this._screenRaycastCache[b];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),m):{polygon:this.bufferedScreenGeometry(d).map(L=>m.pointCoordinate3D(L)),unwrapped:!0},this._screenRaycastCache[b]=M,M}}_bufferedCameraMercator(d,m){const b=Ba(d);if(this._cameraRaycastCache[b])return this._cameraRaycastCache[b];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),m):{polygon:this.bufferedCameraGeometry(d).map(L=>m.pointCoordinate3D(L)),unwrapped:!0},this._cameraRaycastCache[b]=M,M}}_projectAndResample(d,m){const b=function(L,D){const B=a.aB([],D.pixelMatrix,D.globeMatrix),V=[0,-a.aD,0,1],Y=[0,a.aD,0,1],Q=[0,0,0,1];a.aC(V,V,B),a.aC(Y,Y,B),a.aC(Q,Q,B);const le=new a.P(V[0]/V[3],V[1]/V[3]),oe=new a.P(Y[0]/Y[3],Y[1]/Y[3]),ce=a.aE(L,le)&&V[3]1?zi(L.slice(0,Le),D):[],Ze=Lenew a.P(Cs(ft.x),ft.y)),Ze=Ze.map(ft=>new a.P(Cs(ft.x),ft.y));const qe=[...$e];qe.length===0&&qe.push(Ze[Ze.length-1]);const xt=a.ak(qe[qe.length-1].y,(Ze.length===0?$e[0]:Ze[0]).y,Pe);let lt;return lt=ce?[new a.P(0,xt),new a.P(0,0),new a.P(1,0),new a.P(1,xt)]:[new a.P(1,xt),new a.P(1,1),new a.P(0,1),new a.P(0,xt)],qe.push(...lt),Ze.length===0?qe.push($e[0]):qe.push(...Ze),{polygon:qe.map(ft=>new a.ae(ft.x,ft.y)),unwrapped:!1}}(d,m);if(b)return b;const M=function(L,D){let B=!1,V=-1/0,Y=0;for(let le=0;leV&&(V=L[le].x,Y=le);for(let le=0;le.5&&(ce.x{le.x-=1}),{polygon:L,unwrapped:B}}(zi(d,m).map(L=>new a.P(Cs(L.x),L.y)),m);return{polygon:M.polygon.map(L=>new a.ae(L.x,L.y)),unwrapped:M.unwrapped}}}function zi(_,d){return a.aG(_,m=>{const b=d.pointCoordinate3D(m);m.x=b.x,m.y=b.y},1/256)}function Cs(_){return _<0?1+_%1:_%1}function Ba(_){return 100*_|0}function Nl(_,d,m,b,M){const L=function(B,V){if(B)return M(B);if(V){if(_.url&&V.tiles&&_.tiles&&delete _.tiles,V.variants){if(!Array.isArray(V.variants))return M(new Error("variants must be an array"));for(const Q of V.variants){if(Q==null||typeof Q!="object"||Q.constructor!==Object)return M(new Error("variant must be an object"));if(!Array.isArray(Q.capabilities))return M(new Error("capabilities must be an array"));if(Q.capabilities.length===1&&Q.capabilities[0]==="meshopt"){V=Object.assign(V,Q);break}}}const Y=a.aH(Object.assign({},V,_),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);Y.tiles=d.canonicalizeTileset(Y,_.url),M(null,Y)}},D=function(B,V,Y){if(!B)return null;if(!V&&!Y)return B;Y=Y||B.worldview_default;const Q=Object.values(B.language||{});if(Q.length===0)return null;const le=Object.values(B.worldview||{});if(le.length===0)return null;const oe=Q.every(je=>je===V),ce=le.every(je=>je===Y);return oe&&ce?B:V in(B.language_options||{})||Y in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(_.data,m,b);return D?a.o.frame(()=>L(null,D)):_.url?a.m(d.transformRequest(d.normalizeSourceURL(_.url,null,m,b),a.R.Source),L):a.o.frame(()=>{const{data:B,...V}=_;L(null,V)})}function Rl(_,d){const m=Math.pow(2,d.z),b=Math.floor(a.aF(_.getWest())*m),M=Math.floor(a.aJ(_.getNorth())*m),L=Math.ceil(a.aF(_.getEast())*m),D=Math.ceil(a.aJ(_.getSouth())*m);return d.x>=b&&d.x=M&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,M)m&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${m}`),b&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${b}`),this.fire(new a.y(M));else if(L){if(Object.assign(this,L),this.hasWorldviews=!!L.worldview_options,L.worldview_default&&(this.worldviewDefault=L.worldview_default),L.vector_layers){this.vectorLayers=L.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const D of L.vector_layers)this.vectorLayerIds.push(D.id),L.worldview&&L.worldview[D.source]&&this.localizableLayerIds.add(D.id)}this.tileBounds=Ac.fromTileJSON(L),ae(L.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}d&&d(M)})}loaded(){return this._loaded}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(d,m){const b=d.tileID.canonical.url(this.tiles,this.scheme),M=this.map._requestManager.normalizeTileURL(b),L=this.map._requestManager.transformRequest(M,a.R.Tile),D=this.map.style?this.map.style.getLut(this.scope):null,B=D?{image:D.image.clone()}:null,V={request:L,data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,lut:B,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:d.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:d.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&a.h(b)&&(V.localizableLayerIds=this.localizableLayerIds),V.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=m:d.request=d.actor.send("reloadTile",V,Y.bind(this));else if(d.actor=this._tileWorkers[M]=this._tileWorkers[M]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",V,Y.bind(this),void 0,!0);else{const Q=a.aL.call({deduped:this._deduped},V,(le,oe)=>{if(le||!oe)Y.call(this,le);else{const ce=a.aM(oe.responseHeaders);V.data={rawData:oe.rawData.slice(0),expires:ce.expires,cacheControl:ce.cacheControl},d.actor&&d.actor.send("loadTile",V,Y.bind(this),void 0,!0)}},!0);d.request={cancel:Q}}function Y(Q,le){return delete d.request,d.aborted?m(null):Q&&Q instanceof a.aN&&Q.status!==404?m(Q):(le&&le.resourceTiming&&(d.resourceTiming=le.resourceTiming),this.map._refreshExpiredTiles&&le&&d.setExpiryData(le),d.loadVectorData(le,this.map.painter),a.aO(this.dispatcher),m(null,le),void(d.reloadCallback&&(this.loadTile(d,d.reloadCallback),d.reloadCallback=null)))}}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){d.actor&&d.actor.send("removeTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope}),d.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class nl extends a.E{constructor(d,m,b,M){super(),this.id=d,this.dispatcher=b,this.setEventedParent(M),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},m),Object.assign(this,a.aH(m,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const m=this.map.getWorldview();this._tileJSONRequest=Nl(this._options,this.map._requestManager,null,m,(b,M)=>{this._tileJSONRequest=null,this._loaded=!0,b?this.fire(new a.y(b)):M&&(Object.assign(this,M),M.raster_layers&&(this.rasterLayers=M.raster_layers,this.rasterLayerIds=this.rasterLayers.map(L=>L.id)),this.tileBounds=Ac.fromTileJSON(M),ae(M.tiles),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(b)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}loadTile(d,m){const b=a.o.devicePixelRatio>=2,M=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),b,this.tileSize);d.request=a.n(this.map._requestManager.transformRequest(M,a.R.Tile),(L,D,B)=>{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(L)return d.state="errored",m(L);if(!D)return m(null);const V=a.aM(B);this.map._refreshExpiredTiles&&d.setExpiryData(V),d.setTexture(D,this.map.painter),d.state="loaded",a.aO(this.dispatcher),m(null)})}abortTile(d,m){d.request&&(d.request.cancel(),delete d.request),m&&m()}unloadTile(d,m){d.texture&&d.texture instanceof a.T?(d.destroy(!1),d.texture&&d.texture instanceof a.T&&this.map.painter.saveTileTexture(d.texture)):d.destroy(),m&&m()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function yd([_,d],m,b,{scaled:M=!0}={}){const{tileSize:L,buffer:D}=b,{x:B,y:V,z:Y}=m;if(!isFinite(B)||!isFinite(V)||!isFinite(Y))throw new Error("Invalid MRT header");const Q=2**Y,le=Q*a.aF(_),oe=Q*a.aJ(d);return function([ce,je],ve,{scaled:Le=!0}={}){if(!ve)throw new Error("bandView is undefined");const{data:Pe,tileSize:$e,buffer:Ze,offset:qe,scale:xt,dimension:lt}=ve;if(ce<-Ze||ce>$e+Ze||je<-Ze||je>$e+Ze)throw new Error(`Point (${ce}, ${je}) out of bounds for tileSize=${$e}, buffer=${Ze}`);const ft=(je+Ze)*($e+2*Ze)+(ce+Ze);if(new Uint32Array(Pe.buffer)[ft]===4294967295)return null;let ot=[];ot=Le?[]:new ve.data.constructor(lt);for(let st=0;st{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(B)return B.name==="AbortError"?void 0:(d.state="errored",m(B));if(this.map._refreshExpiredTiles&&V){const Q=a.aM(Y);d.setExpiryData(Q)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!V)return m(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=V}m(null)};d.request=this.partial?d.fetchHeader(void 0,D.bind(this)):d.actor.send("loadTile",L,D.bind(this),void 0,!0)}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){const b=d.texturePerLayer;if(d.flushAllQueues(),b.size){d.destroy(!1);for(const M of b.values())this.map.painter.saveTileTexture(M)}else d.destroy()}prepareTile(d,m,b,M){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(m,b,M,(L,D)=>{if(L)return d.state="errored",this.fire(new a.y(L)),void this.triggerRepaint(d);D&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(b,D,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const m=this.rasterLayers.find(({id:L})=>L===d),b=m&&m.fields,M=b&&b.bands&&b.bands;return M?M[0]:0}getTextureDescriptor(d,m,b){if(!d)return;const M=m.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!M)return;let L=null;m instanceof a.aR?L=m.paint.get("raster-array-band"):m instanceof a.aS&&(L=m.paint.get("raster-particle-array-band"));const D=L||this.getInitialBand(M);if(D==null)return;if(!d.textureDescriptorPerLayer.get(m.id))return void this.prepareTile(d,M,m.id,D);if(d.updateNeeded(m.id,D)&&!b)return;const B=d.textureDescriptorPerLayer.get(m.id);return Object.assign({},B,{texture:d.texturePerLayer.get(m.id)})}getImages(d,m){const b=new Map;for(const M of d)for(const L of m){const[D,B]=L.split("/"),V=M.getLayer(D);if(!V||!V.hasBand(B)||!V.hasDataForBand(B))continue;const{bytes:Y,tileSize:Q,buffer:le}=V.getBandView(B),oe=Q+2*le,ce={data:new a.q({width:oe,height:oe},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};b.set(L,ce)}return b}queryRasterArrayValueByBandId(d,m,b){const M=m._mrt;return new Promise(L=>{const D={},B=new Set;for(const[V,Y]of Object.entries(M.layers)){if(b.layerName&&V!==b.layerName)continue;const Q={};D[V]=Q;for(const{bands:le}of Y.dataIndex)for(const oe of le)b.bands&&!b.bands.includes(oe)||(B.add(a.B(V,oe)),m.fetchBand(V,null,oe,ce=>{a.o.frame(()=>{Q[oe]=ce?null:yd([d.lng,d.lat],M,Y.getBandView(oe)),B.delete(a.B(V,oe)),B.size===0&&L(D)})},!1))}B.size===0&&L(D)})}_loadTileForQuery(d,m){if(this._loadTileLoaded[d.uid])return void m(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(m);this._loadTilePending[d.uid]=[m];const b=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),M=this.map._requestManager.transformRequest(b,a.R.Tile);d.actor.send("loadTile",{request:M,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(L,D,B)=>{if(L)return this._loadTilePending[d.uid].forEach(V=>V(L,null)),void delete this._loadTilePending[d.uid];if(!D)return this._loadTilePending[d.uid].forEach(V=>V(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&D){const V=a.aM(B);d.setExpiryData(V)}d._mrt=D,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(V=>V(null,D)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,m,b){return new Promise((M,L)=>{this._loadTileForQuery(m,(D,B)=>{D?L(D):M(B?this.queryRasterArrayValueByBandId(d,m,b):null)})})}queryRasterArrayValue(d,m){const b=a.aT.convert(d),M=this.findLoadedParent(b);return M&&M._mrt?m.bands||!this.partial?this.queryRasterArrayValueByBandId(b,M,m):this.queryRasterArrayValueByAllBands(b,M,m):Promise.resolve(null)}findLoadedParent(d){const m=a.ae.fromLngLat(d,this.map.transform.tileSize),b=this.maxzoom+1,M=1<0&&(B[new a.aQ(_.overscaledZ,M,d.z,b,d.y-1).key]={backfilled:!1},B[new a.aQ(_.overscaledZ,_.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},B[new a.aQ(_.overscaledZ,D,d.z,L,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,b)this.fire(new a.y(b));else{const L={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&M&&M.resourceTiming&&M.resourceTiming[this.id]&&(L.resourceTiming=M.resourceTiming[this.id]),_&&(this._partialReload=!0),this.fire(new a.z("data",L)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(_),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_),this._updateWorkerData()}loadTile(_,d){const m=_.actor?"reloadTile":"loadTile";_.actor=this.actor;const b=this.map.style?this.map.style.getLut(this.scope):null,M=b?{image:b.image.clone()}:null,L=this._partialReload,D={type:this.type,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:M,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:_.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:L,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};_.request=this.actor.send(m,D,(B,V)=>L&&!V?(_.state="loaded",d(null)):(delete _.request,_.destroy(!1),_.aborted?d(null):B?d(B):(_.loadVectorData(V,this.map.painter,m==="reloadTile"),d(null))),void 0,m==="loadTile")}abortTile(_){_.request&&(_.request.cancel(),delete _.request),_.aborted=!0}unloadTile(_,d){this.actor.send("removeTile",{uid:_.uid,type:this.type,source:this.id,scope:this.scope}),_.destroy()}onRemove(_){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends a.aU{constructor(_,d,m,b){super(_,d,m,b),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const _=this.options;this.urls=[];for(const d of _.urls)this.urls.push(this.map._requestManager.transformRequest(d,a.R.Source).url);a.aV(this.urls,(d,m)=>{this._loaded=!0,d?this.fire(new a.y(d)):m&&(this.video=m,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(_){if(this.video){const d=this.video.seekable;_d.end(0)?this.fire(new a.y(new a.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=_}}getVideo(){return this.video}onAdd(_){this.map||(this.map=_,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const _=this.map.painter.context,d=_.gl;this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(_,this.video,d.RGBA8),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(_)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:a.aU,model:a.aX,"batched-model":class extends a.E{constructor(_,d,m,b){super(),this.type="batched-model",this.id=_,this.tileSize=512,this._options=d,this.tiles=this._options.tiles,this.maxzoom=d.maxzoom||19,this.minzoom=d.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=m,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(b)}onAdd(_){this.map=_,this.load()}reload(){this.cancelTileJSONRequest();const _=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(_))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(_){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const d=Array.isArray(this.map._language)?this.map._language.join():this.map._language,m=this.map.getWorldview();this._tileJSONRequest=Nl(this._options,this.map._requestManager,d,m,(b,M)=>{this._tileJSONRequest=null,this._loaded=!0,b?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),m&&m.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${m}`),this.fire(new a.y(b))):M&&(Object.assign(this,M),M.bounds&&(this.tileBounds=new Ac(M.bounds,this.minzoom,this.maxzoom)),ae(M.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),_&&_(b)})}hasTransition(){return!1}hasTile(_){return!this.tileBounds||this.tileBounds.contains(_.canonical)}loaded(){return this._loaded}loadTile(_,d){const m=this.map._requestManager.normalizeTileURL(_.tileID.canonical.url(this.tiles,this.scheme)),b={request:this.map._requestManager.transformRequest(m,a.R.Tile),data:void 0,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,tileSize:this.tileSize*_.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:_.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:a.o.devicePixelRatio,promoteId:this.promoteId};if(_.actor&&_.state!=="expired")if(_.state==="loading")_.reloadCallback=d;else{if(_.buckets){const L=Object.values(_.buckets);for(const D of L)D.dirty=!0;return void(_.state="loaded")}_.request=_.actor.send("reloadTile",b,M.bind(this))}else _.actor=this.dispatcher.getActor(),_.request=_.actor.send("loadTile",b,M.bind(this),void 0,!0);function M(L,D){return _.aborted?d(null):L&&L.status!==404?d(L):(this.map._refreshExpiredTiles&&D&&_.setExpiryData(D),_.loadModelData(D,this.map.painter),_.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends a.aU{constructor(_,d,m,b){super(_,d,m,b),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(L=>typeof L!="number"))||this.fire(new a.y(new a.V(`sources.${_}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new a.y(new a.V(`sources.${_}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new a.y(new a.V(`sources.${_}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(_){this.map=_,this.load(),this.canvas&&this.animate&&this.play()}onRemove(_){this.pause()}prepare(){let _=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,_=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,_=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!_&&!this._playing||this.texture instanceof a.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(d,this.canvas,d.gl.RGBA8,{premultiply:!0}),this._prepareData(d)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const _ of[this.canvas.width,this.canvas.height])if(isNaN(_)||_<=0)return!0;return!1}},custom:class extends a.E{constructor(_,d,m,b){super(),this.id=_,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=d,this.setEventedParent(b),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Ac(this._implementation.bounds,this.minzoom,this.maxzoom)),d.update=this._update.bind(this),d.clearTiles=this._clearTiles.bind(this),d.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,a.aH(d,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return a.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(_){this.map=_,this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(_),this.load()}onRemove(_){this._implementation.onRemove&&this._implementation.onRemove(_)}hasTile(_){if(this._implementation.hasTile){const{x:d,y:m,z:b}=_.canonical;return this._implementation.hasTile({x:d,y:m,z:b})}return!this.tileBounds||this.tileBounds.contains(_.canonical)}loadTile(_,d){const{x:m,y:b,z:M}=_.tileID.canonical,L=new AbortController;_.request=Promise.resolve(this._implementation.loadTile({x:m,y:b,z:M},{signal:L.signal})).then((function(D){return delete _.request,_.aborted?(_.state="unloaded",d(null)):D===void 0?(_.state="errored",d(null)):D===null?(this.loadTileData(_,{width:this.tileSize,height:this.tileSize,data:null}),_.state="loaded",d(null)):function(B){return B instanceof ImageData||B instanceof HTMLCanvasElement||B instanceof ImageBitmap||B instanceof HTMLImageElement}(D)?(this.loadTileData(_,D),_.state="loaded",void d(null)):(_.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(D=>{D.name!=="AbortError"&&(_.state="errored",d(D))}),_.request.cancel=()=>L.abort()}loadTileData(_,d){_.setTexture(d,this.map.painter)}unloadTile(_,d){if(_.texture&&_.texture instanceof a.T?(_.destroy(!1),_.texture&&_.texture instanceof a.T&&this.map.painter.saveTileTexture(_.texture)):_.destroy(),this._implementation.unloadTile){const{x:m,y:b,z:M}=_.tileID.canonical;this._implementation.unloadTile({x:m,y:b,z:M})}d&&d()}abortTile(_,d){_.request&&_.request.cancel&&(_.request.cancel(),delete _.request),d&&d()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(_=>({x:_.canonical.x,y:_.canonical.y,z:_.canonical.z}))}_clearTiles(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_)}_update(){this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}}},zo=function(_,d,m,b){const M=new iu[d.type](_,d,m,b);if(M.id!==_)throw new Error(`Expected Source id to be ${_} instead of ${M.id}`);return a.aY(["load","abort","unload","serialize","prepare"],M),M};function df(_,d,m=""){return`${m}:${d.id||""}:${d.layer.id}:${function(b){if("layerId"in b)return`layer:${b.layerId}`;{const{featuresetId:M,importId:L}=b;return`featureset:${M}${L?`:import:${L}`:""}`}}(_.target)}`}function Uu(_,d,m,b=""){if(_.uniqueFeatureID){const M=df(_,d,b);if(m.has(M))return!0;m.add(M)}return!1}function Jl(_,d,m,b,M=!1){const L=d.sourceCache.transform,D=d.sourceCache.tilesIn(_,d.has3DLayers,M);D.sort(Kc);const B=[];for(const V of D){const Y=V.tile.queryRenderedFeatures(d,V,m,b,L,M);Object.keys(Y).length&&B.push({wrappedTileID:V.tile.tileID.wrapped().key,queryResults:Y})}for(const V in d.layers){const Y=d.layers[V];if(Y.styleLayer){const Q=Y.styleLayer.queryRenderedFeatures(_,d.sourceCache,b);Object.keys(Q).length&&B.push({wrappedTileID:0,queryResults:Q})}}return B.length===0?{}:function(V){const Y={},Q={};for(const le of V){const oe=le.queryResults,ce=le.wrappedTileID,je=Q[ce]=Q[ce]||{};for(const ve in oe){const Le=oe[ve],Pe=je[ve]=je[ve]||{},$e=Y[ve]=Y[ve]||[];for(const Ze of Le)Pe[Ze.featureIndex]||(Pe[Ze.featureIndex]=!0,$e.push(Ze))}}return Y}(B)}function up(_,d,m,b,M,L){const D={},B=b.queryRenderedSymbols(_),V=[];for(const Y of Object.keys(B).map(Number))V.push(M[Y]);V.sort(Kc);for(const Y of V){const Q=Y.featureIndex.lookupSymbolFeatures(B[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,m,L);for(const le in Q){const oe=D[le]=D[le]||[],ce=Q[le];ce.sort((je,ve)=>{const Le=Y.featureSortOrder;if(Le){const Pe=Le.indexOf(je.featureIndex);return Le.indexOf(ve.featureIndex)-Pe}return ve.featureIndex-je.featureIndex});for(const je of ce)oe.push(je)}}return D}function Am(_,d){const m=_.getRenderableIds().map(L=>_.getTileByID(L)),b=[],M={};for(let L=0;Ld.getLayer(L)).filter(Boolean);if(M.length!==0){b.layers=M,b.stateDependentLayerIds&&(b.stateDependentLayers=b.stateDependentLayerIds.map(L=>M.filter(D=>D.id===L)[0]));for(const L of M)m[L.fqid]=b}}return m}const Ec=32,Zc=33,vd=new Uint16Array(8184);for(let _=0;_<2046;_++){let d=_+2,m=0,b=0,M=0,L=0,D=0,B=0;for(1&d?M=L=D=Ec:m=b=B=Ec;(d>>=1)>1;){const Y=m+M>>1,Q=b+L>>1;1&d?(M=m,L=b,m=D,b=B):(m=M,b=L,M=D,L=B),D=Y,B=Q}const V=4*_;vd[V+0]=m,vd[V+1]=b,vd[V+2]=M,vd[V+3]=L}const $d=new Uint16Array(2178),au=new Uint8Array(1089),Vu=new Uint16Array(1089);function hp(_){return _===0?-.03125:_===32?.03125:0}const vy={type:2,extent:a.al,loadGeometry:()=>[[new a.P(0,0),new a.P(a.al+1,0),new a.P(a.al+1,a.al+1),new a.P(0,a.al+1),new a.P(0,0)]]};class fp{constructor(d,m,b,M,L,D){this.tileID=d,this.uid=a.b2(),this.uses=0,this.tileSize=m,this.tileZoom=b,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=L,M&&M.style&&(this._lastUpdatedBrightness=M.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",M&&M.transform&&(this.projection=M.transform.projection),this.worldview=D,this._hasAppearances=null}registerFadeDuration(d){const m=d+this.timeAdded;mb)M=!1;else if(m)if(this.expirationTimeb.appearances&&b.appearances.length>0))return!0;return!1}updateBuckets(d,m){if(!this.latestFeatureIndex||!d.style)return;const b=d.style.listImages(),M=d.style.getBrightness();for(const L in this.buckets){if(!d.style.hasLayer(L))continue;const D=this.buckets[L],B=D.layers[0],V=B.sourceLayer||"_geojsonTileLayer",Y=d.style.getLayerSourceCache(B);let Q={};Y&&(Q=Y._state.getState(V,void 0));const le=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},oe=Object.keys(Q).length>0&&!m;D.hasAppearances=D.layers.some(ve=>ve.appearances&&ve.appearances.length>0);const ce=oe?D.stateDependentLayers:D.layers;if(oe&&D.stateDependentLayers.length!==0||m){const ve=this.latestFeatureIndex.loadVTLayers();D.update(Q,ve[V],b,le,ce,m,M)}if(oe&&D.stateDependentLayers.length!==0||m||D.hasAppearances){const ve={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};D.updateAppearances(this.tileID.canonical,Q,b,ve)}(D instanceof a.ba||D instanceof a.bb)&&d._terrain&&d._terrain.enabled&&Y&&D.uploadPending()&&d._terrain._clearRenderCacheForTile(Y.id,this.tileID);const je=d&&d.style&&d.style.getOwnLayer(L);je&&(this.queryPadding=Math.max(this.queryPadding,je.queryRadius(D)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Le--){const Pe=4*Le,$e=vd[Pe+0],Ze=vd[Pe+1],qe=vd[Pe+2],xt=vd[Pe+3],lt=$e+qe>>1,ft=Ze+xt>>1,ot=lt+ft-Ze,st=ft+$e-lt,bt=Ze*Zc+$e,Ot=xt*Zc+qe,Pt=ft*Zc+lt,Vt=Math.hypot(($d[2*bt+0]+$d[2*Ot+0])/2-$d[2*Pt+0],($d[2*bt+1]+$d[2*Ot+1])/2-$d[2*Pt+1])>=16;au[Pt]=au[Pt]||(Vt?1:0),Le<1022&&(au[Pt]=au[Pt]||au[(Ze+st>>1)*Zc+($e+ot>>1)]||au[(xt+st>>1)*Zc+(qe+ot>>1)])}const le=new a.b1,oe=new a.b0;let ce=0;function je(Le,Pe){const $e=Pe*Zc+Le;return Vu[$e]===0&&(le.emplaceBack($d[2*$e+0],$d[2*$e+1],Le*a.al/Ec,Pe*a.al/Ec),Vu[$e]=++ce),Vu[$e]-1}function ve(Le,Pe,$e,Ze,qe,xt){const lt=Le+$e>>1,ft=Pe+Ze>>1;if(Math.abs(Le-qe)+Math.abs(Pe-xt)>1&&au[ft*Zc+lt])ve(qe,xt,Le,Pe,lt,ft),ve($e,Ze,qe,xt,lt,ft);else{const ot=je(Le,Pe),st=je($e,Ze),bt=je(qe,xt);oe.emplaceBack(ot,st,bt)}}return ve(0,0,Ec,Ec,Ec,0),ve(Ec,Ec,0,0,0,Ec),{vertices:le,indices:oe}}(this.tileID.canonical,m);M=D.vertices,L=D.indices}else{M=new a.b1,L=new a.b0;for(const{x:B,y:V}of b)M.emplaceBack(B,V,0,0);const D=a.bh(M.int16.subarray(0,4*M.length),void 0,4);for(let B=0;B0&&(V=a.bl(new Float64Array(16),m.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,M,m,D,V,B),this._makeGlobeTileDebugTextBuffer(d,M,m,D,V,B)}_globePoint(d,m,b,M,L,D,B){let V=a.bm(d,m,b);if(D){const Y=1<.5?ce=-1:oe<-.5&&(ce=1);let je=(d/a.al+b.x)/Y+ce,ve=(m/a.al+b.y)/Y;je=(je-Q)*M._pixelsPerMercatorPixel+Q,ve=(ve-le)*M._pixelsPerMercatorPixel+le;const Le=[je*M.worldSize,ve*M.worldSize,0];a.af(Le,Le,D),V=a.bn(V,Le,B)}return a.af(V,V,L)}_makeGlobeTileDebugBorderBuffer(d,m,b,M,L,D){const B=new a.bd,V=new a.be,Y=new a.bo,Q=(oe,ce,je,ve,Le)=>{const Pe=(je-oe)/(Le-1),$e=(ve-ce)/(Le-1),Ze=B.length;for(let qe=0;qele*ce+je;for(let ce=0;ce{if(L)m(L);else try{const V=b.getHeaderLength(D);if(V>d)return void(this.request=this.fetchHeader(V,m));b.parseHeader(D),this._isHeaderLoaded=!0;let Y=0;for(const Q of Object.values(b.layers))Y=Math.max(Y,Q.dataIndex[Q.dataIndex.length-1].lastByte);D.byteLength>=Y&&(this.entireBuffer=D),m(null,this.entireBuffer||D,B)}catch(V){m(V)}}),this.request}fetchBandForRender(d,m,b,M){this.fetchBand(d,m,b,L=>{if(L)return void M(L);this.updateTextureDescriptor(d,m,b);const D=this.textureDescriptorPerLayer.get(m);M(null,D?D.img:null)})}fetchBand(d,m,b,M,L=!0){const D=this._mrt;if(!this._isHeaderLoaded||!D)return void M(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void M(new Error("Can't fetch tile band without an actor"));let V;const Y=a.B(String(b),a.B(this.tileID.key,d));let Q=this._taskQueue.get(Y);Q?Q.add(M):(Q=new Set,Q.add(M),this._taskQueue.set(Y,Q));const le=(ve,Le)=>{V.complete(ve,Le),ve?M(ve):(Q.forEach(Pe=>Pe(null,Le)),this._taskQueue.delete(Y))},oe=(ve,Le)=>{if(ve)return M(ve);const Pe=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Le,task:V},le,void 0,!0);if(m!==null){const $e=this._workQueuePerLayer.get(m)||[];$e.push(()=>{Pe&&Pe.cancel(),V.cancel()}),this._workQueuePerLayer.has(m)||this._workQueuePerLayer.set(m,$e)}};let ce;try{ce=D.getLayer(d)}catch(ve){if(this.state==="reloading")return;throw ve}if(!ce)return void M(new Error(`Unknown sourceLayer "${d}"`));if(ce.hasDataForBand(b))return Q.forEach(ve=>ve(null,null)),void this._taskQueue.delete(Y);const je=ce.getDataRange([b]);if(V=D.createDecodingTask(je),!V||V.tasks.length)if(m!==null&&this.flushQueues(m),this.entireBuffer)oe(null,this.entireBuffer.slice(je.firstByte,je.lastByte+1));else{const ve=Object.assign({},this.requestParams,{headers:{Range:`bytes=${je.firstByte}-${je.lastByte}`}}),Le=a.bu(ve,oe);if(m!==null){const Pe=this._fetchQueuePerLayer.get(m)||[];Pe.push(()=>{Le.cancel(),V.cancel()}),this._fetchQueuePerLayer.has(m)||this._fetchQueuePerLayer.set(m,Pe)}}}updateNeeded(d,m){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==m||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,m,b){if(!this._mrt)return;const M=this._mrt.getLayer(d);if(!M||!M.hasBand(b)||!M.hasDataForBand(b))return;const{bytes:L,tileSize:D,buffer:B,offset:V,scale:Y}=M.getBandView(b),Q=D+2*B,le=new a.q({width:Q,height:Q},L),oe=this.texturePerLayer.get(m);oe&&oe instanceof a.T&&oe.update(le,{premultiply:!1}),this.textureDescriptorPerLayer.set(m,{layer:d,band:b,img:le,buffer:B,offset:V,tileSize:D,format:M.pixelFormat,mix:[Y,256*Y,65536*Y,16777216*Y]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const m of this.texturePerLayer.values())m&&m instanceof a.T&&m.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class uk{constructor(d,m){this.max=d,this.onRemove=m,this.reset()}reset(){for(const d in this.data)for(const m of this.data[d])m.timeout&&clearTimeout(m.timeout),this.onRemove(m.value);return this.data={},this.order=[],this}add(d,m,b){const M=d.wrapped().key;this.data[M]===void 0&&(this.data[M]=[]);const L={value:m,timeout:void 0};if(b!==void 0&&(L.timeout=setTimeout(()=>{this.remove(d,L)},b)),this.data[M].push(L),this.order.push(M),this.order.length>this.max){const D=this._getAndRemoveByKey(this.order[0]);D&&this.onRemove(D)}return this}has(d){return d.wrapped().key in this.data}getAndRemove(d){return this.has(d)?this._getAndRemoveByKey(d.wrapped().key):null}_getAndRemoveByKey(d){const m=this.data[d].shift();return m.timeout&&clearTimeout(m.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),m.value}getByKey(d){const m=this.data[d];return m?m[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,m){if(!this.has(d))return this;const b=d.wrapped().key,M=m===void 0?0:this.data[b].indexOf(m),L=this.data[b][M];return this.data[b].splice(M,1),L.timeout&&clearTimeout(L.timeout),this.data[b].length===0&&delete this.data[b],this.onRemove(L.value),this.order.splice(this.order.indexOf(b),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}filter(d){const m=[];for(const b in this.data)for(const M of this.data[b])d(M.value)||m.push(M);for(const b of m)this.remove(b.value.tileID,b)}}class qg{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,m,b){const M=String(m);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][M]=this.stateChanges[d][M]||{},Object.assign(this.stateChanges[d][M],b),this.deletedStates[d]===null){this.deletedStates[d]={};for(const L in this.state[d])L!==M&&(this.deletedStates[d][L]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][M]===null){this.deletedStates[d][M]={};for(const L in this.state[d][M])b[L]||(this.deletedStates[d][M][L]=null)}else for(const L in b)this.deletedStates[d]&&this.deletedStates[d][M]&&this.deletedStates[d][M][L]===null&&delete this.deletedStates[d][M][L]}removeFeatureState(d,m,b){if(this.deletedStates[d]===null)return;const M=String(m);if(this.deletedStates[d]=this.deletedStates[d]||{},b&&m!==void 0)this.deletedStates[d][M]!==null&&(this.deletedStates[d][M]=this.deletedStates[d][M]||{},this.deletedStates[d][M][b]=null);else if(m!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][M])for(b in this.deletedStates[d][M]={},this.stateChanges[d][M])this.deletedStates[d][M][b]=null;else this.deletedStates[d][M]=null;else this.deletedStates[d]=null}getState(d,m){const b=this.state[d]||{},M=this.stateChanges[d]||{},L=this.deletedStates[d];if(L===null)return{};if(m!==void 0){const B=String(m),V=Object.assign({},b[B],M[B]);if(L){const Y=L[m];if(Y===null)return{};for(const Q in Y)delete V[Q]}return V}const D=Object.assign({},b,M);if(L)for(const B in L)delete D[B];return D}initializeTileState(d,m){d.refreshFeatureState(m)}coalesceChanges(d,m){const b={};for(const M in this.stateChanges){this.state[M]=this.state[M]||{};const L={};for(const D in this.stateChanges[M])this.state[M][D]||(this.state[M][D]={}),Object.assign(this.state[M][D],this.stateChanges[M][D]),L[D]=this.state[M][D];b[M]=L}for(const M in this.deletedStates){this.state[M]=this.state[M]||{};const L={};if(this.deletedStates[M]===null)for(const D in this.state[M])L[D]={},this.state[M][D]={};else for(const D in this.deletedStates[M]){if(this.deletedStates[M][D]===null)this.state[M][D]={};else if(this.state[M][D])for(const B of Object.keys(this.deletedStates[M][D]))delete this.state[M][D][B];L[D]=this.state[M][D]}b[M]=b[M]||{},Object.assign(b[M],L)}if(this.stateChanges={},this.deletedStates={},Object.keys(b).length!==0)for(const M in d)d[M].refreshFeatureState(m)}}class Yc extends a.E{constructor(d,m,b){super(),this.id=d,this._onlySymbols=b,m.on("data",M=>{M.dataType==="source"&&M.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&M.dataType==="source"&&M.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),m.on("error",()=>{this._sourceErrored=!0}),this._source=m,this._tiles={},this._cache=new uk(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=m.minTileCacheSize,this._maxTileCacheSize=m.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new qg,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(d){this.map=d,this._minTileCacheSize=this._minTileCacheSize===void 0&&d?d._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&d?d._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const d in this._tiles)if(!this._tiles[d].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const d=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,d&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(d,m){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,m)}_unloadTile(d){if(this._source.unloadTile)return this._source.unloadTile(d)}_abortTile(d){if(this._source.abortTile)return this._source.abortTile(d)}serialize(){return this._source.serialize()}prepare(d){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const m in this._tiles){const b=this._tiles[m];b.upload(d,this.map?this.map.painter:void 0),b.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(d=>d.tileID).sort(_y).map(d=>d.key)}getRenderableIds(d,m){const b=[];for(const M in this._tiles)this._isIdRenderable(+M,d,m)&&b.push(this._tiles[M]);return d?b.sort((M,L)=>{const D=M.tileID,B=L.tileID,V=new a.P(D.canonical.x,D.canonical.y)._rotate(this.transform.angle),Y=new a.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return D.overscaledZ-B.overscaledZ||Y.y-V.y||Y.x-V.x}).map(M=>M.tileID.key):b.map(M=>M.tileID).sort(_y).map(M=>M.key)}hasRenderableParent(d){const m=this.findLoadedParent(d,0);return!!m&&this._isIdRenderable(m.tileID.key)}_isIdRenderable(d,m,b){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(m||!this._tiles[d].holdingForFade())&&(b||!this._shadowCasterTiles[d])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const d in this._tiles)this._tiles[d].state!=="errored"&&this._reloadTile(+d,"reloading")}}_reloadTile(d,m){const b=this._tiles[d];b&&(b.state!=="loading"&&(b.state=m),this._loadTile(b,this._tileLoaded.bind(this,b,d,m)))}_tileLoaded(d,m,b,M,L){if(M){if(d.state="errored",M.status!==404)this._source.fire(new a.y(M,{tile:d}));else{if(this._source.fire(new a.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:d})),!(d.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const B=this.map.painter.terrain;this.update(this.transform,B.getScaledDemTileSize(),!0),B.resetTileLookupCache(this.id)}else this.update(this.transform)}return}d.timeAdded=a.o.now(),b==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(m,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let D=new Map;L&&L.responseHeaders&&(D=L.responseHeaders),this._source.fire(new a.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:D}))}_backfillDEM(d){const m=this.getRenderableIds();for(let M=0;M1||(Math.abs(D)>1&&(Math.abs(D+V)===1?D+=V:Math.abs(D-V)===1&&(D-=V)),L.dem&&M.dem&&(M.dem.backfillBorder(L.dem,D,B),M.neighboringTiles&&M.neighboringTiles[Y]&&(M.neighboringTiles[Y].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,m,b,M){for(const L in this._tiles){let D=this._tiles[L];if(M[L]||!D.hasData()||D.tileID.overscaledZ<=m||D.tileID.overscaledZ>b)continue;let B=D.tileID;for(;D&&D.tileID.overscaledZ>m+1;){const Y=D.tileID.scaledTo(D.tileID.overscaledZ-1);D=this._tiles[Y.key],D&&D.hasData()&&(B=Y)}let V=B;for(;V.overscaledZ>m;)if(V=V.scaledTo(V.overscaledZ-1),d[V.key]){M[B.key]=B;break}}}findLoadedParent(d,m){if(d.key in this._loadedParentTiles){const b=this._loadedParentTiles[d.key];return b&&b.tileID.overscaledZ>=m?b:null}for(let b=d.overscaledZ-1;b>=m;b--){const M=d.scaledTo(b),L=this._getLoadedTile(M);if(L)return L}}_getLoadedTile(d){const m=this._tiles[d.key];return m&&m.hasData()?m:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,m){m=m||this._source.tileSize;const b=Math.ceil(d.width/m)+1,M=Math.ceil(d.height/m)+1,L=Math.floor(b*M*5),D=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,L):L,B=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,D):D;this._cache.setMaxSize(B)}handleWrapJump(d){const m=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,m){const b={};for(const M in this._tiles){const L=this._tiles[M];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+m),b[L.tileID.key]=L}this._tiles=b;for(const M in this._timers)clearTimeout(this._timers[M]),delete this._timers[M];for(const M in this._tiles)this._setTileReloadTimer(+M,this._tiles[M])}}update(d,m,b,M,L){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!b)return;this.updateCacheSize(d,m),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const D=this._source.type==="batched-model";let B,V=this._source.maxzoom;const Y=this.map&&this.map.painter?this.map.painter._terrain:null;if(Y&&Y.sourceCache===this&&Y.attenuationRange()){const oe=Y.attenuationRange()[0],ce=Math.floor(oe)-Math.log2(Y.getDemUpscale());V>ce&&(V=ce)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(oe=>new a.aQ(oe.canonical.z,oe.wrap,oe.canonical.z,oe.canonical.x,oe.canonical.y));else if(this.tileCoverLift!==0){const oe=d.clone();oe.tileCoverLift=this.tileCoverLift,B=oe.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!b,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.minzoom<=1&&d.projection.name==="globe"&&(B.push(new a.aQ(1,0,1,0,0)),B.push(new a.aQ(1,0,1,1,0)),B.push(new a.aQ(1,0,1,0,1)),B.push(new a.aQ(1,0,1,1,1)))}else if(B=d.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!b,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.hasTile){const oe=this._source.hasTile.bind(this._source);B=B.filter(ce=>oe(ce))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!mp(this._source.type)){const oe=d.coveringZoomLevel({tileSize:m||this._source.tileSize,roundZoom:this._source.roundZoom&&!b}),ce=Math.min(oe,this._source.maxzoom);if(D){const je=d.extendTileCover(B,ce);for(const ve of je)B.push(ve)}else if(L){const je=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(ce),ce);for(const ve of je)B.push(ve)}else if(this.castsShadows&&M){const je=d.extendTileCover(B,ce,M,16);for(const ve of je)this._shadowCasterTiles[ve.key]=!0,B.push(ve)}}const Q=this._updateRetainedTiles(B);if(mp(this._source.type)&&B.length!==0){const oe={},ce={},je=Object.keys(Q);for(const Le of je){const Pe=Q[Le],$e=this._tiles[Le];if(!$e||$e.fadeEndTime&&$e.fadeEndTime<=a.o.now())continue;const Ze=this.findLoadedParent(Pe,Math.max(Pe.overscaledZ-Yc.maxOverzooming,this._source.minzoom));Ze&&(this._addTile(Ze.tileID),oe[Ze.tileID.key]=Ze.tileID),ce[Le]=Pe}const ve=B[B.length-1].overscaledZ;for(const Le in this._tiles){const Pe=this._tiles[Le];if(Q[Le]||!Pe.hasData())continue;let $e=Pe.tileID;for(;$e.overscaledZ>ve;){$e=$e.scaledTo($e.overscaledZ-1);const Ze=this._tiles[$e.key];if(Ze&&Ze.hasData()&&ce[$e.key]){Q[Le]=Pe.tileID;break}}}for(const Le in oe)Q[Le]||(this._coveredTiles[Le]=!0,Q[Le]=oe[Le])}for(const oe in Q)this._tiles[oe].clearFadeHold();const le=a.bv(this._tiles,Q);for(const oe of le){const ce=this._tiles[oe];ce.hasSymbolBuckets&&!ce.holdingForFade()?ce.setHoldDuration(this.map._fadeDuration):ce.hasSymbolBuckets&&!ce.symbolFadeFinished()||this._removeTile(+oe)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const d in this._tiles)this._tiles[d].holdingForFade()&&this._removeTile(+d)}_updateRetainedTiles(d){const m={};if(d.length===0)return m;const b={},M=d.reduce((Y,Q)=>Math.min(Y,Q.overscaledZ),1/0),L=d[0].overscaledZ,D=Math.max(L-Yc.maxOverzooming,this._source.minzoom),B=Math.max(L+Yc.maxUnderzooming,this._source.minzoom),V={};for(const Y of d){const Q=this._addTile(Y);m[Y.key]=Y,Q.hasData()||M=this._source.maxzoom){const oe=Y.children(this._source.maxzoom)[0],ce=this.getTile(oe);if(ce&&ce.hasData()){m[oe.key]=oe;continue}}else{const oe=Y.children(this._source.maxzoom);if(m[oe[0].key]&&m[oe[1].key]&&m[oe[2].key]&&m[oe[3].key])continue}let le=Q.wasRequested();for(let oe=Y.overscaledZ-1;oe>=D;--oe){const ce=Y.scaledTo(oe);if(b[ce.key]||(b[ce.key]=!0,Q=this.getTile(ce),!Q&&le&&(Q=this._addTile(ce)),Q&&(m[ce.key]=ce,le=Q.wasRequested(),Q.hasData())))break}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const m=[];let b,M=this._tiles[d].tileID;for(;M.overscaledZ>0;){if(M.key in this._loadedParentTiles){b=this._loadedParentTiles[M.key];break}m.push(M.key);const L=M.scaledTo(M.overscaledZ-1);if(b=this._getLoadedTile(L),b)break;M=L}for(const L of m)this._loadedParentTiles[L]=b}}_addTile(d){let m=this._tiles[d.key];if(m)return m.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),m;m=this._cache.getAndRemove(d),m&&(this._setTileReloadTimer(d.key,m),m.tileID=d,this._state.initializeTileState(m,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,m)));const b=!!m;if(!b){const M=this.map?this.map.painter:null,L=this._source.tileSize*d.overscaleFactor();m=this._source.type==="raster-array"?new pp(d,L,this.transform.tileZoom,M,this._isRaster):new fp(d,L,this.transform.tileZoom,M,this._isRaster,this._source.worldview),this._loadTile(m,this._tileLoaded.bind(this,m,d.key,m.state))}return m.uses++,this._tiles[d.key]=m,b||this._source.fire(new a.z("dataloading",{tile:m,coord:m.tileID,dataType:"source"})),m}_setTileReloadTimer(d,m){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const b=m.getExpiryTimeout();b&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},b))}_removeTile(d){const m=this._tiles[d];m&&(m.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),m.uses>0||(m.hasData()&&m.state!=="reloading"||m.state==="empty"?this._cache.add(m.tileID,m,m.getExpiryTimeout()):(m.aborted=!0,this._abortTile(m),this._unloadTile(m))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const d in this._tiles)this._removeTile(+d);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(d,m,b){const M=[],L=this.transform;if(!L)return M;const D=L.projection.name==="globe",B=a.aF(L.center.lng);for(const V in this._tiles){const Y=this._tiles[V];if(b&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let Q;if(D){const le=Y.tileID.canonical;if(le.z===0){const oe=[Math.abs(a.aA(B,...Hu(le,-1))-B),Math.abs(a.aA(B,...Hu(le,1))-B)];Q=[0,2*oe.indexOf(Math.min(...oe))-1]}else{const oe=[Math.abs(a.aA(B,...Hu(le,-1))-B),Math.abs(a.aA(B,...Hu(le,0))-B),Math.abs(a.aA(B,...Hu(le,1))-B)];Q=[oe.indexOf(Math.min(...oe))-1]}}else Q=[0];for(const le of Q){const oe=d.containsTile(Y,L,m,le);oe&&M.push(oe)}}return M}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,m){const b=this.getRenderableIds(d,m).map(L=>this._tiles[L].tileID),M=this.transform.projection.name==="globe";for(const L of b)L.projMatrix=this.transform.calculateProjMatrix(L.toUnwrapped()),L.expandedProjMatrix=M?this.transform.calculateProjMatrix(L.toUnwrapped(),!1,!0):L.projMatrix;return b}sortCoordinatesByDistance(d){const m=d.slice(),b=this.transform._camera.position,M=this.transform._camera.forward(),L={};for(const D of m){const B=1/(1<L[D.key]-L[B.key]),m}hasTransition(){if(this._source.hasTransition())return!0;if(mp(this._source.type))for(const d in this._tiles){const m=this._tiles[d];if(m.fadeEndTime!==void 0&&m.fadeEndTime>=a.o.now())return!0}return!1}setFeatureState(d,m,b){this._state.updateState(d=d||"_geojsonTileLayer",m,b)}removeFeatureState(d,m,b){this._state.removeFeatureState(d=d||"_geojsonTileLayer",m,b)}getFeatureState(d,m){return this._state.getState(d=d||"_geojsonTileLayer",m)}setDependencies(d,m,b){const M=this._tiles[d];M&&M.setDependencies(m,b)}reloadTilesForDependencies(d,m){for(const b in this._tiles)this._tiles[b].hasDependency(d,m)&&this._reloadTile(+b,"reloading");this._cache.filter(b=>!b.hasDependency(d,m))}_preloadTiles(d,m){if(!this._sourceLoaded){const V=()=>{this._sourceLoaded&&(this._source.off("data",V),this._preloadTiles(d,m))};return void this._source.on("data",V)}const b=new Map,M=Array.isArray(d)?d:[d],L=this.map.painter.terrain,D=this.usedForTerrain&&L?L.getScaledDemTileSize():this._source.tileSize;for(const V of M){const Y=V.coveringTiles({tileSize:D,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const Q of Y)b.set(Q.key,Q);this.usedForTerrain&&V.updateElevation(!1)}const B=Array.from(b.values());a.bw(B,(V,Y)=>{const Q=new fp(V,this._source.tileSize*V.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(Q,le=>{this._source.type==="raster-dem"&&Q.dem&&this._backfillDEM(Q),Y(le,Q)})},m)}}function _y(_,d){const m=Math.abs(2*_.wrap)-+(_.wrap<0),b=Math.abs(2*d.wrap)-+(d.wrap<0);return _.overscaledZ-d.overscaledZ||b-m||d.canonical.y-_.canonical.y||d.canonical.x-_.canonical.x}function mp(_){return _==="raster"||_==="image"||_==="video"||_==="custom"}function Hu(_,d){const m=1<<_.z;return[_.x/m+d,(_.x+1)/m+d]}Yc.maxOverzooming=10,Yc.maxUnderzooming=3;class M3{constructor(d){this.style=d,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const d=!1,m=!1;for(const b in this.style._mergedLayers){const M=this.style._mergedLayers[b];if(M.type==="fill-extrusion"||M.type==="building")this.layers.push({layer:M,visible:d,visibilityChanged:m});else if(M.type==="model"){const L=this.style.getLayerSource(M);L&&L.type==="batched-model"&&this.layers.push({layer:M,visible:d,visibilityChanged:m})}}}onNewFrame(d){this.layersGotHidden=!1;for(const m of this.layers){const b=m.layer;let M=!1;b.type==="fill-extrusion"?M=!b.isHidden(d)&&b.paint.get("fill-extrusion-opacity")>0:b.type==="building"?M=!b.isHidden(d)&&b.paint.get("building-opacity")>0:b.type==="model"&&(M=!b.isHidden(d)&&b.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!M&&m.visible,m.visible=M}}updateZOffset(d,m){this.currentBuildingBuckets=[];for(const M of this.layers){const L=M.layer,D=this.style.getLayerSourceCache(L);let B=1;L.type==="fill-extrusion"?B=M.visible?L.paint.get("fill-extrusion-vertical-scale"):0:L.type==="building"&&(B=M.visible?L.paint.get("building-vertical-scale"):0);let V=D?D.getTile(m):null;if(!V&&D)for(const Y in D._tiles){const Q=D._tiles[Y];if(m.canonical.isChildOf(Q.tileID.canonical)){V=Q;break}}this.currentBuildingBuckets.push({bucket:V?V.getBucket(L):null,tileID:V?V.tileID:m,verticalScale:B})}d.hasAnyZOffset=!1;let b=!1;for(let M=0;M{b in d&&(m[b]=d[b])}),m}function Cr(_){_=_.slice();const d=Object.create(null);for(let m=0;m<_.length;m++)d[_[m].id]=_[m];for(let m=0;m<_.length;m++)"ref"in _[m]&&(_[m]=St(_[m],d[_[m].ref]));return _}const dr={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function bs(_,d,m){m.push({command:dr.addSource,args:[_,d[_]]})}function zs(_,d,m){d.push({command:dr.removeSource,args:[_]}),m[_]=!0}function Mo(_,d,m,b){zs(_,m,b),bs(_,d,m)}function so(_,d,m){let b;for(b in _[m])if(_[m].hasOwnProperty(b)&&b!=="data"&&!a.by(_[m][b],d[m][b]))return!1;for(b in d[m])if(d[m].hasOwnProperty(b)&&b!=="data"&&!a.by(_[m][b],d[m][b]))return!1;return!0}function io(_,d,m,b,M,L){let D;for(D in d=d||{},_=_||{})_.hasOwnProperty(D)&&(a.by(_[D],d[D])||m.push({command:L,args:[b,D,d[D],M]}));for(D in d)d.hasOwnProperty(D)&&!_.hasOwnProperty(D)&&(a.by(_[D],d[D])||m.push({command:L,args:[b,D,d[D],M]}))}function Vg(_){return _.id}function hv(_,d){return _[d.id]=d,_}function T3(_,d,m){const b=d.createTileMatrix(_,_.worldSize,m.toUnwrapped());return a.aB(new Float32Array(16),_.projMatrix,b)}function hk(_,d,m){if(d.projection.name===m.projection.name)return _.projMatrix;const b=m.clone();return b.setProjection(d.projection),T3(b,d.getProjection(),_)}function uf(_,d,m){return d.name===m.projection.name?_.projMatrix:T3(m,d,_)}class fv{constructor(d,m){this.reset(d,m)}reset(d,m){this.points=d||[],this._distances=[0];for(let b=1;b0?(M-D)/B:0;return this.points[L].mult(1-V).add(this.points[m].mult(V))}}class A3{constructor(d,m,b){const M=this.boxCells=[],L=this.circleCells=[];this.xCellCount=Math.ceil(d/b),this.yCellCount=Math.ceil(m/b);for(let D=0;Dthis.width||M<0||m>this.height)return!L&&[];const B=[];if(d<=0&&m<=0&&this.width<=b&&this.height<=M){if(L)return!0;for(let V=0;V0:B}_queryCircle(d,m,b,M,L){const D=d-b,B=d+b,V=m-b,Y=m+b;if(B<0||D>this.width||Y<0||V>this.height)return!M&&[];const Q=[];return this._forEachCell(D,V,B,Y,this._queryCellCircle,Q,{hitTest:M,circle:{x:d,y:m,radius:b},seenUids:{box:{},circle:{}}},L),M?Q.length>0:Q}query(d,m,b,M,L){return this._query(d,m,b,M,!1,L)}hitTest(d,m,b,M,L){return this._query(d,m,b,M,!0,L)}hitTestCircle(d,m,b,M){return this._queryCircle(d,m,b,!0,M)}_queryCell(d,m,b,M,L,D,B,V){const Y=B.seenUids,Q=this.boxCells[L];if(Q!==null){const oe=this.bboxes;for(const ce of Q)if(!Y.box[ce]){Y.box[ce]=!0;const je=4*ce;if(d<=oe[je+2]&&m<=oe[je+3]&&b>=oe[je+0]&&M>=oe[je+1]&&(!V||V(this.boxKeys[ce]))){if(B.hitTest)return D.push(!0),!0;D.push({key:this.boxKeys[ce],x1:oe[je],y1:oe[je+1],x2:oe[je+2],y2:oe[je+3]})}}}const le=this.circleCells[L];if(le!==null){const oe=this.circles;for(const ce of le)if(!Y.circle[ce]){Y.circle[ce]=!0;const je=3*ce;if(this._circleAndRectCollide(oe[je],oe[je+1],oe[je+2],d,m,b,M)&&(!V||V(this.circleKeys[ce]))){if(B.hitTest)return D.push(!0),!0;{const ve=oe[je],Le=oe[je+1],Pe=oe[je+2];D.push({key:this.circleKeys[ce],x1:ve-Pe,y1:Le-Pe,x2:ve+Pe,y2:Le+Pe})}}}}}_queryCellCircle(d,m,b,M,L,D,B,V){const Y=B.circle,Q=B.seenUids,le=this.boxCells[L];if(le!==null){const ce=this.bboxes;for(const je of le)if(!Q.box[je]){Q.box[je]=!0;const ve=4*je;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,ce[ve+0],ce[ve+1],ce[ve+2],ce[ve+3])&&(!V||V(this.boxKeys[je])))return D.push(!0),!0}}const oe=this.circleCells[L];if(oe!==null){const ce=this.circles;for(const je of oe)if(!Q.circle[je]){Q.circle[je]=!0;const ve=3*je;if(this._circlesCollide(ce[ve],ce[ve+1],ce[ve+2],Y.x,Y.y,Y.radius)&&(!V||V(this.circleKeys[je])))return D.push(!0),!0}}}_forEachCell(d,m,b,M,L,D,B,V){const Y=this._convertToXCellCoord(d),Q=this._convertToYCellCoord(m),le=this._convertToXCellCoord(b),oe=this._convertToYCellCoord(M);for(let ce=Y;ce<=le;ce++)for(let je=Q;je<=oe;je++)if(L.call(this,d,m,b,M,this.xCellCount*je+ce,D,B,V))return}_convertToXCellCoord(d){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(d*this.xScale)))}_convertToYCellCoord(d){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(d*this.yScale)))}_circlesCollide(d,m,b,M,L,D){const B=M-d,V=L-m,Y=b+D;return Y*Y>B*B+V*V}_circleAndRectCollide(d,m,b,M,L,D,B){const V=(D-M)/2,Y=Math.abs(d-(M+V));if(Y>V+b)return!1;const Q=(B-L)/2,le=Math.abs(m-(L+Q));if(le>Q+b)return!1;if(Y<=V||le<=Q)return!0;const oe=Y-V,ce=le-Q;return oe*oe+ce*ce<=b*b}}const Em={unknown:0,flipRequired:1,flipNotRequired:2},Hg=Math.tan(85*Math.PI/180);function Ic(_,d,m,b,M,L,D){const B=a.bC();if(m)if(L.name==="globe"){const V=a.bD(M,d);a.aB(B,B,V)}else{const V=a.bE([],D);B[0]=V[0],B[1]=V[1],B[4]=V[2],B[5]=V[3],b||a.bB(B,B,M.angle)}else a.aB(B,M.labelPlaneMatrix,_);return B}function fk(_,d,m,b,M,L,D){const B=Ic(_,d,m,b,M,L,D);return L.name==="globe"&&m||(B[2]=B[6]=B[10]=B[14]=0),B}function pv(_,d,m,b,M,L,D){if(m){if(L.name==="globe"){const B=Ic(_,d,m,b,M,L,D);return a.bl(B,B),a.aB(B,_,B),B}{const B=a.bz(_),V=a.bA([]);return V[0]=D[0],V[1]=D[1],V[4]=D[2],V[5]=D[3],a.aB(B,B,V),b||a.bB(B,B,-M.angle),B}}return M.glCoordMatrix}function Wu(_,d,m,b){const M=[_,d,m,1];m?a.aC(M,M,b):mn(M,M,b);const L=M[3];return M[0]/=L,M[1]/=L,M[2]/=L,M}function wi(_,d){return Math.min(.5+_/d*.5,1.5)}function VI(_,d){const m=_[0]/_[3],b=_[1]/_[3];return m>=-d[0]&&m<=d[0]&&b>=-d[1]&&b<=d[1]}function HI(_,d,m,b,M,L,D,B,V,Y,Q=1){const le=m.transform,oe=b?_.textSizeData:_.iconSizeData,ce=a.bK(oe,m.transform.zoom,Q),je=le.projection.name==="globe",ve=[256/m.width*2+1,256/m.height*2+1],Le=b?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;Le.clear();let Pe=null;je&&(Pe=b?_.text.globeExtVertexArray:_.icon.globeExtVertexArray);const $e=_.lineVertexArray,Ze=b?_.text.placedSymbolArray:_.icon.placedSymbolArray,qe=m.transform.width/m.transform.height;let xt,lt=!1;for(let ft=0;ftMath.abs(m)?{useVertical:!0}:_===a.bL.vertical?b>0?{needsFlipping:!0}:null:d!==Em.unknown&&function(M,L){return M===0||Math.abs(L/M)>Hg}(m,b)?d===Em.flipRequired?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function E3(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le,Pe,$e,Ze){const qe=d/24,xt=_.lineOffsetX*qe,lt=_.lineOffsetY*qe,{lineStartIndex:ft,glyphStartIndex:ot,numGlyphs:st,segment:bt,writingMode:Ot,flipState:Pt}=_,Vt=ft+_.lineLength,Ht=sr=>{if(Q){const[Yt,qt,ur]=sr.up,Er=Y.length;a.bN(Q,Er+0,Yt,qt,ur),a.bN(Q,Er+1,Yt,qt,ur),a.bN(Q,Er+2,Yt,qt,ur),a.bN(Q,Er+3,Yt,qt,ur)}const[br,zt,Mt]=sr.point;a.bO(Y,br,zt,Mt,sr.angle)};if(st>1){const sr=WI(qe,B,xt,lt,m,le,oe,_,V,L,ce,ve,!1,Le,Pe,$e,Ze);if(!sr)return{notEnoughRoom:!0};if(b&&!m){let[br,zt,Mt]=sr.first.point,[Yt,qt,ur]=sr.last.point;[br,zt]=Wu(br,zt,Mt,D),[Yt,qt]=Wu(Yt,qt,ur,D);const Er=Fn(Ot,Pt,(Yt-br)*je,qt-zt);if(_.flipState=Er&&Er.needsFlipping?Em.flipRequired:Em.flipNotRequired,Er)return Er}Ht(sr.first);for(let br=ot+1;br0?Yt:Gu(oe,Mt,br,1,M,void 0,Le,Pe.canonical),ur=Fn(Ot,Pt,(qt[0]-br[0])*je,qt[1]-br[1]);if(_.flipState=ur&&ur.needsFlipping?Em.flipRequired:Em.flipNotRequired,ur)return ur}const sr=by(qe*B.getoffsetX(ot),xt,lt,m,le,oe,bt,ft,Vt,V,L,ce,ve,!1,!1,Le,Pe,$e,Ze);if(!sr)return{notEnoughRoom:!0};Ht(sr)}return{}}function mv(_,d,m,b,M){const{x:L,y:D,z:B}=b.projectTilePoint(_.x,_.y,d);if(!M)return Wu(L,D,B,m);const[V,Y,Q]=M.getElevation(_,M.elevation,M.elevationFeature);return Wu(L+V,D+Y,B+Q,m)}function Gu(_,d,m,b,M,L,D,B){const V=mv(_.sub(d)._unit()._add(_),B,M,D,L);return a.av(V,m,V),a.aw(V,V),a.bH(V,m,V,b)}function by(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le,Pe,$e){const Ze=b?_-d:_+d;let qe=Ze>0?1:-1,xt=0;b&&(qe*=-1,xt=Math.PI),qe<0&&(xt+=Math.PI);let lt=B+D+(qe>0?0:1)|0,ft=M,ot=M,st=0,bt=0;const Ot=Math.abs(Ze),Pt=[],Vt=[];let Ht=L,sr=Ht,br=a.bF([]);const zt=()=>Gu(sr,Ht,ot,Ot-st+1,Q,oe,ve,Le.canonical);for(;st+bt<=Ot;){if(lt+=qe,lt=V)return null;if(ot=ft,sr=Ht,Pt.push(ot),ce&&Vt.push(sr),Ht=new a.P(Y.getx(lt),Y.gety(lt)),ft=le[lt],!ft){const en=mv(Ht,Le.canonical,Q,ve,oe);ft=en[3]>0?le[lt]=en:zt()}st+=bt;const wr=a.av([],ft,ot),on=a.bG(ot,ft);if(m&&on>0&&bt>0&&a.bJ(br,wr)/(bt*on)<$e)return null;bt=on,br=wr}je&&oe&&(le[lt]&&(ft=zt(),bt=a.bG(ot,ft),br=a.av([],ft,ot)),le[lt]=ft);const Mt=(Ot-st)/bt,Yt=Ht.sub(sr)._mult(Mt)._add(sr),qt=a.bH([],ot,br,Mt);let ur=[0,0,1],Er=br[0],Gr=br[1];if(Pe&&(ur=ve.upVector(Le.canonical,Yt.x,Yt.y),ur[0]!==0||ur[1]!==0||ur[2]!==1)){const wr=[ur[2],0,-ur[0]],on=a.bI([],ur,wr);a.aw(wr,wr),a.aw(on,on),Er=a.bJ(br,wr),Gr=a.bJ(br,on)}if(m){const wr=a.bI([],ur,br);a.aw(wr,wr),a.bH(qt,qt,wr,m*qe)}const Sr=xt+Math.atan2(Gr,Er);return Pt.push(qt),ce&&Vt.push(Yt),{point:qt,angle:Sr,path:Pt,tilePath:Vt,up:ur}}function kh(_,d){const m=d.length,b=m+4*_;d.resize(b),d.float32.fill(-1/0,4*m,4*b)}function mn(_,d,m){const b=d[0],M=d[1];return _[0]=m[0]*b+m[4]*M+m[12],_[1]=m[1]*b+m[5]*M+m[13],_[3]=m[3]*b+m[7]*M+m[15],_}const Ks=100;class Pi{constructor(d,m,b=new A3(d.width+200,d.height+200,25),M=new A3(d.width+200,d.height+200,25)){this.transform=d,this.grid=b,this.ignoredGrid=M,this.pitchfactor=Math.cos(d._pitch)*d.cameraToCenterDistance,this.screenRightBoundary=d.width+Ks,this.screenBottomBoundary=d.height+Ks,this.gridRightBoundary=d.width+200,this.gridBottomBoundary=d.height+200,this.fogState=m}placeCollisionBox(d,m,b,M,L,D,B,V,Y,Q,le){let oe=b.projectedAnchorX,ce=b.projectedAnchorY,je=b.projectedAnchorZ;const ve=b.tileAnchorX,Le=b.tileAnchorY,Pe=b.elevation,$e=b.tileID,Ze=d.getProjection();if(Pe&&$e){const[Vt,Ht,sr]=Ze.upVector($e.canonical,b.tileAnchorX,b.tileAnchorY),br=Ze.upVectorScale($e.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;oe+=Vt*Pe*br,ce+=Ht*Pe*br,je+=sr*Pe*br}const qe=d.projection.name==="globe",xt=d.projection.name==="globe"?a.aj(this.transform.zoom):0;if($e&&qe&&xt<1&&!D){const Vt=1<<$e.canonical.z,Ht=a.bP(ve,Le);a.bQ(Ht,Ht,1/a.al),a.bR(Ht,Ht,a.bP($e.canonical.x,$e.canonical.y)),a.bQ(Ht,Ht,1/Vt),a.bS(Ht,Ht,a.bP(M[0],M[1])),Ht[0]=a.bT(Ht[0],-.5,.5),a.bQ(Ht,Ht,a.al);const sr=a.bU(Ht[0],Ht[1],a.al/(2*Math.PI),1);a.aC(sr,sr,L),oe=a.ak(oe,sr[0],xt),ce=a.ak(ce,sr[1],xt),je=a.ak(je,sr[2],xt)}const lt=this.projectAndGetPerspectiveRatio(Q,oe,ce,je,b.tileID,Ze.name==="globe"||!!Pe||this.transform.pitch>0,Ze),ft=Y*lt.perspectiveRatio,ot=(b.x1*m+B.x-b.padding)*ft+lt.point.x,st=(b.y1*m+B.y-b.padding)*ft+lt.point.y,bt=(b.x2*m+B.x+b.padding)*ft+lt.point.x,Ot=(b.y2*m+B.y+b.padding)*ft+lt.point.y,Pt=lt.perspectiveRatio<=.55||lt.occluded;return!this.isInsideGrid(ot,st,bt,Ot)||!V&&this.grid.hitTest(ot,st,bt,Ot,le)||Pt?{box:[],offscreen:!1,occluded:lt.occluded}:{box:[ot,st,bt,Ot],offscreen:this.isOffscreen(ot,st,bt,Ot),occluded:!1}}placeCollisionCircles(d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le){const Pe=[],$e=this.transform.elevation,Ze=d.getProjection(),qe=d.elevationType==="road",xt=!!$e||qe,lt=a.bV.getAtTileOffsetFunc(Le,this.transform.center.lat,this.transform.worldSize,Ze),ft=new a.P(b.tileAnchorX,b.tileAnchorY),ot=new a.P(b.tileAnchorX,b.tileAnchorY);let{x:st,y:bt,z:Ot}=Ze.projectTilePoint(ot.x,ot.y,Le.canonical),Pt=null;if(xt){const on=qe?d.getElevationFeatureForText(M):null;Pt={getElevation:lt,elevation:$e,elevationFeature:on};const[en,$r,Kr]=lt(ft,$e,on);st+=en,bt+=$r,Ot+=Kr}const Vt=Ze.name==="globe",Ht=this.projectAndGetPerspectiveRatio(V,st,bt,Ot,Le,Vt||!!$e||this.transform.pitch>0,Ze),{perspectiveRatio:sr}=Ht,br=(oe?B/sr:B*sr)/a.bY,zt=Wu(st,bt,Ot,Y),Mt=b.lineOffsetX*br,Yt=b.lineOffsetY*br,qt=a.an(d.layers[0].layout.get("text-max-angle")),ur=Math.cos(qt),Er=Ht.signedDistanceFromCamera>0?WI(br,D,Mt,Yt,qe&&b.flipState===1,zt,ot,b,L,Y,{},xt&&!oe?Pt:null,oe&&xt,Ze,Le,oe,ur):null;let Gr=!1,Sr=!1,wr=!0;if(Er&&!Ht.occluded){const on=.5*je*sr+ve,en=new a.P(-100,-100),$r=new a.P(this.screenRightBoundary,this.screenBottomBoundary),Kr=new fv,{first:Nn,last:Yn}=Er,Os=Nn.path.length;let ui=[];for(let Hn=Os-1;Hn>=1;Hn--)ui.push(Nn.path[Hn]);for(let Hn=1;Hn(xt&&!Vt&&(Li=lt(jiHn[3]<=0)&&(ui=[]));let ii=[];if(ui.length>0){let Hn=1/0,gi=-1/0,Li=1/0,ji=-1/0;for(const ni of ui)Hn=Math.min(Hn,ni[0]),Li=Math.min(Li,ni[1]),gi=Math.max(gi,ni[0]),ji=Math.max(ji,ni[1]);gi>=en.x&&Hn<=$r.x&&ji>=en.y&&Li<=$r.y&&(ii=[ui.map(ni=>new a.P(ni[0],ni[1]))],(Hn$r.x||Li$r.y)&&(ii=a.bW(ii,en.x,en.y,$r.x,$r.y)))}for(const Hn of ii){Kr.reset(Hn,.25*on);let gi=0;gi=Kr.length<=.5*on?1:Math.ceil(Kr.paddedLength/dn)+1;for(let Li=0;Li0?(a.aC(V,V,d),this.fogState&&L&&B.name!=="globe"&&(Y=function(oe,ce,je,ve,Le,Pe){const $e=Pe.calculateFogTileMatrix(Le),Ze=[ce,je,ve];return a.af(Ze,Ze,$e),Xr(oe,a.ag(Ze),Pe.pitch,Pe._fov)}(this.fogState,m,b,M,L.toUnwrapped(),this.transform)>.9)):mn(V,V,d);const Q=V[3];return{point:new a.P((V[0]/Q+1)/2*this.transform.width+Ks,(-V[1]/Q+1)/2*this.transform.height+Ks),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/Q*.5,1.5),signedDistanceFromCamera:Q,occluded:D&&V[2]>Q||Y}}isOffscreen(d,m,b,M){return b=this.screenRightBoundary||Mthis.screenBottomBoundary}isInsideGrid(d,m,b,M){return b>=0&&d=0&&mb.collisionGroupID===m}}return this.collisionGroups[d]}}function pc(_,d,m,b,M){const{horizontalAlign:L,verticalAlign:D}=a.c1(_),B=-(L-.5)*d,V=-(D-.5)*m,Y=a.c2(_,b);return new a.P(B+Y[0]*M,V+Y[1]*M)}function To(_,d,m,b,M){const L=new a.P(_,d);return m&&L._rotate(b?M:-M),L}class Hie{constructor(d,m,b,M,L,D){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Pi(this.transform,L),this.buildingIndex=D,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new xv(b),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,m,b,M,L=1){const D=b.getBucket(m),B=b.latestFeatureIndex;if(!D||!B||m.fqid!==D.layerIds[0])return;const V=D.layers[0].layout,Y=D.layers[0].paint,Q=b.collisionBoxArray,le=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),oe=b.tileSize/a.al,ce=b.tileID.toUnwrapped();this.transform.setProjection(D.projection);const je=(ve=b.tileID,Le=D.getProjection(),Pe=this.transform,Le.name===this.projection?Pe.calculateProjMatrix(ve.toUnwrapped()):T3(Pe,Le,ve));var ve,Le,Pe;const $e=V.get("text-pitch-alignment")==="map",Ze=V.get("text-rotation-alignment")==="map";m.compileFilter(m.options);const qe=m.dynamicFilter(),xt=m.dynamicFilterNeedsFeature(),lt=this.transform.calculatePixelsToTileUnitsMatrix(b),ft=fk(je,b.tileID.canonical,$e,Ze,this.transform,D.getProjection(),lt);let ot=null;const st=D.getProjection().createInversionMatrix(this.transform,b.tileID.canonical);if($e){const Mt=pv(je,b.tileID.canonical,$e,Ze,this.transform,D.getProjection(),lt);ot=a.aB([],this.transform.labelPlaneMatrix,Mt)}let bt=null;qe&&b.latestFeatureIndex&&(bt={unwrappedTileID:ce,dynamicFilter:qe,dynamicFilterNeedsFeature:xt}),this.retainedQueryData[D.bucketInstanceId]=new gv(D.bucketInstanceId,B,D.sourceLayerIndex,D.index,b.tileID);const[Ot,Pt]=D.layers[0].layout.get("text-size-scale-range"),Vt=a.aA(L,Ot,Pt),[Ht,sr]=V.get("icon-size-scale-range"),br=a.aA(L,Ht,sr),zt={bucket:D,layout:V,paint:Y,posMatrix:je,invMatrix:st,mercatorCenter:[a.aF(this.transform.center.lng),a.aJ(this.transform.center.lat)],textLabelPlaneMatrix:ft,labelToScreenMatrix:ot,clippingData:bt,scale:le,textPixelRatio:oe,holdingForFade:b.holdingForFade(),collisionBoxArray:Q,partiallyEvaluatedTextSize:a.bK(D.textSizeData,this.transform.zoom,Vt),partiallyEvaluatedIconSize:a.bK(D.iconSizeData,this.transform.zoom,br),collisionGroup:this.collisionGroups.get(D.sourceID),latestFeatureIndex:b.latestFeatureIndex};if(M)for(const Mt of D.sortKeyRanges){const{sortKey:Yt,symbolInstanceStart:qt,symbolInstanceEnd:ur}=Mt;d.push({sortKey:Yt,symbolInstanceStart:qt,symbolInstanceEnd:ur,parameters:zt})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:D.symbolInstances.length,parameters:zt})}attemptAnchorPlacement(d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le,Pe,$e,Ze,qe,xt){const{textOffset0:lt,textOffset1:ft,crossTileID:ot}=ve,st=[lt,ft],bt=pc(d,D,B,st,V),Ot=this.collisionIndex.placeCollisionBox(Pe,V,m,b,M,L,To(bt.x,bt.y,Y,Q,this.transform.angle),je,le,oe,ce.predicate);if(Ze){const Pt=Pe.getSymbolInstanceIconSize(xt,this.transform.zoom,ve.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Pe,Pt,Ze,b,M,L,To(bt.x,bt.y,Y,Q,this.transform.angle),je,le,oe,ce.predicate).box.length===0)return}if(Ot.box.length>0){let Pt;return this.prevPlacement&&this.prevPlacement.variableOffsets[ot]&&this.prevPlacement.placements[ot]&&this.prevPlacement.placements[ot].text&&(Pt=this.prevPlacement.variableOffsets[ot].anchor),this.variableOffsets[ot]={textOffset:st,width:D,height:B,anchor:d,textScale:V,prevAnchor:Pt},this.markUsedJustification(Pe,d,ve,$e),Pe.allowVerticalPlacement&&(this.markUsedOrientation(Pe,$e,ve),this.placedOrientations[ot]=$e),{shift:bt,placedGlyphBoxes:Ot}}}placeLayerBucketPart(d,m,b,M,L=1){const{bucket:D,layout:B,paint:V,posMatrix:Y,textLabelPlaneMatrix:Q,labelToScreenMatrix:le,clippingData:oe,textPixelRatio:ce,mercatorCenter:je,invMatrix:ve,holdingForFade:Le,collisionBoxArray:Pe,partiallyEvaluatedTextSize:$e,partiallyEvaluatedIconSize:Ze,collisionGroup:qe,latestFeatureIndex:xt}=d.parameters,lt=B.get("text-optional"),ft=B.get("icon-optional"),ot=B.get("text-allow-overlap"),st=B.get("icon-allow-overlap"),bt=B.get("text-rotation-alignment")==="map",Ot=B.get("icon-rotation-alignment")==="map",Pt=B.get("text-pitch-alignment")==="map",Vt=V.get("symbol-z-offset"),Ht=B.get("symbol-elevation-reference")==="sea",sr=B.get("symbol-placement"),[br,zt]=B.get("text-size-scale-range"),[Mt,Yt]=B.get("icon-size-scale-range"),qt=a.aA(L,br,zt),ur=a.aA(L,Mt,Yt),Er=B.get("text-variable-anchor"),Gr=bt&&sr!=="point",Sr=Ot&&sr!=="point",wr=Er&&D.hasTextData(),on=D.hasIconTextFit()&&wr&&D.hasIconData();this.transform.setProjection(D.projection);const en=wr||Gr,$r=Sr||on;let Kr=ot&&(st||!D.hasIconData()||ft),Nn=st&&(ot||!D.hasTextData()||lt);const Yn=!Vt.isConstant();!D.collisionArrays&&Pe&&D.deserializeCollisionBoxes(Pe),b&&M&&D.updateCollisionDebugBuffers(this.transform.zoom,Pe,qt,ur);const Os=(dn,ii,Hn)=>{const{crossTileID:gi,numVerticalGlyphVertices:Li}=dn;let ji=null;if(oe&&oe.dynamicFilterNeedsFeature||Yn){const Ua=this.retainedQueryData[D.bucketInstanceId];ji=xt.loadFeature({featureIndex:dn.featureIndex,bucketIndex:Ua.bucketIndex,sourceLayerIndex:Ua.sourceLayerIndex,layoutVertexArrayOffset:0});const ao=ji.properties?ji.properties.worldview:null;if(D.localizable&&D.worldview&&typeof ao=="string")if(ao==="all")ji.properties.$localized=!0;else{if(!ao.split(",").includes(D.worldview))return;ji.properties.$localized=!0,ji.properties.worldview=D.worldview}}if(oe&&!(0,oe.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:D.worldview},ji,this.retainedQueryData[D.bucketInstanceId].tileID.canonical,new a.P(dn.tileAnchorX,dn.tileAnchorY),this.transform.calculateDistanceTileData(oe.unwrappedTileID)))return this.placements[gi]=new _i(!1,!1,!1,!0),void m.add(gi);const ni=Vt.evaluate(ji,{});if(m.has(gi))return;if(Le)return void(this.placements[gi]=new _i(!1,!1,!1));let as=!1,pi=!1,Da=!0,xa=!1,xi=!1,Qs=null,ls={box:null,offscreen:null,occluded:null},sa={box:null},eo=null,Ea=null,qi=null,rd=0,ec=0,Uo=0;Hn.textFeatureIndex?rd=Hn.textFeatureIndex:dn.useRuntimeCollisionCircles&&(rd=dn.featureIndex),Hn.verticalTextFeatureIndex&&(ec=Hn.verticalTextFeatureIndex);const gc=D.elevationFeatures?D.elevationFeatures[dn.elevationFeatureIndex]:void 0,xc=Ua=>{Ua.tileID=this.retainedQueryData[D.bucketInstanceId].tileID;const ao=this.transform.elevation;Ua.elevation=Ht?ni:ni+a.bV.getAtTileOffset(Ua.tileID,new a.P(Ua.tileAnchorX,Ua.tileAnchorY),ao,gc),Ua.elevation+=dn.zOffset},Fl=Hn.textBox;if(Fl){xc(Fl);const Ua=Vi=>{let _o=a.bL.horizontal;if(D.allowVerticalPlacement&&!Vi&&this.prevPlacement){const Ra=this.prevPlacement.placedOrientations[gi];Ra&&(this.placedOrientations[gi]=Ra,_o=Ra,this.markUsedOrientation(D,_o,dn))}return _o},ao=(Vi,_o)=>{if(D.allowVerticalPlacement&&Li>0&&Hn.verticalTextBox){for(const Ra of D.writingModes)if(Ra===a.bL.vertical?(ls=_o(),sa=ls):ls=Vi(),ls&&ls.box&&ls.box.length)break}else ls=Vi()};if(Er){let Vi=Er;if(this.prevPlacement&&this.prevPlacement.variableOffsets[gi]){const Ia=this.prevPlacement.variableOffsets[gi];Vi.indexOf(Ia.anchor)>0&&(Vi=Vi.filter(th=>th!==Ia.anchor),Vi.unshift(Ia.anchor))}const _o=(Ia,th,Hv)=>{const Ah=D.getSymbolInstanceTextSize($e,dn,this.transform.zoom,ii),Wv=(Ia.x2-Ia.x1)*Ah+2*Ia.padding,Hy=(Ia.y2-Ia.y1)*Ah+2*Ia.padding,bf=dn.hasIconTextFit&&!st?th:null;bf&&xc(bf);let Tp={box:[],offscreen:!1,occluded:!1};const Wy=ot?2*Vi.length:Vi.length;for(let Gm=0;Gm=Vi.length,dn,ii,D,Hv,bf,$e,Ze);if(Ap&&(Tp=Ap.placedGlyphBoxes,Tp&&Tp.box&&Tp.box.length)){as=!0,Qs=Ap.shift;break}}return Tp};ao(()=>_o(Fl,Hn.iconBox,a.bL.horizontal),()=>{const Ia=Hn.verticalTextBox;return Ia&&xc(Ia),D.allowVerticalPlacement&&!(ls&&ls.box&&ls.box.length)&&Li>0&&Ia?_o(Ia,Hn.verticalIconBox,a.bL.vertical):{box:null,offscreen:null,occluded:null}}),ls&&(as=ls.box,Da=ls.offscreen,xa=ls.occluded);const Ra=Ua(!(!ls||!ls.box));if(!as&&this.prevPlacement){const Ia=this.prevPlacement.variableOffsets[gi];Ia&&(this.variableOffsets[gi]=Ia,this.markUsedJustification(D,Ia.anchor,dn,Ra))}}else{const Vi=(_o,Ra)=>{const Ia=D.getSymbolInstanceTextSize($e,dn,this.transform.zoom,ii),th=this.collisionIndex.placeCollisionBox(D,Ia,_o,je,ve,en,new a.P(0,0),ot,ce,Y,qe.predicate);return th&&th.box&&th.box.length&&(this.markUsedOrientation(D,Ra,dn),this.placedOrientations[gi]=Ra),th};ao(()=>Vi(Fl,a.bL.horizontal),()=>{const _o=Hn.verticalTextBox;return D.allowVerticalPlacement&&Li>0&&_o?(xc(_o),Vi(_o,a.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Ua(!!(ls&&ls.box&&ls.box.length))}}if(eo=ls,as=eo&&eo.box&&eo.box.length>0,Da=eo&&eo.offscreen,xa=eo&&eo.occluded,dn.useRuntimeCollisionCircles){const Ua=dn.centerJustifiedTextSymbolIndex>=0?dn.centerJustifiedTextSymbolIndex:dn.verticalPlacedTextSymbolIndex,ao=D.text.placedSymbolArray.get(Ua),Vi=a.bM(D.textSizeData,$e,ao),_o=B.get("text-padding");Ea=this.collisionIndex.placeCollisionCircles(D,ot,ao,Ua,D.lineVertexArray,D.glyphOffsetArray,Vi,Y,Q,le,b,Pt,qe.predicate,dn.collisionCircleDiameter*Vi/a.bY,_o,this.retainedQueryData[D.bucketInstanceId].tileID),as=ot||Ea.circles.length>0&&!Ea.collisionDetected,Da=Da&&Ea.offscreen,xa=Ea.occluded}if(Hn.iconFeatureIndex&&(Uo=Hn.iconFeatureIndex),Hn.iconBox){const Ua=ao=>{xc(ao);const Vi=dn.hasIconTextFit&&Qs?To(Qs.x,Qs.y,bt,Pt,this.transform.angle):new a.P(0,0),_o=D.getSymbolInstanceIconSize(Ze,this.transform.zoom,dn.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(D,_o,ao,je,ve,$r,Vi,st,ce,Y,qe.predicate)};sa&&sa.box&&sa.box.length&&Hn.verticalIconBox?(qi=Ua(Hn.verticalIconBox),pi=qi.box.length>0):(qi=Ua(Hn.iconBox),pi=qi.box.length>0),Da=Da&&qi.offscreen,xi=qi.occluded}const uu=lt||dn.numHorizontalGlyphVertices===0&&Li===0,eh=ft||dn.numIconVertices===0;if(uu||eh?eh?uu||(pi=pi&&as):as=pi&&as:pi=as=pi&&as,as&&eo&&eo.box&&this.collisionIndex.insertCollisionBox(eo.box,B.get("text-ignore-placement"),D.bucketInstanceId,sa&&sa.box&&ec?ec:rd,qe.ID),pi&&qi&&this.collisionIndex.insertCollisionBox(qi.box,B.get("icon-ignore-placement"),D.bucketInstanceId,Uo,qe.ID),Ea&&(as&&this.collisionIndex.insertCollisionCircles(Ea.circles,B.get("text-ignore-placement"),D.bucketInstanceId,rd,qe.ID),b)){const Ua=D.bucketInstanceId;let ao=this.collisionCircleArrays[Ua];ao===void 0&&(ao=this.collisionCircleArrays[Ua]=new pk);for(let Vi=0;Vi=0;--ii){const Hn=dn[ii];Os(D.symbolInstances.get(Hn),Hn,D.collisionArrays[Hn])}D.hasAnyZOffset&&a.w(`${D.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(D.hasAnyZOffset){const dn=D.getSortedIndexesByZOffset();for(let ii=0;ii=0&&(d.text.placedSymbolArray.get(L).crossTileID=le>=0&&L!==le?0:Y),D>=0&&(d.text.placedSymbolArray.get(D).crossTileID=le>=0&&D!==le?0:Y),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=le>=0&&B!==le?0:Y),V>=0&&(d.text.placedSymbolArray.get(V).crossTileID=le>=0&&V!==le?0:Y)}markUsedOrientation(d,m,b){const M=m===a.bL.horizontal||m===a.bL.horizontalOnly?m:0,L=m===a.bL.vertical?m:0,{leftJustifiedTextSymbolIndex:D,centerJustifiedTextSymbolIndex:B,rightJustifiedTextSymbolIndex:V,verticalPlacedTextSymbolIndex:Y}=b,Q=d.text.placedSymbolArray;D>=0&&(Q.get(D).placedOrientation=M),B>=0&&(Q.get(B).placedOrientation=M),V>=0&&(Q.get(V).placedOrientation=M),Y>=0&&(Q.get(Y).placedOrientation=L)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let b=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const M=m?m.symbolFadeChange(d):1,L=m?m.opacities:{},D=m?m.variableOffsets:{},B=m?m.placedOrientations:{};for(const V in this.placements){const Y=this.placements[V],Q=L[V];Q?(this.opacities[V]=new hf(Q,M,Y.text,Y.icon,null,Y.clipped),b=b||Y.text!==Q.text.placed||Y.icon!==Q.icon.placed):(this.opacities[V]=new hf(null,M,Y.text,Y.icon,Y.skipFade,Y.clipped),b=b||Y.text||Y.icon)}for(const V in L){const Y=L[V];if(!this.opacities[V]){const Q=new hf(Y,M,!1,!1);Q.isHidden()||(this.opacities[V]=Q,b=b||Y.text.placed||Y.icon.placed)}}for(const V in D)this.variableOffsets[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.variableOffsets[V]=D[V]);for(const V in B)this.placedOrientations[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.placedOrientations[V]=B[V]);b?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:d)}updateLayerOpacities(d,m,b,M){M&&(this.lastReplacementSourceUpdateTime=M.updateTime);const L=new Set;for(const D of m){const B=D.getBucket(d);B&&D.latestFeatureIndex&&d.fqid===B.layerIds[0]&&(this.updateBucketOpacities(B,L,D,D.collisionBoxArray,b,M,D.tileID,d.scope),B.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(B,D.tileID),B.elevationType==="road"&&B.updateRoadElevation(D.tileID.canonical),B.updateZOffset())}}updateBucketOpacities(d,m,b,M,L,D,B,V){d.hasTextData()&&d.text.opacityVertexArray.clear(),d.hasIconData()&&d.icon.opacityVertexArray.clear(),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexArray.clear(),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexArray.clear();const Y=d.layers[0].layout,Q=d.layers[0].paint,le=!!d.layers[0].dynamicFilter(),oe=new hf(null,0,!1,!1,!0),ce=Y.get("text-allow-overlap"),je=Y.get("icon-allow-overlap"),ve=Y.get("text-variable-anchor"),Le=Y.get("text-rotation-alignment")==="map",Pe=Y.get("text-pitch-alignment")==="map",$e=Q.get("symbol-z-offset"),Ze=Y.get("symbol-elevation-reference")==="sea",qe=!$e.isConstant(),xt=new hf(null,0,ce&&(je||!d.hasIconData()||Y.get("icon-optional")),je&&(ce||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&M&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(M);const lt=(ot,st,bt)=>{for(let Ot=0;Ot0||Ot>0,Er=Vt>0,Gr=this.placedOrientations[Pt],Sr=Gr===a.bL.vertical,wr=Gr===a.bL.horizontal||Gr===a.bL.horizontalOnly;!ur&&!Er||qt.isHidden()||ft++;let on=!1;if((ur||Er)&&D)for(const en of d.activeReplacements){if(a.bZ(en,L,a.b_.Symbol,V)||en.min.x>Ht||Ht>en.max.x||en.min.y>sr||sr>en.max.y)continue;const $r=a.b$(Ht,sr,B.canonical,en.footprintTileId.canonical);if(on=a.c0($r,en.footprint),on)break}if(ur){const en=on?Wg:Qc(qt.text);lt(d.text,bt,Sr?Wg:en),lt(d.text,Ot,wr?Wg:en);const $r=qt.text.isHidden(),{leftJustifiedTextSymbolIndex:Kr,centerJustifiedTextSymbolIndex:Nn,rightJustifiedTextSymbolIndex:Yn,verticalPlacedTextSymbolIndex:Os}=st,ui=d.text.placedSymbolArray,dn=$r||Sr?1:0;Kr>=0&&(ui.get(Kr).hidden=dn),Nn>=0&&(ui.get(Nn).hidden=dn),Yn>=0&&(ui.get(Yn).hidden=dn),Os>=0&&(ui.get(Os).hidden=$r||wr?1:0);const ii=this.variableOffsets[Pt];ii&&this.markUsedJustification(d,ii.anchor,st,Gr);const Hn=this.placedOrientations[Pt];Hn&&(this.markUsedJustification(d,"left",st,Hn),this.markUsedOrientation(d,Hn,st))}if(Er){const en=on?Wg:Qc(qt.icon),{placedIconSymbolIndex:$r,verticalPlacedIconSymbolIndex:Kr}=st,Nn=d.icon.placedSymbolArray,Yn=qt.icon.isHidden()?1:0;$r>=0&&(lt(d.icon,Vt,Sr?Wg:en),Nn.get($r).hidden=Yn),Kr>=0&&(lt(d.icon,st.numVerticalIconVertices,wr?Wg:en),Nn.get(Kr).hidden=Yn)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const en=d.collisionArrays[ot];if(en){let $r=new a.P(0,0),Kr=!0;if(en.textBox||en.verticalTextBox){if(ve){const Yn=this.variableOffsets[Pt];Yn?($r=pc(Yn.anchor,Yn.width,Yn.height,Yn.textOffset,Yn.textScale),Le&&$r._rotate(Pe?this.transform.angle:-this.transform.angle)):Kr=!1}le&&(Kr=!qt.clipped),en.textBox&&Im(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Kr||Sr,Mt,Ze,$r.x,$r.y),en.verticalTextBox&&Im(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Kr||wr,Mt,Ze,$r.x,$r.y)}const Nn=Kr&&!!(!wr&&en.verticalIconBox);en.iconBox&&Im(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,Nn,Mt,Ze,st.hasIconTextFit?$r.x:0,st.hasIconTextFit?$r.y:0),en.verticalIconBox&&Im(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,!Nn,Mt,Ze,st.hasIconTextFit?$r.x:0,st.hasIconTextFit?$r.y:0)}}}if(d.fullyClipped=ft===0,d.sortFeatures(this.transform.angle),this.retainedQueryData[d.bucketInstanceId]&&(this.retainedQueryData[d.bucketInstanceId].featureSortOrder=d.featureSortOrder),d.hasTextData()&&d.text.opacityVertexBuffer&&d.text.opacityVertexBuffer.updateData(d.text.opacityVertexArray),d.hasIconData()&&d.icon.opacityVertexBuffer&&d.icon.opacityVertexBuffer.updateData(d.icon.opacityVertexArray),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexBuffer&&d.iconCollisionBox.collisionVertexBuffer.updateData(d.iconCollisionBox.collisionVertexArray),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexBuffer&&d.textCollisionBox.collisionVertexBuffer.updateData(d.textCollisionBox.collisionVertexArray),d.bucketInstanceId in this.collisionCircleArrays){const ot=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=ot.invProjMatrix,d.placementViewportMatrix=ot.viewportMatrix,d.collisionCircleArray=ot.circles,delete this.collisionCircleArrays[d.bucketInstanceId]}}symbolFadeChange(d){return this.fadeDuration===0?1:(d-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(d){return Math.max(0,(this.transform.zoom-d)/1.5)}hasTransitions(d){return this.stale||d-this.lastPlacementChangeTimed}isStale(){return this.stale}setStale(){this.stale=!0}}function Im(_,d,m,b,M,L,D){_.emplaceBack(d?1:0,m?1:0,L||0,D||0,b,M?1:0),_.emplaceBack(d?1:0,m?1:0,L||0,D||0,b,M?1:0),_.emplaceBack(d?1:0,m?1:0,L||0,D||0,b,M?1:0),_.emplaceBack(d?1:0,m?1:0,L||0,D||0,b,M?1:0)}const I3=Math.pow(2,25),yv=Math.pow(2,24),mk=Math.pow(2,17),P3=Math.pow(2,16),gk=Math.pow(2,9),Xc=Math.pow(2,8),gp=Math.pow(2,1);function Qc(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const d=_.placed?1:0,m=Math.floor(127*_.opacity);return m*I3+d*yv+m*mk+d*P3+m*gk+d*Xc+m*gp+d}const Wg=0;class wy{constructor(d){this._sortAcrossTiles=d.layout.get("symbol-z-order")!=="viewport-y"&&d.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(d,m,b,M,L,D){const B=this._bucketParts;for(;this._currentTileIndexV.sortKey-Y.sortKey));this._currentPartIndex{const V=a.o.now()-D;return!this._forceFullPlacement&&V>2};for(;this._currentPlacementIndex>=0;){const V=m[d[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(V.type==="symbol"&&V.visibility!=="none"&&(!V.minzoom||V.minzoom<=Y)&&(!V.maxzoom||V.maxzoom>Y)){const Q=V,le=Q.layout.get("symbol-z-elevate"),oe=Q.layout.get("symbol-sort-key").constantOr(1)!==void 0,ce=Q.layout.get("symbol-z-order"),je=ce==="viewport-y"||ce==="auto"&&!(ce!=="viewport-y"&&oe),ve=Q.layout.get("text-allow-overlap")||Q.layout.get("icon-allow-overlap")||Q.layout.get("text-ignore-placement")||Q.layout.get("icon-ignore-placement"),Le=je&&ve,Pe=this._inProgressLayer=this._inProgressLayer||new wy(Q),$e=a.B(V.source,V.scope);if(Pe.continuePlacement(le||Le?M[$e]:b[$e],this.placement,this._showCollisionBoxes,V,B,L))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const Ku=512/a.al/2;class xp{constructor(d,m,b){this.tileID=d,this.bucketInstanceId=b,this.index=new a.c4(m.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const M=d.canonical.x*a.al,L=d.canonical.y*a.al;for(let D=0;DLe-Pe);for(const Le of ve){const Pe=this.crossTileIDs[Le];if(this.keys[Le]===Q&&!b.has(Pe)){b.add(Pe),Y.crossTileID=Pe;break}}}}}class il{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class L3{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const m=Math.round((d-this.lng)/360);if(m!==0)for(const b in this.indexes){const M=this.indexes[b],L={};for(const D in M){const B=M[D];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+m),L[B.tileID.key]=B}this.indexes[b]=L}this.lng=d}addBucket(d,m,b){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===m.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let L=0;Ld.overscaledZ)for(const B in D){const V=D[B];V.tileID.isChildOf(d)&&V.findMatches(m.symbolInstances,d,M)}else{const B=D[d.scaledTo(Number(L)).key];B&&B.findMatches(m.symbolInstances,d,M)}}for(let L=0;L{m[b]=!0});for(const b in this.layerIndexes)m[b]||delete this.layerIndexes[b]}}const ff=771;class is{constructor(d,m,b,M){this.blendFunction=d,this.blendColor=m.toNonPremultipliedRenderColor(null),this.mask=b,this.blendEquation=M}}is.Replace=[1,0,1,0],is.disabled=new is(is.Replace,a.ao.transparent,[!1,!1,!1,!1]),is.unblended=new is(is.Replace,a.ao.transparent,[!0,!0,!0,!0]),is.alphaBlended=new is([1,ff,1,ff],a.ao.transparent,[!0,!0,!0,!0]),is.alphaBlendedNonPremultiplied=new is([770,ff,770,ff],a.ao.transparent,[!0,!0,!0,!0]),is.multiply=new is([774,0,774,0],a.ao.transparent,[!0,!0,!0,!0]),is.additive=new is([1,1,1,1],a.ao.transparent,[!0,!0,!0,!0]);class un{constructor(d,m,b){this.func=d,this.mask=m,this.range=b}}un.ReadOnly=!1,un.ReadWrite=!0,un.disabled=new un(519,un.ReadOnly,[0,1]);const xk=7680;class $n{constructor(d,m,b,M,L,D){this.test=d,this.ref=m,this.mask=b,this.fail=M,this.depthFail=L,this.pass=D}}$n.disabled=new $n({func:519,mask:0},0,0,xk,xk,xk);const jy=1029,yk=2305;class Bn{constructor(d,m,b){this.enable=d,this.mode=m,this.frontFace=b}}function pf(_,d){const m=a.ca(_,3);a.cc(_,d),a.cg(_,3,m)}function O3(_,d){const m=a.c7([]);return a.c8(m,m,-d),a.c9(m,m,-_),m}function vk(_,d){const m=[_[0],_[1],0],b=[d[0],d[1],0];if(a.ag(m)>=1e-15){const D=a.aw([],m);a.c5(b,D,a.bJ(b,D)),d[0]=b[0],d[1]=b[1]}const M=a.bI([],d,_);if(a.c6(M)<1e-15)return null;const L=Math.atan2(-M[1],M[0]);return O3(Math.atan2(Math.sqrt(_[0]*_[0]+_[1]*_[1]),-_[2]),L)}Bn.disabled=new Bn(!1,jy,yk),Bn.backCCW=new Bn(!0,jy,yk),Bn.backCW=new Bn(!0,jy,2304),Bn.frontCW=new Bn(!0,1028,2304),Bn.frontCCW=new Bn(!0,1028,yk);class Jc{constructor(d,m){this.position=d,this.orientation=m}get position(){return this._position}set position(d){if(d){const m=d instanceof a.ae?d:new a.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(m.x=a.bT(m.x,0,1)),this._position=m}else this._position=null}lookAtPoint(d,m,b){if(this.orientation=null,!this.position)return;const M=this.position,L=b||(this._elevation?this._elevation.getAtPointOrZero(a.ae.fromLngLat(d)):0),D=a.ae.fromLngLat(d,L),B=[D.x-M.x,D.y-M.y,D.z-M.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=vk(B,m)}setPitchBearing(d,m){this.orientation=O3(a.an(d),a.an(-m))}}class _k{constructor(d,m){this._transform=a.bA([]),this.orientation=m,this.position=d}get mercatorPosition(){const d=this.position;return new a.ae(d[0],d[1],d[2])}get position(){const d=a.ca(this._transform,3);return[d[0],d[1],d[2]]}set position(d){var m;d&&a.cg(this._transform,3,[(m=d)[0],m[1],m[2],1])}get orientation(){return this._orientation}set orientation(d){this._orientation=d||a.c7([]),d&&pf(this._transform,this._orientation)}getPitchBearing(){const d=this.forward(),m=this.right();return{bearing:Math.atan2(-m[1],m[0]),pitch:Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2])}}setPitchBearing(d,m){this._orientation=O3(d,m),pf(this._transform,this._orientation)}forward(){const d=a.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=a.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=a.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,m){const b=new Float64Array(16);return a.bl(b,this.getWorldToCamera(d,m)),b}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,m,b){const M=this.position;a.c5(M,M,-d);const L=new Float64Array(16);return a.bq(L,[b,b,b]),a.br(L,L,M),L[10]*=m,L}getWorldToCamera(d,m){const b=new Float64Array(16),M=new Float64Array(4),L=this.position;return a.cb(M,this._orientation),a.c5(L,L,-d),a.cc(b,M),a.br(b,b,L),b[1]*=-1,b[5]*=-1,b[9]*=-1,b[13]*=-1,b[8]*=m,b[9]*=m,b[10]*=m,b[11]*=m,b}getCameraToClipPerspective(d,m,b,M){const L=new Float64Array(16);return a.cd(L,d,m,b,M),L}getCameraToClipOrthographic(d,m,b,M,L,D){const B=new Float64Array(16);return a.ce(B,d,m,b,M,L,D),B}getDistanceToElevation(d,m=!1){const b=d===0?0:a.cf(d,m?a.a$(this.position[1]):this.position[1]),M=this.forward();return(b-this.position[2])/M[2]}clone(){return new _k([...this.position],[...this.orientation])}}const Sl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class bk{constructor(d=0,m=0,b=0,M=0){if(isNaN(d)||d<0||isNaN(m)||m<0||isNaN(b)||b<0||isNaN(M)||M<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=m,this.left=b,this.right=M}interpolate(d,m,b){return m.top!=null&&d.top!=null&&(this.top=a.ak(d.top,m.top,b)),m.bottom!=null&&d.bottom!=null&&(this.bottom=a.ak(d.bottom,m.bottom,b)),m.left!=null&&d.left!=null&&(this.left=a.ak(d.left,m.left,b)),m.right!=null&&d.right!=null&&(this.right=a.ak(d.right,m.right,b)),this}getCenter(d,m){const b=a.aA((this.left+d-this.right)/2,0,d),M=a.aA((this.top+m-this.bottom)/2,0,m);return new a.P(b,M)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new bk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Sh=15;class D3{constructor(d,m,b,M,L,D,B){this.tileSize=512,this._renderWorldCopies=L===void 0||L,this._minZoom=d||0,this._maxZoom=m||22,this._minPitch=b??0,this._maxPitch=M??60,this.setProjection(D),this.setMaxBounds(B),this.width=0,this.height=0,this._center=new a.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new bk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new _k,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const d=new D3(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return d._elevation=this._elevation,d._centerAltitude=this._centerAltitude,d._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,d.tileSize=this.tileSize,d.mercatorFromTransition=this.mercatorFromTransition,d.width=this.width,d.height=this.height,d.cameraElevationReference=this.cameraElevationReference,d._center=this._center,d._setZoom(this.zoom),d._seaLevelZoom=this._seaLevelZoom,d.angle=this.angle,d._fov=this._fov,d._pitch=this._pitch,d._nearZ=this._nearZ,d._farZ=this._farZ,d._averageElevation=this._averageElevation,d._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,d._unmodified=this._unmodified,d._edgeInsets=this._edgeInsets.clone(),d._camera=this._camera.clone(),d._calcMatrices(),d.freezeTileCoverage=this.freezeTileCoverage,d.frustumCorners=this.frustumCorners,d._allowWorldUnderZoom=this._allowWorldUnderZoom,d}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||d===Number.NEGATIVE_INFINITY&&(!m||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const b=this._elevation;m||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&b.exaggeration()&&this._centerAltitudeValidForExaggeration!==b.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*b.exaggeration(),this._centerAltitudeValidForExaggeration=b.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=b.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const d=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(d)}sampleAverageElevation(){if(!this._elevation)return 0;const d=this._elevation,m=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],b=this.horizonLineFromTop();let M=0,L=0;for(let D=0;D{const Le=a.cY(oe,le,ce,je,ve);V.has(Le)||(L.push(new a.aQ(le,oe,ce,je,ve)),V.add(Le))};for(let le=0;leoe.canonical.z)continue;const ce=oe.canonical,je=oe.overscaledZ,ve=oe.wrap,Le=1<0,Ze=ce.y+10,xt=oe.wrap-($e?0:1),lt=oe.wrap+(Pe?0:1),ft=$e?ce.x-1:Le-1,ot=Pe?ce.x+1:0;if(D)b[0]<0?(Y(je,lt,ce.z,ot,ce.y),b[1]<0&&Ze&&(Y(je,ve,ce.z,ce.x,ce.y+1),Y(je,lt,ce.z,ot,ce.y+1)),b[1]>0&&qe&&(Y(je,ve,ce.z,ce.x,ce.y-1),Y(je,lt,ce.z,ot,ce.y-1))):b[0]>0?(Y(je,xt,ce.z,ft,ce.y),b[1]<0&&Ze&&(Y(je,ve,ce.z,ce.x,ce.y+1),Y(je,xt,ce.z,ft,ce.y+1)),b[1]>0&&qe&&(Y(je,ve,ce.z,ce.x,ce.y-1),Y(je,xt,ce.z,ft,ce.y-1))):b[1]<0&&Ze?Y(je,ve,ce.z,ce.x,ce.y+1):qe&&Y(je,ve,ce.z,ce.x,ce.y-1);else{const st=oe.visibleQuadrants;1&st&&(Y(je,xt,ce.z,ft,ce.y),qe&&(Y(je,ve,ce.z,ce.x,ce.y-1),Y(je,xt,ce.z,ft,ce.y-1))),2&st&&(Y(je,lt,ce.z,ot,ce.y),qe&&(Y(je,ve,ce.z,ce.x,ce.y-1),Y(je,lt,ce.z,ot,ce.y-1))),4&st&&(Y(je,xt,ce.z,ft,ce.y),Ze&&(Y(je,ve,ce.z,ce.x,ce.y+1),Y(je,xt,ce.z,ft,ce.y+1))),8&st&&(Y(je,lt,ce.z,ot,ce.y),Ze&&(Y(je,ve,ce.z,ce.x,ce.y+1),Y(je,lt,ce.z,ot,ce.y+1)))}}const Q=[];for(const le of L)L.some(oe=>le.isChildOf(oe))||Q.push(le);if(L=Q.filter(le=>!d.some(oe=>!!(le.overscaledZ{const Pe=Le.canonical.x+.5-ce[0],$e=Le.canonical.y+.5-ce[1];return Pe*Pe+$e*$e{const ft=a.cY(Ze,$e,qe,xt,lt);L.has(ft)||(M.push(new a.aQ($e,Ze,qe,xt,lt)),L.add(ft))},B=d.reduce(($e,Ze)=>Math.max($e,Ze.overscaledZ),b),V=1<{const qe=Math.floor($e[0]),xt=Math.floor($e[1]),lt=($e[0]-qe)*a.al,ft=($e[1]-xt)*a.al,ot=Math.floor(Ze[0]),st=Math.floor(Ze[1]),bt=(Ze[0]-ot)*a.al,Ot=(Ze[1]-st)*a.al;for(let Pt=-1;Pt<=1;Pt++){const Vt=qe+Pt;if(!(Vt<0||Vt>=V)){Q.x=lt-Pt*a.al,le.x=bt-(Vt-ot)*a.al;for(let Ht=-1;Ht<=1;Ht++){const sr=xt+Ht;Q.y=ft-Ht*a.al,le.y=Ot-(sr-st)*a.al,a.cZ(Q,le,Y)&&D(B,0,b,Vt,sr)}}}},ce=m.points,je=ce[a.cv],ve=ce[a.cw],Le=this._projectToGround(je,ce[a.cx]),Pe=this._projectToGround(ve,ce[a.cy]);return oe(je,Le),oe(ve,Pe),M}_projectToGround(d,m){return a.cz(a.cA(),d,m,d[2]/(d[2]-m[2]))}coveringTiles(d){let m=this.coveringZoomLevel(d);const b=m,M=this.elevation&&this.elevation.exaggeration(),L=M&&!d.isTerrainDEM,D=this.projection.name==="mercator";if(d.minzoom!==void 0&&md.maxzoom&&(m=d.maxzoom);const B=this.locationCoordinate(this.center),V=this.center.lat,Y=1<{const qt=new a.ae(Mt.x+25e-6,Mt.y,Mt.z),ur=new a.ae(Mt.x,Mt.y+25e-6,Mt.z),Er=Mt.toLngLat(),Gr=qt.toLngLat(),Sr=ur.toLngLat(),wr=this.locationCoordinate(Er),on=this.locationCoordinate(Gr),en=this.locationCoordinate(Sr),$r=Math.hypot(on.x-wr.x,on.y-wr.y),Kr=Math.hypot(en.x-wr.x,en.y-wr.y);return Math.sqrt($r*Kr)*ft/25e-6},st=Mt=>{const Yt=xt,qt=lt;return{aabb:a.cF(this,Y,0,0,0,Mt,qt,Yt,this.projection),zoom:0,x:0,y:0,minZ:qt,maxZ:Yt,wrap:Mt,fullyVisible:!1}},bt=[];let Ot=[];const Pt=m,Vt=d.reparseOverscaled?b:m,Ht=(Le-this._centerAltitude)*ve,sr=Mt=>{if(!this._elevation||!Mt.tileID||!D)return;const Yt=this._elevation.getMinMaxForTile(Mt.tileID),qt=Mt.aabb;Yt?(qt.min[2]=Yt.min,qt.max[2]=Yt.max,qt.center[2]=(qt.min[2]+qt.max[2])/2):(Mt.shouldSplit=zt(Mt),Mt.shouldSplit||(qt.min[2]=qt.max[2]=qt.center[2]=this._centerAltitude))},br=(Mt,Yt)=>{if(.707*Yt{if(Mt.zoom=.9)return!0}else if(L&&(ur=Mt.aabb.distanceZ(Pe)*ve),this.projection.isReprojectedInTileSpace&&b<=5){const Kr=Math.pow(2,Mt.zoom),Nn=ot(new a.ae((Mt.x+.5)/Kr,(Mt.y+.5)/Kr));Er=Nn>.85?1:Nn}if(!D&&!le){const Kr=Math.sqrt(Yt*Yt+qt*qt+ur*ur);let Nn=(1<0;){const Mt=bt.pop(),Yt=Mt.x,qt=Mt.y;let ur=Mt.fullyVisible;const Er=()=>this.projection.name==="globe"&&(Mt.y===0||Mt.y===(1<>1),on={aabb:D?Mt.aabb.quadrant(Gr):a.cF(this,Y,Mt.zoom+1,Sr,wr,Mt.wrap,Mt.minZ,Mt.maxZ,this.projection),zoom:Mt.zoom+1,x:Sr,y:wr,wrap:Mt.wrap,fullyVisible:ur,tileID:void 0,shouldSplit:void 0,minZ:Mt.minZ,maxZ:Mt.maxZ};L&&!le&&(on.tileID=new a.aQ(Mt.zoom+1===Pt?Vt:Mt.zoom+1,Mt.wrap,Mt.zoom+1,Sr,wr),sr(on)),bt.push(on)}else{const Gr=Mt.zoom===Pt?Vt:Mt.zoom;if(d.minzoom&&d.minzoom>Gr)continue;let Sr=0;if(!ur){let $r=$e?Mt.aabb.intersectsPrecise(ce):Mt.aabb.intersectsPreciseFlat(ce);if($r===0&&Er()){const Kr=new a.cD(Mt.zoom,Yt,qt);$r=a.cE(this,Y,Kr,!0).intersectsPrecise(ce)}if($r===0)continue;if(d.calculateQuadrantVisibility)if(ce.containsPoint(Mt.aabb.center))Sr=15;else for(let Kr=0;Kr<4;Kr++)Mt.aabb.quadrant(Kr).intersects(ce)!==0&&(Sr|=1<{const ur=[0,0,0,1],Er=[a.al,a.al,0,1],Gr=this.calculateFogTileMatrix(qt.tileID.toUnwrapped());a.aC(ur,ur,Gr),a.aC(Er,Er,Gr);const Sr=a.cG([],ur,Er),wr=a.cH([],ur,Er),on=a.c$(Sr,wr);if(on===0)return!0;let en=!1;const $r=this._elevation;if($r&&on>Mt&&Yt!==0){const Kr=this.calculateProjMatrix(qt.tileID.toUnwrapped());let Nn;d.isTerrainDEM||(Nn=$r.getMinMaxForTile(qt.tileID)),Nn||(Nn={min:lt,max:xt});const Yn=a.cI(this.rotation),Os=[Yn[0]*a.al,Yn[1]*a.al,Nn.max];a.af(Os,Os,Kr),en=(1-Os[1])*this.height*.5Mt.distanceSq-Yt.distanceSq).map(Mt=>Mt.tileID)}resize(d,m){this.width=d,this.height=m,this.pixelsToGLUnits=[2/d,-2/m],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log2(d)}project(d){const m=a.aA(d.lat,-a.cJ,a.cJ),b=this.projection.project(d.lng,m);return new a.P(b.x*this.worldSize,b.y*this.worldSize)}unproject(d){return this.projection.unproject(d.x/this.worldSize,d.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/a.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,m){let b,M;const L=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;b=(m.x-L.x)/B,M=(m.y-L.y)/B}else{const B=this.pointCoordinate(m),V=this.pointCoordinate(L);b=B.x-V.x,M=B.y-V.y}const D=this.locationCoordinate(d);this.setLocation(new a.ae(D.x-b,D.y-M))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,m){return this.projection.locationPoint(this,d,m)}locationPoint3D(d,m){return this.projection.locationPoint(this,d,m,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,m){return this.coordinateLocation(this.pointCoordinate3D(d,m))}locationCoordinate(d,m){const b=m?a.cf(m,d.lat):void 0,M=this.projection.project(d.lng,d.lat);return new a.ae(M.x,M.y,b)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,m){const b=m??this._centerAltitude,M=[d.x,d.y,0,1],L=[d.x,d.y,1,1];a.aC(M,M,this.pixelMatrixInverse),a.aC(L,L,this.pixelMatrixInverse);const D=L[3];a.cK(M,M,1/M[3]),a.cK(L,L,1/D);const B=M[2],V=L[2];return{p0:M,p1:L,t:B===V?0:(b-B)/(V-B)}}screenPointToMercatorRay(d){const m=[d.x,d.y,0,1],b=[d.x,d.y,1,1];return a.aC(m,m,this.pixelMatrixInverse),a.aC(b,b,this.pixelMatrixInverse),a.cK(m,m,1/m[3]),a.cK(b,b,1/b[3]),m[2]=a.cf(m[2],this._center.lat)*this.worldSize,b[2]=a.cf(b[2],this._center.lat)*this.worldSize,a.cK(m,m,1/this.worldSize),a.cK(b,b,1/this.worldSize),new a.ax([m[0],m[1],m[2]],a.aw([],a.av([],b,m)))}rayIntersectionCoordinate(d){const{p0:m,p1:b,t:M}=d,L=a.cf(m[2],this._center.lat),D=a.cf(b[2],this._center.lat);return new a.ae(a.ak(m[0],b[0],M)/this.worldSize,a.ak(m[1],b[1],M)/this.worldSize,a.ak(L,D,M))}pointCoordinate(d,m=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,m)}pointCoordinate3D(d,m){if(!this.elevation)return this.pointCoordinate(d,m);let b=this.projection.pointCoordinate3D(this,d.x,d.y);if(b)return new a.ae(b[0],b[1],b[2]);let M=0,L=this.horizonLineFromTop();if(d.y>L)return this.pointCoordinate(d,m);const D=.02*L,B=d.clone();for(let V=0;V<10&&L-M>D;V++){B.y=a.ak(M,L,.66);const Y=this.projection.pointCoordinate3D(this,B.x,B.y);Y?(L=B.y,b=Y):M=B.y}return b?new a.ae(b[0],b[1],b[2]):this.pointCoordinate(d)}isPointAboveHorizon(d){return this.projection.isPointAboveHorizon(this,d)}isPointOnSurface(d){if(d.y<0||d.y>this.height||d.x<0||d.x>this.width)return!1;if(this.elevation||this.zoom>=a.cL)return!this.isPointAboveHorizon(d);const m=this.pointCoordinate(d);return m.y>=0&&m.y<=1}_coordinatePoint(d,m){const b=m&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,M=[d.x*this.worldSize,d.y*this.worldSize,b+d.toAltitude(),1];return a.aC(M,M,this.pixelMatrix),M[3]>0?new a.P(M[0]/M[3],M[1]/M[3]):new a.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:m}=this._edgeInsets,b=this.height-this._edgeInsets.bottom,M=this.width-this._edgeInsets.right,L=this.pointLocation3D(new a.P(m,d)),D=this.pointLocation3D(new a.P(M,d)),B=this.pointLocation3D(new a.P(M,b)),V=this.pointLocation3D(new a.P(m,b));let Y=Math.min(L.lng,D.lng,B.lng,V.lng),Q=Math.max(L.lng,D.lng,B.lng,V.lng),le=Math.min(L.lat,D.lat,B.lat,V.lat),oe=Math.max(L.lat,D.lat,B.lat,V.lat);const ce=Math.pow(2,-this.zoom)/16*270,je=this.projection.name==="globe"?1:4,ve=(Le,Pe,$e,Ze,qe)=>{const xt=(Le+$e)/2,lt=(Pe+Ze)/2,ft=new a.P(xt,lt),{lng:ot,lat:st}=this.pointLocation3D(ft),bt=Math.max(0,Y-ot,le-st,ot-Q,st-oe);Y=Math.min(Y,ot),Q=Math.max(Q,ot),le=Math.min(le,st),oe=Math.max(oe,st),(qece)&&(ve(Le,Pe,xt,lt,qe+1),ve(xt,lt,$e,Ze,qe+1))};if(ve(m,d,M,d,1),ve(M,d,M,b,1),ve(M,b,m,b,1),ve(m,b,m,d,1),this.projection.name==="globe"){const[Le,Pe]=a.cM(this);Le?(oe=90,Q=180,Y=-180):Pe&&(le=-90,Q=180,Y=-180)}return new a.aI(new a.aT(Y,le),new a.aT(Q,oe))}_getBoundsRectangular(d,m){const{top:b,left:M}=this._edgeInsets,L=this.height-this._edgeInsets.bottom,D=this.width-this._edgeInsets.right,B=new a.P(M,b),V=new a.P(D,b),Y=new a.P(D,L),Q=new a.P(M,L);let le=this.pointCoordinate(B,d),oe=this.pointCoordinate(V,d);const ce=this.pointCoordinate(Y,m),je=this.pointCoordinate(Q,m),ve=(Le,Pe)=>(Pe.y-Le.y)/(Pe.x-Le.x);return le.y>1&&oe.y>=0?le=new a.ae((1-je.y)/ve(je,le)+je.x,1):le.y<0&&oe.y<=1&&(le=new a.ae(-je.y/ve(je,le)+je.x,0)),oe.y>1&&le.y>=0?oe=new a.ae((1-ce.y)/ve(ce,oe)+ce.x,1):oe.y<0&&le.y<=1&&(oe=new a.ae(-ce.y/ve(ce,oe)+ce.x,0)),new a.aI().extend(this.coordinateLocation(le)).extend(this.coordinateLocation(oe)).extend(this.coordinateLocation(je)).extend(this.coordinateLocation(ce))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const m=d.visibleDemTiles.reduce((b,M)=>{if(M.dem){const L=M.dem.tree;b.min=Math.min(b.min,L.minimums[0]),b.max=Math.max(b.max,L.maximums[0])}return b},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(m.min*d.exaggeration(),m.max*d.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(d=!0){const m=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,b=this.height/2-m*(1-this._horizonShift);return d?Math.max(0,b):b}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-a.cJ,this.maxLat=a.cJ,this.minLng=-180,this.maxLng=180,d&&(this.minLat=d.getSouth(),this.maxLat=d.getNorth(),this.minLng=d.getWest(),this.maxLng=d.getEast(),this.maxLngle&&(B=le-Y),le-Qce&&(D=ce-V),ce-oe{for(let zt=0;zt<16;zt++)Vt[zt]=a.ak(Ht[zt],sr[zt],br)})(B,B,V,a.d0(this.pitch>=Sh?1:this.pitch/Sh))}else B=V;const Y=a.cP([],V,D);let Q=a.cP([],B,D);if(this.projection.isReprojectedInTileSpace){const st=this.locationCoordinate(this.center),bt=a.bA([]);a.br(bt,bt,[st.x*this.worldSize,st.y*this.worldSize,0]),a.aB(bt,bt,a.cQ(this)),a.br(bt,bt,[-st.x*this.worldSize,-st.y*this.worldSize,0]),a.aB(Q,Q,bt),a.aB(Y,Y,bt),this.inverseAdjustmentMatrix=a.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=a.cS([],Q,[this.worldSize,this.worldSize,this.worldSize/L,1]),this.projMatrix=Q,this.invProjMatrix=a.bl(new Float64Array(16),this.projMatrix),m){const st=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);st[8]=2*-d.x/this.width,st[9]=2*d.y/this.height,this.expandedFarZProjMatrix=a.cP([],st,D)}else this.expandedFarZProjMatrix=this.projMatrix;const le=a.bl([],B);this.frustumCorners=a.cT.fromInvProjectionMatrix(le,this.horizonLineFromTop(),this.height),this.cameraFrustum=a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!m);const oe=new Float32Array(16);a.bA(oe),a.cS(oe,oe,[1,-1,1]),a.cU(oe,oe,this._pitch),a.bB(oe,oe,this.angle);const ce=a.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=a.bz(ce);const je=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;ce[8]=2*-d.x/this.width,ce[9]=2*(d.y+je)/this.height,this.skyboxMatrix=a.aB(oe,ce,oe);const ve=this.point,Le=ve.x,Pe=ve.y,$e=this.width%2/2,Ze=this.height%2/2,qe=Math.cos(this.angle),xt=Math.sin(this.angle),lt=Le-Math.round(Le)+qe*$e+xt*Ze,ft=Pe-Math.round(Pe)+qe*Ze+xt*$e,ot=new Float64Array(Q);if(a.br(ot,ot,[lt>.5?lt-1:lt,ft>.5?ft-1:ft,0]),this.alignedProjMatrix=ot,Q=a.bC(),a.cS(Q,Q,[this.width/2,-this.height/2,1]),a.br(Q,Q,[1,-1,0]),this.labelPlaneMatrix=Q,Q=a.bC(),a.cS(Q,Q,[1,-1,1]),a.br(Q,Q,[-1,-1,0]),a.cS(Q,Q,[2/this.width,2/this.height,1]),this.glCoordMatrix=Q,this.pixelMatrix=a.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},Q=a.bl(new Float64Array(16),this.pixelMatrix),!Q)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=Q,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.cV(this);const st=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.af(st,st,D),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=Q;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,m=this.cameraPixelsPerMeter,b=this._camera.position,M=1/this.height/this._pixelsPerMercatorPixel,L=[d,d,m];a.c5(L,L,M),a.c5(b,b,-1),a.cW(b,b,L);const D=a.bC();a.br(D,D,b),a.cS(D,D,L),this.mercatorFogMatrix=D,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,m,M)}_computeCameraPosition(d){const m=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,b=this._camera.forward(),M=this.point,L=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-d/this.worldSize*this._centerAltitude;return[M.x/this.worldSize-b[0]*L,M.y/this.worldSize-b[1]*L,d/this.worldSize*this._centerAltitude-b[2]*L]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const m=this._maxCameraBoundsDistance()*Math.cos(this._pitch),b=this._camera.position[2],M=d[2];let L=1;this.projection.wrap&&(this.center=this.center.wrap()),M>0&&(L=Math.min((m-b)/M,1)),this._camera.position=a.bH([],this._camera.position,d,L),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,m=this._camera.forward(),{pitch:b,bearing:M}=this._camera.getPitchBearing(),L=a.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,D=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.an(this._maxPitch)),B=Math.max((d[2]-L)/Math.cos(b),D),V=this._zoomFromMercatorZ(B);a.bH(d,d,m,B),this._pitch=a.aA(b,a.an(this.minPitch),a.an(this.maxPitch)),this.angle=a.bT(M,-Math.PI,Math.PI),this._setZoom(a.aA(V,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.ae(d[0],d[1],d[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(d){return Math.pow(2,d)*this.tileSize}_mercatorZfromZoom(d){return this.cameraToCenterDistance/this._worldSizeFromZoom(d)}_minimumHeightOverTerrain(){const d=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(d)}_zoomFromMercatorZ(d){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,d)*this.tileSize))}zoomFromMercatorZAdjusted(d){let m=0,b=a.cL,M=0,L=1/0;for(;b-m>1e-6&&b>m;){const D=m+.5*(b-m),B=this.tileSize*Math.pow(2,D),V=this.getCameraToCenterDistance(this.projection,D,B),Y=this.scaleZoom(V/(Math.max(0,d)*this.tileSize)),Q=Math.abs(D-Y);QY||oe.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.P(0,0),new a.P(this.width,this.height))}zoomDeltaToMovement(d,m){const b=a.ag(a.av([],this._camera.position,d)),M=this._zoomFromMercatorZ(b)+m;return b-this._mercatorZfromZoom(M)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([m,b,M],L){const D=[m,b,M,1];a.aC(D,D,L);const B=D[3]=Math.max(D[3],1e-6);return D[0]/=B,D[1]/=B,D[2]/=B,D}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,d))}}getCameraToCenterDistance(d,m=this.zoom,b=this.worldSize){const M=a.cO(d,m,this.width,this.height,1024),L=d.pixelSpaceConversion(this.center.lat,b,M);let D=.5/Math.tan(.5*this._fov)*this.height*L;return this.isOrthographic&&(D=a.ak(1,D,a.d0(this.pitch>=Sh?1:this.pitch/Sh))),D}getWorldToCameraMatrix(){const d=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&a.aB(d,d,this.globeMatrix),d}getFrustum(d){return a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d,this.projection.zAxisUnit==="meters")}}const Pm=(_,d)=>{if(d>0&&_.terrain&&a.w("Cutoff is currently disabled on terrain"),d<=0||_.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const m=_.transform,b=Math.max(Math.abs(m._zoom-(_.minCutoffZoom-1)),1),M=m.isLODDisabled(!1)?a.ah(60,45,m.pitch):a.ah(30,15,m.pitch),L=m._farZ-m._nearZ,D=d*m.height,B=((1-(V=M))*m.cameraToCenterDistance+V*(m._farZ+D))*b;var V;return{shouldRenderCutoff:M<1,uniformValues:{u_cutoff_params:[m._nearZ,m._farZ,(B-m._nearZ)/L,(B-D-m._nearZ)/L]}}},Zu=2048;class vv{constructor(d,m){this.aabb=d,this.lastCascade=m}}class Wie{add(d,m){const b=this.receivers[d.key];b!==void 0?(b.aabb.min[0]=Math.min(b.aabb.min[0],m.min[0]),b.aabb.min[1]=Math.min(b.aabb.min[1],m.min[1]),b.aabb.min[2]=Math.min(b.aabb.min[2],m.min[2]),b.aabb.max[0]=Math.max(b.aabb.max[0],m.max[0]),b.aabb.max[1]=Math.max(b.aabb.max[1],m.max[1]),b.aabb.max[2]=Math.max(b.aabb.max[2],m.max[2])):this.receivers[d.key]=new vv(m,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,m,b){const M=a.d9.fromPoints(d.points);let L=0;for(const D in this.receivers){const B=this.receivers[D];if(!B||!M.intersectsAabb(B.aabb))continue;B.aabb.min=M.closestPoint(B.aabb.min),B.aabb.max=M.closestPoint(B.aabb.max);const V=B.aabb.getCorners();for(let Y=0;Y1||oe[1]<-1||oe[1]>1){Q=!1;break}}if(B.lastCascade=Y,L=Math.max(L,Y),Q)break}}return L+1}}class ky{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Wie,this._depthMode=new un(d.context.gl.LEQUAL,un.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const d of this._cascades)d.texture.destroy(),d.framebuffer.destroy();this._cascades=[]}updateShadowParameters(d,m){const b=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!m||!m.properties)return;const M=m.properties.get("shadow-intensity");if(!m.shadowsEnabled()||M<=0||(this._shadowLayerCount=b.style.order.reduce((je,ve)=>{const Le=b.style._mergedLayers[ve];return je+(Le.hasShadowPass()&&!Le.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const L=b.context,D=Zu,B=Zu;if(this._cascades.length===0||Zu!==this._cascades[0].texture.size[0]){this._cascades=[];for(let je=0;je<2;++je){const ve=b._shadowMapDebug,Le=L.gl,Pe=L.createFramebuffer(D,B,ve?1:0,"texture"),$e=new a.T(L,{width:D,height:B,data:null},Le.DEPTH_COMPONENT16);if(Pe.depthAttachment.set($e.texture),ve){const Ze=new a.T(L,{width:D,height:B,data:null},Le.RGBA8);Pe.colorAttachment0.set(Ze.texture)}this._cascades.push({framebuffer:Pe,texture:$e,matrix:[],far:0,boundingSphereRadius:0,frustum:new a.cB,scale:0})}}this.shadowDirection=bv(m);let V=0;if(d.elevation){const je=d.elevation,ve=[1e4,-1e4];je.visibleDemTiles.filter(Le=>Le.dem).forEach(Le=>{const Pe=Le.dem.tree;ve[0]=Math.min(ve[0],Pe.minimums[0]),ve[1]=Math.max(ve[1],Pe.maximums[0])}),ve[0]!==1e4&&(V=(ve[1]-ve[0])*je.exaggeration())}const Y=1.5*d.cameraToCenterDistance,Q=3*Y,le=new Float64Array(16);for(let je=0;je=0)return{};const L=function(V,Y,Q){const le=Q/(1<0&&(a.d8(L[1],L[1],[M[0]*D,0,0]),a.d8(L[2],L[2],[M[0]*D,0,0])),M[1]<0?(a.d8(L[0],L[0],[0,M[1]*D,0]),a.d8(L[1],L[1],[0,M[1]*D,0])):M[1]>0&&(a.d8(L[2],L[2],[0,M[1]*D,0]),a.d8(L[3],L[3],[0,M[1]*D,0]));const B={};return B.vertices=L,B.planes=[_v(L[1],L[0],L[4]),_v(L[2],L[1],L[5]),_v(L[3],L[2],L[6]),_v(L[0],L[3],L[7])],B}addShadowReceiver(d,m,b){this._receivers.add(d,a.d9.fromTileIdAndHeight(d,m,b))}getMaxCascadeForTile(d){const m=this._receivers.get(d);return m&&m.lastCascade?m.lastCascade:0}}function _v(_,d,m){const b=a.av([],m,d),M=a.av([],_,d),L=a.bI([],b,M),D=a.ag(L);return D===0?[0,0,1,0]:(a.c5(L,L,1/D),[L[0],L[1],L[2],-a.bJ(L,d)])}function bv(_){const d=_.properties.get("direction"),m=a.d4(d.x,d.y,d.z);m[2]=a.aA(m[2],0,75);const b=a.d6([m[0],m[1],m[2]]);return a.d5(b.x,b.y,b.z)}function yp(_,d,m){const b=d.properties.get("color-use-theme")==="none",M=d.properties.get("color"),L=d.properties.get("intensity"),D=d.properties.get("direction"),B=[D.x,D.y,D.z],V=m.properties.get("color-use-theme")==="none",Y=m.properties.get("color"),Q=m.properties.get("intensity"),le=Math.max(a.bJ([0,0,1],B),0),oe=[0,0,0];a.c5(oe,Y.toPremultipliedRenderColor(V?null:_.getLut(d.scope)).toArray01Linear().slice(0,3),Q);const ce=[0,0,0];return a.c5(ce,M.toPremultipliedRenderColor(b?null:_.getLut(m.scope)).toArray01Linear().slice(0,3),le*L),a.db([oe[0]>0?oe[0]/(oe[0]+ce[0]):0,oe[1]>0?oe[1]/(oe[1]+ce[1]):0,oe[2]>0?oe[2]/(oe[2]+ce[2]):0])}function Lm(_,d,m,b,M,L){const D=_.zoom,B=_.scale,V=_.worldSize,Y=1/V,Q=_.aspect,le=Math.sqrt(1+Q*Q)*Math.tan(.5*_.fovX),oe=le*le,ce=b-m,je=b+m;let ve,Le;oe>ce/je?(ve=b,Le=b*le):(ve=.5*je*(1+oe),Le=.5*Math.sqrt(ce*ce+2*(b*b+m*m)*oe+je*je*oe*oe));const Pe=_.projection.pixelsPerMeter(_.center.lat,V),$e=_._camera.getCameraToWorldMercator(),Ze=[0,0,-ve*Y];a.af(Ze,Ze,$e);let qe=Le*Y;const xt=_._edgeInsets;if(!(xt.left===0&&xt.top===0&&xt.right===0&&xt.bottom===0||xt.left===xt.right&&xt.top===xt.bottom)){const ur=_._camera.getWorldToCamera(_.worldSize,_.projection.zAxisUnit==="meters"?Pe:1),Er=_._camera.getCameraToClipPerspective(_._fov,_.width/_.height,m,b);Er[8]=2*-_.centerOffset.x/_.width,Er[9]=2*_.centerOffset.y/_.height;const Gr=new Float64Array(16);a.cP(Gr,Er,ur);const Sr=new Float64Array(16);a.bl(Sr,Gr);const wr=a.cB.fromInvProjectionMatrix(Sr,V,D,!0);for(const on of wr.points){const en=((lt=on)[0]/=B,lt[1]/=B,lt[2]=a.cf(lt[2],_._center.lat),lt);qe=Math.max(qe,a.c6(a.da([],Ze,en)))}}var lt;qe*=M/(M-1);const ft=Math.acos(d[2]),ot=Math.atan2(-d[0],-d[1]),st=new _k;st.position=Ze,st.setPitchBearing(ft,ot);const bt=st.getWorldToCamera(V,Pe),Ot=qe*V,Pt=Math.min(_._mercatorZfromZoom(17)*V*-2,-2*Ot),Vt=st.getCameraToClipOrthographic(-Ot,Ot,-Ot,Ot,Pt,(Ot+L*Pe)/d[2]),Ht=new Float64Array(16);a.aB(Ht,Vt,bt);const sr=a.d5(Math.floor(1e6*Ze[0])/1e6*V,Math.floor(1e6*Ze[1])/1e6*V,0),br=.5*M,zt=[0,0,0];a.af(zt,sr,Ht),a.c5(zt,zt,br);const Mt=[Math.floor(zt[0]),Math.floor(zt[1]),Math.floor(zt[2])],Yt=[0,0,0];a.av(Yt,zt,Mt),a.c5(Yt,Yt,-1/br);const qt=new Float64Array(16);return a.bA(qt),a.br(qt,qt,Yt),a.aB(Ht,qt,Ht),[Ht,Ot]}class Gie extends a.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,m){return a.dc(this.requestManager.transformRequest(m,a.R.Model).url).then(b=>{if(!b)return;const M=a.dd(b),L=new a.de(d,m,void 0,void 0,M);return L.computeBoundsAndApplyParent(),L}).catch(b=>{if(b&&b.status===404)return null;this.fire(new a.y(new Error(`Could not load model ${d} from ${m}: ${b.message}`)))})}load(d,m,b={forceReload:!1}){this.models[m]||(this.models[m]={});const M=Object.keys(d),L=[],D=[];for(const B of M){const V=d[B];this.hasURLBeenRequested(V)&&!b.forceReload||(this.modelByURL[V]={modelId:B,scope:m},L.push(this.loadModel(B,V)),D.push(B)),this.models[m][B]||(this.models[m][B]={model:null,numReferences:1})}this.numModelsLoading[m]=(this.numModelsLoading[m]||0)+D.length,Promise.allSettled(L).then(B=>{for(let V=0;V{this.fire(new a.y(new Error(`Could not load models: ${B.message}`)))})}isLoaded(){for(const d in this.numModelsLoading)if(this.numModelsLoading[d]>0)return!1;return!0}hasModel(d,m,b={exactIdMatch:!1}){return!!(b.exactIdMatch?this.getModel(d,m):this.getModelByURL(this.modelUris[m][d]))}getModel(d,m){return this.models[m]||(this.models[m]={}),this.models[m][d]?this.models[m][d].model:void 0}getModelByURL(d){if(!d)return null;const m=this.modelByURL[d];return m?this.models[m.scope][m.modelId].model:null}hasModelBeenAdded(d,m){return this.models[m]&&this.models[m][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,m,b){this.models[b]||(this.models[b]={}),this.modelUris[b]||(this.modelUris[b]={});const M=this.requestManager.normalizeModelURL(m);if((this.hasModel(d,b,{exactIdMatch:!0})||this.hasModelBeenAdded(d,b))&&this.modelUris[b][d]===M)this.models[b][d].numReferences++;else if(this.hasURLBeenRequested(M)){const{scope:L,modelId:D}=this.modelByURL[M];this.models[L][D].numReferences++}else this.modelUris[b][d]=M,this.load({[d]:this.modelUris[b][d]},b)}addModelURLs(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const b=this.modelUris[m];for(const M in d)b[M]=this.requestManager.normalizeModelURL(d[M])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const b={};for(const M of d)this.hasModel(M,m,{exactIdMatch:!0})||this.hasURLBeenRequested(M)?this.models[m][M].numReferences++:this.modelUris[m][M]&&!this.hasURLBeenRequested(M)?b[M]=this.modelUris[m][M]:!this.hasURLBeenRequested(M)&&a.df(M,!1)&&(this.modelUris[m][M]=this.requestManager.normalizeModelURL(M),b[M]=this.modelUris[m][M]);this.load(b,m)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,m,b=!1,M=!1){if(this.models[m]&&this.models[m][d]&&(this.models[m][d].numReferences--,this.models[m][d].numReferences===0||M)){const L=this.modelUris[m][d];b||delete this.modelUris[m][d],delete this.modelByURL[L];const D=this.models[m][d].model;if(!D)return;delete this.models[m][d],D.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const m of Object.keys(this.models[d])){const b=this.models[d][m].model;delete this.models[d][m],b&&b.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(d){return this.models[d]||(this.models[d]={}),Object.keys(this.models[d])}upload(d,m){this.models[m]||(this.models[m]={});for(const b in this.models[m])this.models[m][b].model&&this.models[m][b].model.upload(d.context)}}const R3=a.a6.colorTheme,Kie=new a.a9({data:new a.aa(R3.data)});function GI(_){if(!_.metadata||!_.metadata.content_area)return;const d=a.o.devicePixelRatio,{left:m,top:b,width:M,height:L}=_.metadata.content_area,D=m*d,B=b*d;return[D,B,D+M*d,B+L*d]}function KI(_){if(_)return _.map(([d,m])=>[d*a.o.devicePixelRatio,m*a.o.devicePixelRatio])}class F3{constructor(d,m,b){this.id=d,this.scope=m,this.sourceCache=b,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(d){this.missingRequests.has(d.name)||this.pendingRequests.has(d.name)||this.pendingRequests.add(d.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const d=new Map;if(!this.sourceCache.loaded())return d;const m=this.sourceCache.getVisibleCoordinates();if(m.length===0)return d;const b=this.sourceCache.getSource();if(!(b instanceof sl))return d;const M=m.map(D=>this.sourceCache.getTile(D)),L=b.getImages(M,Array.from(this.pendingRequests));for(const[D,B]of L)d.set(a.I.from({name:D,iconsetId:this.id}),B),this.pendingRequests.delete(D);for(const D of this.pendingRequests)this.missingRequests.add(D);return this.pendingRequests.clear(),d}}const Om=(_,d)=>Ge(_,d&&d.filter(m=>m.identifier!=="source.canvas")),ZI=a.aH(dr,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),YI=a.aH(dr,["setCenter","setZoom","setBearing","setPitch"]),wk=new Set(["background","sky","slot","custom"]),Dm={version:8,layers:[],sources:{}},wv={duration:300,delay:0};class Yu extends a.E{constructor(d,m={}){super(),this.map=d,this.scope=m.scope||"",this.globalId=null,this.fragments=[],this.importDepth=m.importDepth||0,this.importsCache=m.importsCache||new Map,this.resolvedImports=m.resolvedImports||new Set,this.transition=Object.assign({},wv),this._buildingIndex=new M3(this),this.crossTileSymbolIndex=new Nh,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=m.styleChanges||new Ae,this._hasDataDrivenEmissive=!1,this.dispatcher=m.dispatcher?m.dispatcher:new a.D(a.dh(),this),m.imageManager?this.imageManager=m.imageManager:(this.imageManager=new Be(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=m.glyphManager?m.glyphManager:new a.di(d._requestManager,m.localFontFamily?a.dj.all:m.localIdeographFontFamily?a.dj.ideographs:a.dj.none,m.localFontFamily||m.localIdeographFontFamily),m.modelManager?this.modelManager=m.modelManager:(this.modelManager=new Gie(d._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=m.configOptions?m.configOptions:new Map,this._configDependentLayers=m.configDependentLayers?m.configDependentLayers:new Set,this._indoorDependentLayers=m.indoorDependentLayers?m.indoorDependentLayers:new Set,this._config=m.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:m.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=m.initialConfig,this.dispatcher.broadcast("setReferrer",a.dk());const b=this;this._rtlTextPluginCallback=Yu.registerForPluginStateChange(M=>{b.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:M.pluginStatus,pluginURL:M.pluginURL},(L,D)=>{if(a.dl(L),D&&D.every(B=>B))for(const B in b._sourceCaches){const V=b._sourceCaches[B],Y=V.getSource().type;Y!=="vector"&&Y!=="geojson"||V.reload()}})}),this.on("data",M=>{if(M.dataType!=="source"||M.sourceDataType!=="metadata")return;const L=this.getOwnSource(M.sourceId);if(L&&L.vectorLayerIds)for(const D in this._layers){const B=this._layers[D];B.source===L.id&&this._validateLayer(B)}})}load(d){return d?(typeof d=="string"?this.loadURL(d):this.loadJSON(d),this):this}_getGlobalId(d){if(!d)return null;if(typeof d=="string"){if(a.h(d))return d;const m=a.dm(d);if(!m.startsWith("http"))try{return new URL(m,location.href).toString()}catch{return m}return m}return`json://${a.dn(JSON.stringify(d))}`}_diffStyle(d,m,b){this.globalId=this._getGlobalId(d);const M=(L,D)=>{try{D(null,this.setState(L,b))}catch(B){D(B,!1)}};if(typeof d=="string"){const L=this.map._requestManager.normalizeStyleURL(d),D=this.map._requestManager.transformRequest(L,a.R.Style);a.m(D,(B,V)=>{B?this.fire(new a.y(B)):V&&M(V,m)})}else typeof d=="object"&&M(d,m)}loadURL(d,m={}){this.fire(new a.z("dataloading",{dataType:"style"}));const b=typeof m.validate=="boolean"?m.validate:!a.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,m.accessToken),this.resolvedImports.add(d);const M=this.importsCache.get(d);if(M)return this._load(M,b);const L=this.map._requestManager.transformRequest(d,a.R.Style);this._request=a.m(L,(D,B)=>{if(this._request=null,D)this.fire(new a.y(D));else if(B)return this.importsCache.set(d,B),this._load(B,b)})}loadJSON(d,m={}){this.fire(new a.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=a.o.frame(()=>{this._request=null,this._load(d,m.validate!==!1)})}loadEmpty(){this.fire(new a.z("dataloading",{dataType:"style"})),this._load(Dm,!1)}_loadImports(d,m,b){if(this.importDepth>=4)return a.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const M=[];for(const L of d){const D=this._createFragmentStyle(L),B=new Promise(Q=>{D.once("style.import.load",Q),D.once("error",Q)}).then(()=>this.mergeAll());if(M.push(B),this.resolvedImports.has(L.url)){D.loadEmpty();continue}const V=L.data||this.importsCache.get(L.url);V?(D.loadJSON(V,{validate:m}),this._isInternalStyle(V)&&(D.globalId=null)):L.url?D.loadURL(L.url,{validate:m}):D.loadEmpty();const Y={style:D,id:L.id,config:L.config};if(b){const Q=this.fragments.findIndex(({id:le})=>le===b);this.fragments=this.fragments.slice(0,Q).concat(Y).concat(this.fragments.slice(Q))}else this.fragments.push(Y)}return Promise.allSettled(M)}getImportGlobalIds(d=this,m=new Set){for(const b of d.fragments)b.style.globalId&&m.add(b.style.globalId),this.getImportGlobalIds(b.style,m);return[...m.values()]}_createFragmentStyle(d){const m=this.scope?a.B(d.id,this.scope):d.id;let b;const M=this._initialConfig&&this._initialConfig[m];(d.config||M)&&(b=Object.assign({},d.config,M));const L=new Yu(this.map,{scope:m,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:b,configOptions:this.options,colorThemeOverride:d["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return L.setEventedParent(this.map,{style:L}),L}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(d){return this.isRootStyle()&&(d.fragment||!!d.schema&&d.fragment!==!1)}_load(d,m){if(this._isInternalStyle(d)){const L=Object.assign({},Dm,{imports:[{id:"basemap",data:d,url:""}]},d.center?{center:d.center}:{},d.bearing?{bearing:d.bearing}:{},d.pitch?{pitch:d.pitch}:{},d.zoom?{zoom:d.zoom}:{},d.light?{light:d.light}:{});return this._importedAsBasemap=!0,void this._load(L,m)}if(this.updateConfig(this._config,d.schema),m&&Om(this,Ii(d)))return;this._loaded=!0,this.stylesheet=a.dp(d);const b=()=>{for(const V in d.sources)this.addSource(V,d.sources[V],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const V in d.iconsets)this.addIconset(V,d.iconsets[V]);d.sprite?this._loadIconset(d.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&d.glyphs&&this.glyphManager.setURL(d.glyphs);const L=Cr(this.stylesheet.layers);if(this._order=L.map(V=>V.id),this.stylesheet.light&&a.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const V=this.stylesheet.lights[0];this.light=new At(V.properties,V.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new At(this.stylesheet.light)),this._layers={};for(const V of L){const Y=a.du(V,this.scope,this._styleColorTheme.lut,this.options);Y.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(Y.fqid),Y.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(Y.fqid),this._hasAppearances=this._hasAppearances||Y.getAppearances().length!==0,Y.setEventedParent(this,{layer:{id:Y.id}}),this._layers[Y.id]=Y;const Q=this.getOwnLayerSourceCache(Y),le=!!this.directionalLight&&this.directionalLight.shadowsEnabled();Q&&Y.canCastShadows()&&le&&(Q.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const D=this.stylesheet.terrain;D&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(D,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new a.z("data",{dataType:"style"}));const B=this.isRootStyle();d.imports?this._loadImports(d.imports,m).then(()=>{this._reloadImports(),this.fire(new a.z(B?"style.load":"style.import.load"))}).catch(V=>{this.fire(new a.y(new Error("Failed to load imports",V))),this.fire(new a.z(B?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new a.z(B?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const M=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(M){const L=this._evaluateColorThemeData(M);this._loadColorTheme(L).then(()=>{b()}).catch(D=>{a.w(`Couldn't load color theme from the stylesheet: ${D}`),b()})}else this._styleColorTheme.lut=null,b()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,m,b,M,L,D,B,V,Y,Q;const le={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(oe=>{if(oe.stylesheet){if(oe.light!=null&&(d=oe.light),oe.stylesheet.lights)for(const ce of oe.stylesheet.lights)ce.type==="ambient"&&oe.ambientLight!=null&&(m=oe.ambientLight),ce.type==="directional"&&oe.directionalLight!=null&&(b=oe.directionalLight);M=this._prioritizeTerrain(M,oe.terrain,oe.stylesheet.terrain),oe.stylesheet.fog&&oe.fog!=null&&(L=oe.fog),oe.stylesheet.snow&&oe.snow!=null&&(D=oe.snow),oe.stylesheet.rain&&oe.rain!=null&&(B=oe.rain),oe.stylesheet.camera!=null&&(Q=oe.stylesheet.camera),oe.stylesheet.projection!=null&&(V=oe.stylesheet.projection),oe.stylesheet.transition!=null&&(Y=oe.stylesheet.transition),le[oe.scope]=oe._styleColorTheme}}),this.light=d,this.ambientLight=m,this.directionalLight=b,this.fog=L,this.snow=D,this.rain=B,this._styleColorThemeForScope=le,M===null?delete this.terrain:this.terrain=M,this.camera=Q||{"camera-projection":"perspective"},this.projection=V||{name:"mercator"},this.transition=Object.assign({},wv,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const m=b=>{for(const M of b.fragments)m(M.style);d(b)};m(this)}_prioritizeTerrain(d,m,b){const M=d&&d.drapeRenderMode===0;return b===null?m&&m.drapeRenderMode===0?m:M?d:null:m!=null&&(!d||M||m&&m.drapeRenderMode===1)?m:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(m=>{d=this._prioritizeTerrain(d,m.terrain,m.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(m=>{m.stylesheet.projection!=null&&(d=m.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},m={},b={};this.forEachFragmentStyle(M=>{for(const L in M._sourceCaches){const D=a.B(L,M.scope);d[D]=M._sourceCaches[L]}for(const L in M._otherSourceCaches){const D=a.B(L,M.scope);m[D]=M._otherSourceCaches[L]}for(const L in M._symbolSourceCaches){const D=a.B(L,M.scope);b[D]=M._symbolSourceCaches[L]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=m,this._mergedSymbolSourceCaches=b}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const m of Object.values(d.stylesheet.indoor)){const b=m,M=a.B(b.sourceId,d.scope);this._mergedIndoor[M]=new Set(b.sourceLayers||[])}})}mergeLayers(){const d={},m=[],b={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(D=>{for(const B of D._order){const V=D._layers[B];if(V.type==="slot"){const Y=a.dq(B);if(d[Y])continue;d[Y]=[]}V.slot&&d[V.slot]?d[V.slot].push(V):m.push(V)}}),this._mergedOrder=[];let M=-1;const L=(D=[])=>{for(const B of D)if(B.type==="slot"){const V=a.dq(B.id);d[V]&&L(d[V]),this._mergedSlots.push(V)}else{const V=a.B(B.id,B.scope);this._mergedOrder.push(V),b[V]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,M=this._mergedOrder.length-1),B.type==="circle"&&(this._hasCircleLayers=!0),B.type==="symbol"&&(this._hasSymbolLayers=!0),B.type==="clip"&&(this._clipLayerPresent=!0)}};if(L(m),this._has3DLayers){const D={};for(let B=0;BD[B]-D[V])}this._mergedLayers=b,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(d){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,d),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(d){return d.data?function(m,b,M,L){const D=Object.assign({},b);for(const V of Object.keys(R3))D[V]===void 0&&(D[V]=R3[V].default);const B=new a.a8(Kie,m,new Map(M));return B.setTransitionOrValue(D,M),B.untransitioned().possiblyEvaluate(new a.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const m=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((b,M)=>{const L="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void b();let D=d;D.startsWith(L)||(D=L+D);const B=a.I.from("mapbox-reserved-lut"),V=new Image;V.src=D,V.onerror=()=>{this._styleColorTheme.lutLoading=!1,M(new Error("Failed to load image data"))},V.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==m)return void b();this._styleColorTheme.lutLoading=!1;const{width:Y,height:Q,data:le}=a.o.getImageData(V);if(Q>32)return void M(new Error("The height of the image must be less than or equal to 32 pixels."));if(Y!==Q*Q)return void M(new Error("The width of the image must be equal to the height squared."));this.getImage(B)&&this.removeImage(B),this.addImage(B,{data:new a.q({width:Y,height:Q},le),pixelRatio:1,sdf:!1,usvg:!1,version:0});const oe=this.imageManager.getImage(B,this.scope);oe?(this._styleColorTheme.lut={image:oe.data,data:d},b()):M(new Error("Missing LUT image."))}})}getLut(d){const m=this._styleColorThemeForScope[d];return m?m.lut:null}setProjection(d){d?this.stylesheet.projection=d:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(d){this._spriteRequest=function(m,b,M){let L,D,B;const V=a.o.devicePixelRatio>1?"@2x":"";let Y=a.m(b.transformRequest(b.normalizeSpriteURL(m,V,".json"),a.R.SpriteJSON),(oe,ce)=>{Y=null,B||(B=oe,L=ce,le())}),Q=a.n(b.transformRequest(b.normalizeSpriteURL(m,V,".png"),a.R.SpriteImage),(oe,ce)=>{Q=null,B||(B=oe,D=ce,le())});function le(){if(B)M(B);else if(L&&D){const oe=a.o.getImageData(D),ce={};for(const je in L){const{width:ve,height:Le,x:Pe,y:$e,sdf:Ze,pixelRatio:qe,stretchX:xt,stretchY:lt,content:ft}=L[je],ot=new a.q({width:ve,height:Le});a.q.copy(oe,ot,{x:Pe,y:$e},{x:0,y:0},{width:ve,height:Le},null),ce[je]={data:ot,pixelRatio:qe!==void 0?qe:1,sdf:Ze!==void 0&&Ze,stretchX:xt,stretchY:lt,content:ft,usvg:!1,version:0}}M(null,ce)}}return{cancel(){Y&&(Y.cancel(),Y=null),Q&&(Q.cancel(),Q=null)}}}(d,this.map._requestManager,(m,b)=>{if(this._spriteRequest=null,m)this.fire(new a.y(m));else if(b){const M=new Map;for(const L in b)M.set(a.I.from(L),b[L]);this.addImages(M)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))})}addIconset(d,m){if(m.type==="sprite")return void this._loadSprite(m.url);const b=this.getOwnSourceCache(m.source);if(!b)return void this.fire(new a.y(new Error(`Source "${m.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const M=b.getSource();if(M.type!=="raster-array")return void this.fire(new a.y(new Error(`Source "${m.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));M.partial=!1;const L=new F3(d,this.scope,b);this.imageManager.addImageProvider(L,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!a.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const m=this.map._spriteFormat==="auto";var b,M;this._spriteRequest=(M=(L,D)=>{if(this._spriteRequest=null,L)m?this._loadSprite(d):this.fire(new a.y(L));else if(D){const B=new Map;for(const V in D)B.set(a.I.from(V),D[V]);this.addImages(B)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))},a.bu((b=this.map._requestManager).transformRequest(b.normalizeIconsetURL(d),a.R.Iconset),(L,D)=>{if(L)return void M(L);const B={},V=a.dg(new a.bt(D));for(const Y of V.icons){const Q={version:1,pixelRatio:a.o.devicePixelRatio,content:GI(Y),stretchX:Y.metadata?KI(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?KI(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};B[Y.name]=Q}M(null,B)}))}_validateLayer(d){const m=this.getOwnSource(d.source);if(!m)return;const b=d.sourceLayer;b&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(b)===-1)&&this.fire(new a.y(new Error(`Source layer "${b}" does not exist on source "${m.id}" as specified by style layer "${d.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const d in this._sourceCaches)if(!this._sourceCaches[d].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:d}of this.fragments)if(!d.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((d,m)=>{const b=this.fragments[m];return b&&b.style&&(d.data=b.style.serialize()),d})}_serializeSources(){const d={};for(const m in this._sourceCaches){const b=this._sourceCaches[m].getSource();d[b.id]||(d[b.id]=b.serialize())}return d}_serializeLayers(d){const m=[];for(const b of d){const M=this._layers[b];M&&M.type!=="custom"&&m.push(M.serialize())}return m}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const d in this._sourceCaches)if(this._sourceCaches[d].hasTransition())return!0;for(const d in this._layers)if(this._layers[d].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];if(m._transitionablePaint&&m._transitionablePaint._values){const b=m._transitionablePaint._values["line-emissive-strength"];if(b&&b.value&&b.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(d){return d?this.order:this._mergedOrder}isLayerDraped(d){return!!this.terrain&&d.isDraped(this.getLayerSourceCache(d))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(d){const m=this.getOwnLayer(d);if(m)return m;this.fire(new a.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const m=this.getOwnSource(d);if(m)return m;this.fire(new a.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,m){const b=this.map.painter;if(b)for(let M=d.minzoom||0;M<(d.maxzoom||25.5);M++){const L=d.getProgramIds();if(L)for(const D of L){const B=d.getDefaultProgramParams(D,m.zoom,this._styleColorTheme.lut);B&&(b.style=this,this.fog&&(b._fogVisible=!0,B.overrideFog=!0,b.getOrCreateProgram(D,B)),b._fogVisible=!1,B.overrideFog=!1,b.getOrCreateProgram(D,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,b.getOrCreateProgram(D,B)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const m=this.calculateLightsBrightness();d.brightness=m||0,m!==this._brightness&&(this._brightness=m,this.dispatcher.broadcast("setBrightness",m)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const b=this._changes.isDirty();let M=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const V in B){const{updatedIds:Y,removedIds:Q}=B[V];(Y||Q)&&(this._updateWorkerLayers(V,Y,Q),M=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(d),this.light&&this.light.updateTransitions(d),this.ambientLight&&this.ambientLight.updateTransitions(d),this.directionalLight&&this.directionalLight.updateTransitions(d),this.fog&&this.fog.updateTransitions(d),this.snow&&this.snow.updateTransitions(d),this.rain&&this.rain.updateTransitions(d),this._changes.reset()}const L={};for(const B in this._mergedSourceCaches){const V=this._mergedSourceCaches[B];L[B]=V.used,V.used=!1,V.tileCoverLift=0}for(const B of this._mergedOrder){const V=this._mergedLayers[B];if(V.visibility!=="none"&&V.recalculate(d,this._availableImages),!V.isHidden(d.zoom)){const Y=this.getLayerSourceCache(V);Y&&(Y.used=!0,Y.tileCoverLift=Math.max(Y.tileCoverLift,V.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(V,d)}):this.precompilePrograms(V,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&M&&this.mergeLayers();const D=this.imageManager.getPendingImageProviders();for(const B of D)B.sourceCache.used=!0;for(const B in L){const V=this._mergedSourceCaches[B];L[B]!==V.used&&V.getSource().fire(new a.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:V.getSource().id}))}this.light&&this.light.recalculate(d),this.terrain&&this.terrain.recalculate(d),this.fog&&this.fog.recalculate(d),this.snow&&this.snow.recalculate(d),this.rain&&this.rain.recalculate(d),this.z=d.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),b&&this.fire(new a.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const m of d){const b=m.resolvePendingRequests(),M=this.getFragmentStyle(m.scope);M&&M.addImages(b)}}_updateTilesForChangedImages(){const d={};for(const m in this._mergedSourceCaches){const b=this._mergedSourceCaches[m].getSource().scope;d[b]=d[b]||this._changes.getUpdatedImages(b),d[b].length!==0&&this._mergedSourceCaches[m].reloadTilesForDependencies(["icons","patterns"],d[b])}for(const m in d)this._changes.resetUpdatedImages(m)}_updateWorkerLayers(d,m,b){const M=this.getFragmentStyle(d);M&&this.dispatcher.broadcast("updateLayers",{layers:m?M._serializeLayers(m):[],scope:d,removedIds:b||[],options:M.options})}setState(d,m){if(this._checkLoaded(),Om(this,Ii(d)))return!1;(d=a.dp(d)).layers=Cr(d.layers);const b=function(D,B){if(!D)return[{command:dr.setStyle,args:[B]}];let V=[];try{if(!a.by(D.version,B.version))return[{command:dr.setStyle,args:[B]}];if(a.by(D.center,B.center)||V.push({command:dr.setCenter,args:[B.center]}),a.by(D.zoom,B.zoom)||V.push({command:dr.setZoom,args:[B.zoom]}),a.by(D.bearing,B.bearing)||V.push({command:dr.setBearing,args:[B.bearing]}),a.by(D.pitch,B.pitch)||V.push({command:dr.setPitch,args:[B.pitch]}),a.by(D.sprite,B.sprite)||V.push({command:dr.setSprite,args:[B.sprite]}),a.by(D.glyphs,B.glyphs)||V.push({command:dr.setGlyphs,args:[B.glyphs]}),a.by(D.imports,B.imports)||function(ce=[],je=[],ve){je=je||[];const Le=(ce=ce||[]).map(Vg),Pe=je.map(Vg),$e=ce.reduce(hv,{}),Ze=je.reduce(hv,{}),qe=Le.slice();let xt,lt,ft,ot;for(xt=0,lt=0;xt{ce.source&&Y[ce.source]?V.push({command:dr.removeLayer,args:[ce.id]}):le.push(ce)});let oe=D.terrain;oe&&Y[oe.source]&&(V.push({command:dr.setTerrain,args:[void 0]}),oe=void 0),V=V.concat(Q),a.by(oe,B.terrain)||V.push({command:dr.setTerrain,args:[B.terrain]}),function(ce,je,ve){je=je||[];const Le=(ce=ce||[]).map(Vg),Pe=je.map(Vg),$e=ce.reduce(hv,{}),Ze=je.reduce(hv,{}),qe=Le.slice(),xt=Object.create(null);let lt,ft,ot,st,bt,Ot,Pt;for(lt=0,ft=0;lt!(D.command in YI));if(b.length===0)return!1;const M=b.filter(D=>!(D.command in ZI));if(M.length>0)throw new Error(`Unimplemented: ${M.map(D=>D.command).join(", ")}.`);const L=[];return b.forEach(D=>{L.push(this[D.command](...D.args))}),m&&Promise.all(L).then(m).catch(m),this.stylesheet=d,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(d){if(d.size===0)return this;for(const[m,b]of d.entries()){if(this.getImage(m))return this.fire(new a.y(new Error(`An image with the name "${m.name}" already exists.`)));this.imageManager.addImage(m,this.scope,b),this._changes.updateImage(m,this.scope)}return this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this}addImage(d,m){return this.getImage(d)?this.fire(new a.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,m),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this)}updateImage(d,m,b=!1){this.imageManager.updateImage(d,this.scope,m),b&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})))}getImage(d){return this.imageManager.getImage(d,this.scope)}removeImage(d){return this.getImage(d)?(this.imageManager.removeImage(d,this.scope),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(d){return this.modelManager.addModelURLs(d,this.getActualScope()),this._updateWorkerModels(),this.fire(new a.z("data",{dataType:"style"})),this}addModel(d,m,b={}){return this._checkLoaded(),this._validate(we,`models.${d}`,m,null,b)||(this.modelManager.addModel(d,m,this.getActualScope()),this.fire(new a.z("data",{dataType:"style"}))),this}hasModel(d){return this.modelManager.hasModel(d,this.getActualScope())}removeModel(d){return this.hasModel(d)?(this.modelManager.removeModel(d,this.getActualScope(),!1,!0),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,m,b={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!m.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(Oo,`sources.${d}`,m,null,b))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const M=zo(d,m,this.dispatcher,this);M.scope=this.scope,M.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(M.id),source:M.serialize(),sourceId:M.id}));const L=D=>{const B=(D?"symbol:":"other:")+M.id,V=a.B(B,this.scope),Y=this._sourceCaches[B]=new Yc(V,M,D);(D?this._symbolSourceCaches:this._otherSourceCaches)[M.id]=Y,Y.onAdd(this.map)};L(!1),m.type!=="vector"&&m.type!=="geojson"||L(!0),M.onAdd&&M.onAdd(this.map),b.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const m=this.getOwnSource(d);if(!m)throw new Error("There is no source with this ID");for(const M in this._layers)if(this._layers[M].source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while layer "${M}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const M=Object.entries(this.stylesheet.iconsets).find(([L,D])=>D.type==="source"&&D.source===d);if(M)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while iconset "${M[0]}" is using it.`)))}const b=this.getOwnSourceCaches(d);for(const M of b){const L=a.dq(M.id);delete this._sourceCaches[L],this._changes.discardSourceCacheUpdate(M.id),M.fire(new a.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:M.getSource().id})),M.setEventedParent(null),M.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),m.setEventedParent(null),m.onRemove&&m.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,m){this._checkLoaded(),this.getOwnSource(d).setData(m),this._changes.setDirty()}getOwnSource(d){const m=this.getOwnSourceCache(d);return m&&m.getSource()}getOwnSources(){const d=[];for(const m in this._otherSourceCaches){const b=this.getOwnSourceCache(m);b&&d.push(b.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const m in d){const b=d[m]._tiles;for(const M in b){const L=b[M];if(L.state!=="loaded"&&L.state!=="errored")return!1}}return!0}setLights(d){if(this._checkLoaded(),!d)return delete this.ambientLight,void delete this.directionalLight;const m=this._getTransitionParameters();for(const L of d){if(this._validate(xo,"lights",L))return;switch(L.type){case"ambient":if(this.ambientLight){const D=this.ambientLight;D.set(L),D.updateTransitions(m)}else this.ambientLight=new Gs(L,Ka||(Ka=new a.a9({color:new a.aa(a.a6.properties_light_ambient.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const D=this.directionalLight;D.set(L),D.updateTransitions(m)}else this.directionalLight=new Gs(L,Oa||(Oa=new a.a9({direction:new a.ap(a.a6.properties_light_directional.direction),color:new a.aa(a.a6.properties_light_directional.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_directional.intensity),"cast-shadows":new a.aa(a.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new a.aa(a.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new a.aa(a.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const b=Object.assign(m,{worldview:this.map.getWorldview()}),M=new a.ac(this.z||0,b);this.ambientLight&&this.ambientLight.recalculate(M),this.directionalLight&&this.directionalLight.recalculate(M),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,m=this.ambientLight;if(!d||!m)return;const b=oe=>.2126*(oe[0]<=.03928?oe[0]/12.92:Math.pow((oe[0]+.055)/1.055,2.4))+.7152*(oe[1]<=.03928?oe[1]/12.92:Math.pow((oe[1]+.055)/1.055,2.4))+.0722*(oe[2]<=.03928?oe[2]/12.92:Math.pow((oe[2]+.055)/1.055,2.4)),M=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),L=d.properties.get("intensity"),D=d.properties.get("direction"),B=1-a.d4(D.x,D.y,D.z)[2]/90,V=b(M)*L*B,Y=m.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),Q=m.properties.get("intensity"),le=b(Y)*Q;return Number(((V+le)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const d=[];return this.directionalLight&&d.push(this.directionalLight.get()),this.ambientLight&&d.push(this.ambientLight.get()),d}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(d){if(d==null||d===""&&this.isRootStyle())return this;if(a.dr(d)){const m=a.ds(d),b=this.fragments.find(({id:L})=>L===m);if(!b)return;const M=a.dq(d);return b.style.getFragmentStyle(M)}{const m=this.fragments.find(({id:b})=>b===d);return m?m.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const m={},b=(M,L="")=>`${M}::${L}`;this._featuresetSelectors={};for(const M in d){const L=this._featuresetSelectors[M]=[];for(const D of d[M].selectors){if(D.featureNamespace){const V=this.getOwnLayer(D.layer);if(!V){a.w(`Layer is undefined for selector: ${D.layer}`);continue}const Y=b(V.source,V.sourceLayer);if(Y in m&&m[Y]!==D.featureNamespace){a.w(`"featureNamespace ${D.featureNamespace} of featureset ${M}'s selector is not associated to the same source, skip this selector`);continue}m[Y]=D.featureNamespace}let B;if(D.properties)for(const V in D.properties){const Y=a.U(D.properties[V]);Y.result==="success"&&(B=B||{},B[V]=Y.value)}L.push({layerId:D.layer,namespace:D.featureNamespace,properties:B,uniqueFeatureID:D._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const m=this.getFragmentStyle(d);if(!m||!m.stylesheet.featuresets)return[];const b=[];for(const M in m.stylesheet.featuresets)b.push({featuresetId:M,importId:m.scope?m.scope:void 0});return b}getFeaturesetLayers(d,m){const b=this.getFragmentStyle(m),M=b.stylesheet.featuresets;if(!M||!M[d])return this.fire(new a.y(new Error(`The featureset '${d}' does not exist in the map's style and cannot be queried.`))),[];const L=[];for(const D of M[d].selectors){const B=b.getOwnLayer(D.layer);B&&L.push(B)}return L}getConfigProperty(d,m){const b=this.getFragmentStyle(d);if(!b)return null;const M=a.B(m,b.scope),L=b.options.get(M),D=L?L.value||L.default:null;return D?D.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,m){const b=a.B(d,m);return this._mergedIndoor[b]}setIndoorData(d,m){this.map.indoor.setIndoorData(m)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,m,b){const M=this.getFragmentStyle(d);if(!M)return;const L=M.stylesheet.schema;if(!L||!L[m])return;const D=a.U(b);if(D.result!=="success")return void Om(this,D.value);const B=D.value.expression,V=a.B(m,M.scope),Y=M.options.get(V);if(!Y)return;let Q;const{minValue:le,maxValue:oe,stepValue:ce,type:je,values:ve}=L[m],Le=a.U(L[m].default);Le.result==="success"&&(Q=Le.value.expression),Q?(this.options.set(V,Object.assign({},Y,{value:B,default:Q,minValue:le,maxValue:oe,stepValue:ce,type:je,values:ve})),this.updateConfigDependencies(m)):this.fire(new a.y(new Error(`No schema defined for the config option "${m}" in the "${d}" fragment.`)))}getConfig(d){const m=this.getFragmentStyle(d);if(!m)return null;const b=m.stylesheet.schema;if(!b)return null;const M={};for(const L in b){const D=a.B(L,m.scope),B=m.options.get(D),V=B?B.value||B.default:null;M[L]=V?V.serialize():null}return M}setConfig(d,m){const b=this.getFragmentStyle(d);b&&(b.updateConfig(m,b.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const m=this.getFragmentStyle(d);return m?m.stylesheet.schema:null}setSchema(d,m){const b=this.getFragmentStyle(d);b&&(b.stylesheet.schema=m,b.updateConfig(b._config,m),this.updateConfigDependencies())}updateConfig(d,m){if(this._config=d,d||m)if(m)for(const b in m){let M,L;const D=a.U(m[b].default);if(D.result==="success"&&(M=D.value.expression),d&&d[b]!==void 0){const oe=a.U(d[b]);oe.result==="success"&&(L=oe.value.expression)}const{minValue:B,maxValue:V,stepValue:Y,type:Q,values:le}=m[b];if(M){const oe=a.B(b,this.scope);this.options.set(oe,{default:M,value:L,minValue:B,maxValue:V,stepValue:Y,type:Q,values:le})}else this.fire(new a.y(new Error(`No schema defined for config option "${b}".`)))}else this.fire(new a.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,m=()=>!0){for(const b of d){const M=this.getLayer(b);M&&m(M)&&(M.possiblyEvaluateVisibility(),this._updateLayer(M),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,m=>!d||m.expressionDependencies.configDependencies.has(d)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(m=>{const b=m._styleColorTheme.colorThemeOverride?m._styleColorTheme.colorThemeOverride:m._styleColorTheme.colorTheme;if(b){const M=m._evaluateColorThemeData(b);(!m._styleColorTheme.lut&&M!==""||m._styleColorTheme.lut&&M!==m._styleColorTheme.lut.data)&&m.setColorTheme(b)}}),this._changes.setDirty()}addLayer(d,m,b={}){this._checkLoaded();const M=d.id;if(this._layers[M])return void this.fire(new a.y(new Error(`Layer with id "${M}" already exists on this map`)));let L;if(d.type==="custom"){if(Om(this,a.dt(d)))return;L=a.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(M,d.source),d=a.dp(d),d=Object.assign(d,{source:M})),this._validate(Bd,`layers.${M}`,d,{arrayIndex:-1},b))return;L=a.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(L),L.setEventedParent(this,{layer:{id:M}})}const D=a.B(L.source,L.scope);L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(D),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(D);let B=this._order.length;if(m){const le=this._order.indexOf(m);if(le===-1)return void this.fire(new a.y(new Error(`Layer with id "${m}" does not exist on this map.`)));L.slot===this._layers[m].slot?B=le:a.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,M),this._layerOrderChanged=!0,this._layers[M]=L;const V=this.getOwnLayerSourceCache(L),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();V&&L.canCastShadows()&&Y&&(V.castsShadows=!0);const Q=this._changes.getRemovedLayer(L);if(Q&&L.source&&V&&L.type!=="custom"){this._changes.discardLayerRemoval(L);const le=a.B(L.source,L.scope);Q.type!==L.type?this._changes.updateSourceCache(le,"clear"):(this._changes.updateSourceCache(le,"reload"),V.pause())}this._updateLayer(L),L.onAdd&&L.onAdd(this.map),L.scope=this.scope,this.mergeLayers()}moveLayer(d,m){this._checkLoaded();const b=this._checkLayer(d);if(!b||d===m)return;const M=this._order.indexOf(d);this._order.splice(M,1);let L=this._order.length;if(m){const D=this._order.indexOf(m);if(D===-1)return void this.fire(new a.y(new Error(`Layer with id "${m}" does not exist on this map.`)));b.slot===this._layers[m].slot?L=D:a.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(L,0,d),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(d){this._checkLoaded();const m=this._checkLayer(d);if(!m)return;m.setEventedParent(null);const b=this._order.indexOf(d);this._order.splice(b,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(m.fqid),this._indoorDependentLayers.delete(m.fqid),this._changes.removeLayer(m);const M=this.getOwnLayerSourceCache(m);if(M&&M.castsShadows){let L=!1;for(const D in this._layers)if(this._layers[D].source===m.source&&this._layers[D].canCastShadows()){L=!0;break}M.castsShadows=L}m.onRemove&&m.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const m in this._layers)if(this._layers[m].type===d)return!0;return!1}setLayerZoomRange(d,m,b){this._checkLoaded();const M=this._checkLayer(d);M&&(M.minzoom===m&&M.maxzoom===b||(m!=null&&(M.minzoom=m),b!=null&&(M.maxzoom=b),this._updateLayer(M)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,m){this._checkLoaded();const b=this._checkLayer(d);b&&b.slot!==m&&(b.slot=m,this._updateLayer(b))}setFilter(d,m,b={}){this._checkLoaded();const M=this._checkLayer(d);if(M&&!a.by(M.filter,m))return m==null?(M.filter=void 0,void this._updateLayer(M)):void(this._validate(_r,`layers.${M.id}.filter`,m,{layerType:M.type},b)||(M.filter=a.dp(m),this._updateLayer(M)))}getFilter(d){const m=this._checkLayer(d);if(m)return a.dp(m.filter)}setLayoutProperty(d,m,b,M={}){this._checkLoaded();const L=this._checkLayer(d);if(L&&!a.by(L.getLayoutProperty(m),b)){if(b!=null&&(!M||M.validate!==!1)&&Om(L,kt.call(Ii,{key:`layers.${d}.layout.${m}`,layerType:L.type,objectKey:m,value:b,styleSpec:a.a6,style:{glyphs:!0,sprite:!0}})))return;L.setLayoutProperty(m,b),L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(L.fqid),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(L.fqid),this._updateLayer(L)}}setLayerProperty(d,m,b,M={}){this._checkLoaded();const L=this._checkLayer(d);L&&(m==="appearances"?(L.setAppearances(b),this._changes.setDirty()):L.isPaintProperty(m)?this.setPaintProperty(d,m,b,M):this.setLayoutProperty(d,m,b,M))}getLayoutProperty(d,m){const b=this._checkLayer(d);if(b)return b.getLayoutProperty(m)}setPaintProperty(d,m,b,M={}){this._checkLoaded();const L=this._checkLayer(d);if(!L||a.by(L.getPaintProperty(m),b)||b!=null&&(!M||M.validate!==!1)&&Om(L,Vn.call(Ii,{key:`layers.${d}.paint.${m}`,layerType:L.type,objectKey:m,value:b,styleSpec:a.a6})))return;const D=L.setPaintProperty(m,b);L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(L.fqid),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(L.fqid),D&&this._updateLayer(L),this._changes.updatePaintProperties(L)}getPaintProperty(d,m){const b=this._checkLayer(d);if(b)return b.getPaintProperty(m)}setFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),le=Q.getFeaturesetLayers(V);for(const{source:oe,sourceLayer:ce}of le)Q.setFeatureState({id:d.id,source:oe,sourceLayer:ce},m)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.setFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const b=d.source,M=d.sourceLayer,L=this._checkSource(b);if(!L)return;const D=L.type;if(D==="geojson"&&M)return void this.fire(new a.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(D==="vector"&&!M)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided.")));const B=this.getOwnSourceCaches(b);for(const V of B)V.setFeatureState(M,d.id,m)}removeFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),le=Q.getFeaturesetLayers(V);for(const{source:oe,sourceLayer:ce}of le)Q.removeFeatureState({id:d.id,source:oe,sourceLayer:ce},m)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.removeFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const b=d.source,M=this._checkSource(b);if(!M)return;const L=M.type,D=L==="vector"?d.sourceLayer:void 0;if(L==="vector"&&!D)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(m&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new a.y(new Error("A feature id is required to remove its specific state property.")));const B=this.getOwnSourceCaches(b);for(const V of B)V.removeFeatureState(D,d.id,m)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let L;if("featuresetId"in d.target){const{featuresetId:D,importId:B}=d.target,V=this.getFragmentStyle(B),Y=V.getFeaturesetLayers(D);for(const{source:Q,sourceLayer:le}of Y){const oe=V.getFeatureState({id:d.id,source:Q,sourceLayer:le});if(oe&&!L)L=oe;else if(!a.by(L,oe))return void this.fire(new a.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in d.target){const{layerId:D}=d.target,B=this.getLayer(D);L=this.getFeatureState({id:d.id,source:B.source,sourceLayer:B.sourceLayer})}return L}const m=d.source,b=d.sourceLayer,M=this._checkSource(m);if(M){if(M.type!=="vector"||b)return d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(m)[0].getFeatureState(b,d.id);this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(d){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,d),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const d=this.getTerrain(),m=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return a.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:m,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},b=>b!==void 0)}_updateFilteredLayers(d){for(const m of Object.values(this._mergedLayers))d(m)&&this._updateLayer(m)}_updateLayer(d){this._changes.updateLayer(d);const m=this.getLayerSourceCache(d),b=a.B(d.source,d.scope),M=this._changes.getUpdatedSourceCaches();d.source&&!M[b]&&m&&m.getSource().type!=="raster"&&(this._changes.updateSourceCache(b,"reload"),m.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const m=B=>this._mergedLayers[B].is3D(!!this.terrain),b=this.order,M={},L=[];for(let B=b.length-1;B>=0;B--){const V=b[B];if(m(V)){M[V]=B;for(const Y of d){const Q=Y[V];if(Q)for(const le of Q)L.push(le)}}}L.sort((B,V)=>V.intersectionZ-B.intersectionZ);const D=[];for(let B=b.length-1;B>=0;B--){const V=b[B];if(m(V))for(let Y=L.length-1;Y>=0;Y--){const Q=L[Y].feature;if(Q.layer&&M[Q.layer.id]{if(wk.has(Q.type))return;const le=this.getOwnLayerSourceCache(Q),oe=L[le.id]=L[le.id]||{sourceCache:le,layers:{},has3DLayers:!1};Q.is3D(!!this.terrain)&&(oe.has3DLayers=!0),oe.layers[Q.fqid]=oe.layers[Q.fqid]||{styleLayer:Q,targets:[]},oe.layers[Q.fqid].targets.push({filter:M})};if(m&&m.layers){if(!Array.isArray(m.layers))return this.fire(new a.y(new Error("parameters.layers must be an Array."))),[];for(const Q of m.layers){const le=this._layers[Q];if(!le)return this.fire(new a.y(new Error(`The layer '${Q}' does not exist in the map's style and cannot be queried for features.`))),[];D(le)}}else for(const Q in this._layers)D(this._layers[Q]);const B=this._queryRenderedFeatures(d,L,b),V=this._flattenAndSortRenderedFeatures(B),Y=[];for(const Q of V)a.dw(Q.layer.id)===this.scope&&Y.push(Q);return Y}queryRenderedFeatureset(d,m,b){let M;m&&!Array.isArray(m)&&m.filter&&(this._validate(_r,"queryRenderedFeatures.filter",m.filter,null,m),M=a.b6(m.filter));const L="mock",D=[];if(m&&m.target)D.push(Object.assign({},m,{targetId:L,filter:M}));else{const Q=this.getFeaturesetDescriptors();for(const le of Q)D.push({targetId:L,filter:M,target:le});for(const{style:le}of this.fragments){const oe=le.getFeaturesetDescriptors();for(const ce of oe)D.push({targetId:L,filter:M,target:ce})}}const B=this.queryRenderedTargets(d,D,b),V=[],Y=new Set;for(const Q of B)for(const le of Q.variants[L])Uu(le,Q,Y)||V.push(new a.dx(Q,le));return V}queryRenderedTargets(d,m,b){const M={},L=(B,V,Y,Q)=>{const le=M[V.id]=M[V.id]||{sourceCache:V,layers:{},has3DLayers:!1};if(le.layers[B.fqid]=le.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(le.has3DLayers=!0),!Q)return Y.uniqueFeatureID=!1,void le.layers[B.fqid].targets.push(Y);le.layers[B.fqid].targets.push(Object.assign({},Y,{namespace:Q.namespace,properties:Q.properties,uniqueFeatureID:Q.uniqueFeatureID}))};for(const B of m)if("featuresetId"in B.target){const{featuresetId:V,importId:Y}=B.target,Q=this.getFragmentStyle(Y);if(!Q||!Q._featuresetSelectors)continue;const le=Q._featuresetSelectors[V];if(!le){this.fire(new a.y(new Error(`The featureset '${V}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const oe of le){const ce=Q.getOwnLayer(oe.layerId);ce&&!wk.has(ce.type)&&L(ce,Q.getOwnLayerSourceCache(ce),B,oe)}}else if("layerId"in B.target){const{layerId:V}=B.target,Y=this.getLayer(V);if(!Y||wk.has(Y.type))continue;L(Y,this.getLayerSourceCache(Y),B)}const D=this._queryRenderedFeatures(d,M,b);return this._flattenAndSortRenderedFeatures(D)}_queryRenderedFeatures(d,m,b){const M=[],L=!!this.map._showQueryGeometry,D=ma.createFromScreenPoints(d,b);for(const B in m){const V=Jl(D,m[B],this._availableImages,b,L);Object.keys(V).length&&M.push(V)}if(this.placement)for(const B in m){if(!m[B].sourceCache._onlySymbols)continue;const V=up(D.screenGeometry,m[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(V).length&&M.push(V)}return M}querySourceFeatures(d,m){const b=m&&m.filter;b&&this._validate(_r,"querySourceFeatures.filter",b,null,m);let M=[];const L=this.getOwnSourceCaches(d);for(const D of L)M=M.concat(Am(D,m));return M}addSourceType(d,m,b){return Yu.getSourceType(d)?b(new Error(`A source type called "${d}" already exists.`)):(Yu.setSourceType(d,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:m.workerSourceURL},b):b(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,m,b={}){this._checkLoaded();const M=this.light.getLight();let L=!1;for(const B in d)if(!a.by(d[B],M[B])){L=!0;break}if(!L)return;const D=this._getTransitionParameters();this.light.setLight(d,m,b),this.light.updateTransitions(D)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=a.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&a.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,m=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),m===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let b=d;const M=!("source"in d)||d.source==null;if(m===1){if(this.disableElevatedTerrain)return;if("source"in b&&typeof b.source=="object"){const B="terrain-dem-src";this.addSource(B,b.source),b=a.dp(b),b=Object.assign(b,{source:B})}const L=Object.assign({},b),D={};if(this.terrain&&M){L.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(D.style=B.serialize())}if(this._validate(Tc,"terrain",L,D))return}if(!this.terrain||this.terrain.scope!==this.scope&&!M||this.terrain&&m!==this.terrain.drapeRenderMode){if(!b)return;this._createTerrain(b,m),this.fire(new a.z("data",{dataType:"style"}))}else{const L=this.terrain,D=L.get();for(const B of Object.keys(a.a6.terrain))!b.hasOwnProperty(B)&&a.a6.terrain[B].default&&(b[B]=a.a6.terrain[B].default);for(const B in d)if(!a.by(d[B],D[B])){L.set(d,this.options),this.stylesheet.terrain=d;const V=this._getTransitionParameters({duration:0});L.updateTransitions(V),this.fire(new a.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const m=this.fog=new Qn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=m.get();const b=this._getTransitionParameters({duration:0});m.updateTransitions(b)}_createSnow(d){const m=this.snow=new ho(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=m.get();const b=this._getTransitionParameters({duration:0});m.updateTransitions(b)}_createRain(d){const m=this.rain=new wa(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=m.get();const b=this._getTransitionParameters({duration:0});m.updateTransitions(b)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const d of this.map._markers)d._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(d){if(this._checkLoaded(),!d)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const m=this.fog;if(!a.by(m.get(),d)){m.set(d,this.options),this.stylesheet.fog=m.get();const b=this._getTransitionParameters({duration:0});m.updateTransitions(b)}}else this._createFog(d);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(d){if(this._checkLoaded(),!d)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const m=this.snow;if(!a.by(m.get(),d)){m.set(d,this.options),this.stylesheet.snow=m.get();const b=this._getTransitionParameters({duration:0});m.updateTransitions(b)}}else this._createSnow(d);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(d){if(this._checkLoaded(),!d)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const m=this.rain;if(!a.by(m.get(),d)){m.set(d,this.options),this.stylesheet.rain=m.get();const b=this._getTransitionParameters({duration:0});m.updateTransitions(b)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const M in this._layers)this._layers[M].lut=this._styleColorTheme.lut;for(const M in this._sourceCaches)this._sourceCaches[M].clearTiles()},m=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!m)return this._styleColorTheme.lut=null,void d();const b=this._evaluateColorThemeData(m);this._loadColorTheme(b).then(()=>{this.fire(new a.z("colorthemeset")),d()}).catch(M=>{a.w(`Couldn't set color theme: ${M}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&a.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=d,this._reloadColorTheme()}setImportColorTheme(d,m){const b=this.getFragmentStyle(d);b&&(b._styleColorTheme.colorThemeOverride=m,b._reloadColorTheme())}_getTransitionParameters(d){return{now:a.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],m=[];for(const b of this._mergedOrder)this.isLayerDraped(this._mergedLayers[b])?d.push(b):m.push(b);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...m)}_createTerrain(d,m){const b=this.terrain=new Lt(d,m,this.scope,this.options,this.map.getWorldview());m===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const M=this._getTransitionParameters({duration:0});b.updateTransitions(M)}_force3DLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="fill-extrusion"&&this._updateLayer(m)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="symbol"&&this._updateLayer(m)}}_validate(d,m,b,M,L={}){if(L&&L.validate===!1)return!1;const D=Object.assign({},this.serialize());return Om(this,d.call(Ii,Object.assign({key:m,style:D,value:b,styleSpec:a.a6},M)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const d in this._mergedLayers)this._mergedLayers[d].setEventedParent(null);for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles(),this._mergedSourceCaches[d].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(d){const m=this.getSourceCaches(d);for(const b of m)b.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];m._clear&&m._clear()}}reloadSource(d){const m=this.getSourceCaches(d);for(const b of m)b.resume(),b.reload()}reloadSources(){for(const d of this.getSources())d.reload&&d.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(d=>{d.modelManager.reloadModels(d.scope)})}updateSources(d){let m;this.directionalLight&&(m=bv(this.directionalLight));const b=new Set,M=new Set;for(const L in this._mergedLayers){const D=this._mergedLayers[L];D.type==="building"&&b.add(D.source),D.hasElevation()&&!M.has(D.source)&&M.add(D.source)}for(const L in this._mergedSourceCaches){const D=this._mergedSourceCaches[L],B=M.has(D._source.id);b.has(D._source.id)&&(D._source.reparseOverscaled=!1),D.update(d,void 0,void 0,m,B)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const m=this._sourceCaches[d];m.resume(),m.reload()}}_updatePlacement(d,m,b,M,L,D,B=!1){let V=!1,Y=!1;const Q={},le={};for(const ve of this._mergedOrder){const Le=this._mergedLayers[ve];if(Le.type!=="symbol")continue;const Pe=a.B(Le.source,Le.scope);let $e=Q[Pe];if(!$e){const qe=this.getLayerSourceCache(Le);if(!qe)continue;const xt=qe.getRenderableIds(!0).map(lt=>qe.getTileByID(lt));le[Pe]=xt.slice(),$e=Q[Pe]=xt.sort((lt,ft)=>ft.tileID.overscaledZ-lt.tileID.overscaledZ||(lt.tileID.isLessThan(ft.tileID)?-1:1))}const Ze=this.crossTileSymbolIndex.addLayer(Le,$e,m.center.lng,m.projection);V=V||Ze}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new a.z("neworder"));const oe=!!(this.placement&&!m.equals(this.placement.transform)),ce=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!D||this.placement.lastReplacementSourceUpdateTime!==D.updateTime)),je=(oe||ce||V||this.placement&&this.placement.isStale())&&M===0;if((B||!this.pauseablePlacement||je||M!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.o.now(),m.zoom))&&(this.pauseablePlacement=new ml(m,this._mergedOrder,B||M===0,b,M,L,this.placement,this.fog&&m.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,Q,le,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.o.now()),Y=!0),V&&this.pauseablePlacement.placement.setStale()),Y||V){this._buildingIndex.onNewFrame(m.zoom);for(let ve=0;veL===d.id)!==-1)return void this.fire(new a.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!m)return b.push(d),this._loadImports([d],!0);const M=b.findIndex(({id:L})=>L===m);return M===-1&&this.fire(new a.y(new Error(`Import with id "${m}" does not exist on this map.`))),this.stylesheet.imports=b.slice(0,M).concat(d).concat(b.slice(M)),this._loadImports([d],!0,m)}updateImport(d,m){this._checkLoaded();const b=this.stylesheet.imports||[],M=this.getImportIndex(d);return M===-1?this:typeof m=="string"?(this.setImportUrl(d,m),this):(m.url&&m.url!==b[M].url&&this.setImportUrl(d,m.url),a.by(m.config,b[M].config)||this.setImportConfig(d,m.config,m.data.schema),a.by(m.data,b[M].data)||this.setImportData(d,m.data),this)}moveImport(d,m){this._checkLoaded();let b=this.stylesheet.imports||[];const M=this.getImportIndex(d);if(M===-1)return this;const L=this.getImportIndex(m);if(L===-1)return this;const D=b[M],B=this.fragments[M];return b=b.filter(({id:V})=>V!==d),this.fragments=this.fragments.filter(({id:V})=>V!==d),this.stylesheet.imports=b.slice(0,L).concat(D).concat(b.slice(L)),this.fragments=this.fragments.slice(0,L).concat(B).concat(this.fragments.slice(L)),this.mergeLayers(),this}setImportUrl(d,m){this._checkLoaded();const b=this.stylesheet.imports||[],M=this.getImportIndex(d);if(M===-1)return this;b[M].url=m;const L=this.fragments[M];return L.style=this._createFragmentStyle(b[M]),L.style.on("style.import.load",()=>this.mergeAll()),L.style.loadURL(m),this}setImportData(d,m){this._checkLoaded();const b=this.getImportIndex(d),M=this.stylesheet.imports||[];return b===-1?this:m?(this.fragments[b].style.setState(m),this._reloadImports(),this):(delete M[b].data,this.setImportUrl(d,M[b].url))}setImportConfig(d,m,b){this._checkLoaded();const M=this.getImportIndex(d),L=this.stylesheet.imports||[];if(M===-1)return this;m?L[M].config=m:delete L[M].config;const D=this.fragments[M];b&&D.style.stylesheet&&(D.style.stylesheet.schema=b);const B=D.style.stylesheet&&D.style.stylesheet.schema;return D.config=m,D.style.updateConfig(m,B),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const m=this.stylesheet.imports||[],b=this.getImportIndex(d);b!==-1&&(m.splice(b,1),this.fragments[b].style._remove(),this.fragments.splice(b,1),this._reloadImports())}getImportIndex(d){const m=(this.stylesheet.imports||[]).findIndex(b=>b.id===d);return m===-1&&this.fire(new a.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),m}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const m in this._mergedOtherSourceCaches){const b=this._mergedOtherSourceCaches[m];b&&d.push(b.getSource())}return d}getSource(d,m){const b=this.getSourceCache(d,m);return b&&b.getSource()}getLayerSource(d){const m=this.getLayerSourceCache(d);return m&&m.getSource()}getSourceCache(d,m){const b=a.B(d,m);return this._mergedOtherSourceCaches[b]}getLayerSourceCache(d){const m=a.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[m]:this._mergedOtherSourceCaches[m]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const m=[];return this._mergedOtherSourceCaches[d]&&m.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&m.push(this._mergedSymbolSourceCaches[d]),m}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const m in d){const b=d[m];b==="reload"?this.reloadSource(m):b==="clear"&&this.clearSource(m)}}updateLayers(d){const m=this._changes.getUpdatedPaintProperties();for(const b of m){const M=this.getLayer(b);M&&M.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,m,b){this.imageManager.getImages(m.images,m.scope,b),this._updateTilesForChangedImages();const M=D=>{if(D){const B=m.images.map(V=>a.I.toString(V));D.setDependencies(m.tileID.key,m.type,B)}},L=a.B(m.source,m.scope);M(this._mergedOtherSourceCaches[L]),M(this._mergedSymbolSourceCaches[L]),m.images.some(D=>D.iconsetId)&&this.fire(new a.z("data",{dataType:"style"}))}rasterizeImages(d,m,b){this.imageManager.rasterizeImages(m,b)}getGlyphs(d,m,b){this.glyphManager.getGlyphs(m.stacks,b)}getResource(d,m,b){return a.dz(m,b)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const m=[];return this._otherSourceCaches[d]&&m.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&m.push(this._symbolSourceCaches[d]),m}_isSourceCacheLoaded(d){const m=this.getOwnSourceCaches(d);return m.length===0?(this.fire(new a.y(new Error(`There is no source with ID '${d}'`))),!1):m.every(b=>b.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,m){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const b=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),M=d.type==="building";if(d.is3D(!!this.terrain)){if(b||M||m&&m.type==="batched-model"||d.type==="model")return!0}else if(d.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(d=>{d.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Yu.getSourceType=function(_){return iu[_]},Yu.setSourceType=function(_,d){iu[_]=d},Yu.registerForPluginStateChange=a.dA;class XI extends a.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},a.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(d){d===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=d,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(d){this._activeFloorsVisible=d,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(d){for(const[m,b]of Object.entries(d.buildings))if(this._buildings[m])for(const M of b.floorIds)this._buildings[m].floors[M]||(this._buildings[m].floors[M]=b.floors[M]);else this._buildings[m]=b;for(const m of d.activeFloors)this._activeFloors.add(m);this._updateIndoorSelector()}getIndoorTileOptions(d,m){const b=this._style.getIndoorSourceLayers(d,m);return b&&this._indoorState?{sourceLayers:b,indoorState:this._indoorState}:null}_updateUI(d,m,b){const M=function(L,D,B,V){let Y=null,Q=Number.MAX_SAFE_INTEGER;if(V<16)return null;for(const[le,oe]of Object.entries(L)){const ce=oe.center;if(ce){const je=D.distanceTo(a.aT.convert(ce));je({id:D,name:b.floors[D].name,zIndex:b.floors[D].zIndex})).sort((D,B)=>B.zIndex-D.zIndex);this.fire(new a.z("selector-update",{selectedFloorId:M,activeFloorsVisible:this._activeFloorsVisible,floors:L}))}_updateActiveFloors(){const d=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:d,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var Ny=` #define EPSILON 0.0000001 #define PI 3.141592653589793 #ifdef RENDER_CUTOFF float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} #endif`,Sy=` #ifdef DUAL_SOURCE_BLENDING layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1; #else layout(location=0) out vec4 glFragColor; #endif #ifdef USE_MRT1 layout(location=1) out vec4 out_Target1; #endif highp float unpack_depth(highp vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} #ifdef INDICATOR_CUTOUT uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; #endif vec4 applyCutout(vec4 color,float height) { #ifdef INDICATOR_CUTOUT float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); #else return color; #endif } #ifdef DEBUG_WIREFRAME #define HANDLE_WIREFRAME_DEBUG \\ glFragColor=vec4(0.7,0.0,0.0,0.7); \\ gl_FragDepth=gl_FragCoord.z-0.0001; #else #define HANDLE_WIREFRAME_DEBUG #endif #ifdef RENDER_CUTOFF uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; #endif vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,z3=` #define EXTENT 8192.0 #define RAD_TO_DEG 180.0/PI #define DEG_TO_RAD PI/180.0 #define GLOBE_RADIUS EXTENT/PI/2.0 float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} #ifdef PROJECTION_GLOBE_VIEW vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { #ifndef PROJECTED_POS_ON_VIEWPORT float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; #else return vec3(0.0); #endif }vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} #endif vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} #ifdef RENDER_CUTOFF uniform vec4 u_cutoff_params;out float v_cutoff_opacity; #endif const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) {float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} #ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib #define DECLARE_MATERIAL_TABLE_INFO #endif`,jk="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",ou=` #define ELEVATION_SCALE 7.0 #define ELEVATION_OFFSET 450.0 #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} #else vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } #endif #ifdef TERRAIN uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif }float prevElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif } #ifdef TERRAIN_VERTEX_MORPHING float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} #else float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif return currentElevation(apos);} #endif vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} #else float elevation(vec2 pos) { return 0.0; } #endif #ifdef DEPTH_OCCLUSION uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; #ifdef DEPTH_D24 float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} #else highp float unpack_depth_rgba(vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif #ifdef DEPTH_D24 float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); #else float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); #endif return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; #ifdef DEPTH_D24 highp vec4 depth=vec4( texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r );depth=unpack_depth4(depth); #else highp vec4 depth=vec4( unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) ); #endif return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); #else highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); #endif res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} #else bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } #endif`,kk=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} #endif`,Mr=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} #endif`,B3=`#ifdef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) );}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) );}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} #endif`,Nk=`#ifdef RASTER_ARRAY uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} #endif uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Sk=`#ifdef RENDER_SHADOWS uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} #endif`,$3=`#ifdef RENDER_SHADOWS precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) { #ifdef CLIP_ZERO_TO_ONE highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); #else highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); #endif return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w; #ifdef SHADOWS_SINGLE_CASCADE vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias); #else light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); #endif }highp float calculate_shadow_bias(float NDotL) { #ifdef NORMAL_OFFSET return 0.5*u_shadow_bias.x; #else return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); #endif }float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) {highp vec2 biasUV=vec2( pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} #endif`;const jv=/#include\s+"([^"]+)"/g,mf=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,U3=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Gg=new Set(["ifdef","ifndef","elif","if","defined"]),Kg=new Set;Fm(Ny,Kg),Fm(z3,Kg),Fm(Sy,Kg);const Rm={"_prelude_fog.vertex.glsl":kk,"_prelude_terrain.vertex.glsl":ou,"_prelude_shadow.vertex.glsl":Sk,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer #define MATERIAL_TABLE_DEBUG 0 uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; #if MATERIAL_TABLE_DEBUG vec4 colorDebug; #endif };uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; }uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; #if MATERIAL_TABLE_DEBUG const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; #endif uint offset=0u; #if MATERIAL_TABLE_DEBUG bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} #endif offset++; #if MATERIAL_TABLE_DEBUG uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} #endif offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); #if MATERIAL_TABLE_DEBUG if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} #endif uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); #if MATERIAL_TABLE_DEBUG if(keepFinding) {uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} #endif offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; #if MATERIAL_TABLE_DEBUG if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} #endif info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) {uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) #define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); #define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; #endif`,"_prelude_fog.fragment.glsl":Mr,"_prelude_shadow.fragment.glsl":$3,"_prelude_lighting.glsl":` #ifdef LIGHTING_3D_MODE uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} #endif`,"_prelude_raster_array.glsl":B3,"_prelude_raster_particle.glsl":Nk},Ck={};Xs("",ou),Xs(Mr,kk),Xs($3,Sk),Xs(B3,""),Xs(Nk,"");const QI=Xs(Sy,z3),Mk=Ny,Zie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",Mk,QI.fragmentSource].join(` `),JI=["precision highp float;",Mk,QI.vertexSource].join(` `);var q3={background:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE in vec4 v_color; #endif void main() {vec4 out_color; #ifdef LIGHTING_3D_MODE out_color=v_color; #else out_color=u_color; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_lighting.glsl" in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE uniform mediump vec4 u_color;out vec4 v_color; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0,1); #ifdef LIGHTING_3D_MODE v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),backgroundPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),building:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity; #endif #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT in highp float v_flood_radius;in float v_has_flood_light; #endif uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} #ifdef BUILDING_FAUX_FACADE float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y; #if 0 if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0; #else if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; #endif return out_color;} #endif vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a; #ifdef BUILDING_FAUX_FACADE if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);} #endif vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; #ifdef RENDER_SHADOWS #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif #else shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir); #endif color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); #ifdef FLOOD_LIGHT float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance); #endif color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); #endif color*=u_opacity; #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_pos.z); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef DEBUG_SHOW_NORMALS color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT out highp float v_flood_radius;out float v_has_flood_light; #endif const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #ifdef BUILDING_FAUX_FACADE mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);} #endif #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive #ifdef FLOOD_LIGHT v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius); #endif vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0; #ifdef BUILDING_FAUX_FACADE v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;} #endif v_pos=a_pos_3f; #ifdef RENDER_CUTOFF vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; #endif #ifdef RENDER_SHADOWS vec3 shadow_pos=v_pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0); #endif #ifdef FOG v_fog_pos=fog_position(v_pos); #endif gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Xs(`in vec4 v_color_emissive; #pragma mapbox: define-attribute highp vec4 bloom_attenuation #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; #ifdef HAS_ATTRIBUTE_a_bloom_attenuation float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance); #endif #ifdef RENDER_CUTOFF opacity*=v_cutoff_opacity; #endif glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute highp vec4 bloom_attenuation out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation #ifdef HAS_ATTRIBUTE_a_part_color_emissive vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive); #else v_color_emissive=vec4(1.0); #endif gl_Position=u_matrix*vec4(a_pos_3f,1.0); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),buildingDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" in vec3 v_data;in float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity uniform float u_emissive_strength;void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) );vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_apply_premultiplied(out_color,v_fog_pos); #endif glFragColor=out_color*(v_visibility*opacity_t); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define NUM_VISIBILITY_RINGS 2 #define INV_SQRT2 0.70710678 #define ELEVATION_BIAS 0.0001 #define NUM_SAMPLES_PER_RING 16 uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif #ifdef ELEVATED_ROADS in float a_circle_z_offset; #endif out vec3 v_data;out float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { #if defined(TERRAIN) return elevation(pos)+ELEVATION_BIAS; #else return 0.0; #endif }vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); #ifdef PITCH_WITH_MAP #ifdef PROJECTION_GLOBE_VIEW return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); #else return u_matrix*( world_center+vec4(sample_offset,0,0) ); #endif #else return projected_center+vec4(sample_offset,0,0); #endif }float get_sample_step() { #ifdef PITCH_WITH_MAP return 2.0*PI/float(NUM_SAMPLES_PER_RING); #else return PI/float(NUM_SAMPLES_PER_RING); #endif }void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); #else surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); #endif #ifdef ELEVATED_ROADS world_center.z+=a_circle_z_offset+ELEVATION_BIAS; #endif vec4 projected_center=u_matrix*world_center;float view_scale=0.0; #ifdef PITCH_WITH_MAP #ifdef SCALE_WITH_MAP view_scale=1.0; #else view_scale=projected_center.w/u_camera_to_center_distance; #endif #else #ifdef SCALE_WITH_MAP view_scale=u_camera_to_center_distance; #else view_scale=projected_center.w; #endif #endif gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; #ifdef TERRAIN float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; #ifdef PITCH_WITH_MAP float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; #else occlusion_world_center=world_center;occlusion_projected_center=projected_center; #endif for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); #else visibility=1.0; #endif #ifdef PROJECTION_GLOBE_VIEW visibility=1.0; #endif v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); #ifdef FOG v_fog_pos=fog_position(world_center.xyz); #endif }`),clippingMask:Xs("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Xs(`#include "_prelude_fog.fragment.glsl" uniform highp float u_intensity;in vec2 v_extrude; #pragma mapbox: define highp float weight #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); #ifdef FOG if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif out vec2 v_extrude; #pragma mapbox: define highp float weight #pragma mapbox: define mediump float radius const highp float ZERO=1.0/255.0/16.0; #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight #pragma mapbox: initialize mediump float radius vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #else pos=vec3(tilePos+extrude,elevation(tilePos)); #endif gl_Position=u_matrix*vec4(pos,1); #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),heatmapTexture:Xs(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(0.0); #endif HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Xs("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; #endif out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation); #ifdef PROJECTION_GLOBE_VIEW #ifndef PROJECTED_POS_ON_VIEWPORT vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition); #endif #endif vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Xs("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Xs("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3; #endif out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); #else gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); #endif }`),elevatedStructuresDepth:Xs(`void main() { #ifndef DEPTH_TEXTURE glFragColor=vec4(0.); #endif }`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Xs(`#ifdef DEPTH_RECONSTRUCTION in float v_height; #endif void main() { #ifdef DEPTH_RECONSTRUCTION if (v_height >=0.0) discard; #else #ifdef FEATURE_CUTOUT apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord); #endif #endif glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; #ifdef DEPTH_RECONSTRUCTION out float v_height; #endif void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); #ifdef DEPTH_RECONSTRUCTION if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; #endif gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in vec3 v_normal;in float v_height; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; #endif vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) {color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color vec3 color=structure_color.xyz; #ifdef LIGHTING_3D_MODE vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); #ifdef RENDER_SHADOWS float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor); #else color=apply_lighting(color,transformed_normal); #endif color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} #endif #ifdef FOG color=fog_apply(color,v_fog_pos); #endif vec4 out_color=vec4(color,1.0); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_height); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; #endif #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fill:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity vec4 out_color=color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=opacity; #ifdef INDICATOR_CUTOUT if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=z_offset; #endif }`),fillOutline:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef FLIP_Y v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillOutlinePattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif uniform float u_emissive_strength; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif in highp vec2 v_pos;in highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos;out highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef FLIP_Y v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillExtrusion:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" in vec4 v_color;in vec4 v_flat; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif uniform lowp float u_opacity; #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec2 v_ao; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) in vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) in highp vec3 v_normal; #endif uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) in float v_flood_radius;in float v_has_floodlight; #endif in float v_height; #pragma mapbox: define highp float emissive_strength void main() { #pragma mapbox: initialize highp float emissive_strength #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) vec3 normal=normalize(v_normal); #endif float z;vec4 color=v_color; #ifdef ZERO_ROOF_RADIUS z=float(normal.z > 0.00001); #ifdef LIGHTING_3D_MODE normal=mix(normal,vec3(0.0,0.0,1.0),z); #else color=mix(v_color,v_roof_color,z); #endif #endif float h=max(0.0,v_height);float ao_shade=1.0; #ifdef FAUX_AO float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; #ifdef ZERO_ROOF_RADIUS concave*=(1.0-z); #endif float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT color.rgb*=mix(ao_shade,1.0,v_has_floodlight); #else color.rgb*=ao_shade; #endif #else color.rgb*=ao_shade; #endif #endif #ifdef LIGHTING_3D_MODE float flood_radiance=0.0; #ifdef FLOOD_LIGHT flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; #endif #ifdef RENDER_SHADOWS #ifdef FLOOD_LIGHT float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); #else float shadowed_lighting_factor; #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); #endif #else color.rgb=apply_lighting(color.rgb,normal); #ifdef FLOOD_LIGHT color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); #endif #endif color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); #endif #ifdef INDICATOR_CUTOUT color=applyCutout(color,h); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) out vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) out highp vec3 v_normal; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec2 v_ao; #endif #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) out float v_flood_radius;out float v_has_floodlight; #endif out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define highp float flood_light_wall_radius #pragma mapbox: define highp float line_width #pragma mapbox: define highp float emissive_strength void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize highp float flood_light_wall_radius #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp float emissive_strength base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) v_normal=normal; #endif base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif float cutoff=1.0;vec3 scaled_pos=pos; #ifdef RENDER_CUTOFF vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0); #ifdef CLIP_ZERO_TO_ONE cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); #else cutoff=cutoff_opacity(u_cutoff_params,ground.z); #endif if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); #endif float NdotL=0.0;float colorvalue=0.0; #ifndef LIGHTING_3D_MODE colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #endif #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; #endif v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); #else v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),fillExtrusionDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp float line_width #pragma mapbox: define highp vec4 color out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp vec4 color base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else pos=vec3(pos_nx.xy,t > 0.0 ? height : base); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_EXTRUSION_PATTERN_TRANSITION uniform float u_pattern_transition; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE in vec3 v_normal; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio void main() { #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_EXTRUSION_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; #else out_color=out_color*v_lighting; #endif #ifdef FAUX_AO float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,height); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif out highp vec2 v_pos;out vec4 v_lighting; #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE out vec3 v_normal; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio #pragma mapbox: define highp float line_width void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio #pragma mapbox: initialize highp float line_width vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=z;vec3 p;float c_ele; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); #else p=vec3(pos_nx.xy,z); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 ? pos_nx.xy : vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; #ifdef LIGHTING_3D_MODE NdotL=calculate_NdotL(normal); #else NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); #endif if (normal.y !=0.0) {float r=0.84; #ifndef LIGHTING_3D_MODE r=mix(0.7,0.98,1.0-u_lightintensity); #endif NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE v_normal=normal; #else v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(p); #endif }`),groundShadow:Xs(`#include "_prelude_shadow.fragment.glsl" precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #ifdef FOG in float v_fog_opacity; #endif void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); #ifdef RENDER_CUTOFF shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); #endif #ifdef FOG shadow=mix(shadow,vec3(1.0),v_fog_opacity); #endif #ifdef INDICATOR_CUTOUT shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); #endif glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #ifdef FOG out float v_fog_opacity; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); #ifdef FOG v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); #endif }`),fillExtrusionGroundEffect:Xs(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; #ifdef SDF_SUBPASS in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} #ifdef FOG in highp float v_fog; #endif #endif void main() { #ifdef CLEAR_SUBPASS vec4 color=vec4(1.0); #ifdef CLEAR_FROM_TEXTURE color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); #endif glFragColor=color; #else #ifdef SDF_SUBPASS highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; #ifdef FOG fog=v_fog; #endif #ifdef RENDER_CUTOFF fog*=v_cutoff_opacity; #endif glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); #else #ifdef USE_MRT1 out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); #else vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); #ifdef OVERDRAW_INSPECTOR color=vec4(1.0); #endif glFragColor=color; #endif #endif HANDLE_WIREFRAME_DEBUG; #endif }`,`#include "_prelude_fog.vertex.glsl" in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; #ifdef SDF_SUBPASS out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; #ifdef FOG out highp float v_fog; #endif #endif uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao; #pragma mapbox: define highp float flood_light_ground_radius const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { #pragma mapbox: initialize highp float flood_light_ground_radius vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; #ifdef SDF_SUBPASS v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); #ifdef FOG v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); #endif #endif float hidden_by_landmark=0.0; #ifdef HAS_CENTROID hidden_by_landmark=a_hidden_by_landmark; #endif float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),hillshadePrepare:Xs(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( (c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) )/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; #ifdef LIGHTING_3D_MODE glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); #endif #ifdef FOG glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),line:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform sampler2D u_dash_image;in vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform sampler2D u_gradient_image; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha; #ifdef RENDER_LINE_DASH float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); #endif highp vec4 out_color; #ifdef RENDER_LINE_GRADIENT out_color=texture(u_gradient_image,v_uv.xy); #ifdef MULTIPLY_LINE_GRADIENT_COLOR out_color*=color; #endif #else out_color=color; #endif float trim_alpha=1.0; #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;} #endif if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} #ifdef RENDER_LINE_BORDER float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}} #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=(alpha*opacity); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define EXTRUDE_SCALE 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) in vec3 a_z_offset_width; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) in highp vec3 a_packed; #endif #ifdef RENDER_LINE_DASH in float a_linesofar; #endif uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform float u_image_height; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth; #ifdef VARIABLE_LINE_WIDTH bool left=normal.y==1.0;halfwidth=(u_width_scale*(left ? a_z_offset_width.y : a_z_offset_width.z))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal; #else halfwidth=(u_width_scale*width)/2.0; #endif offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; #ifdef RENDER_LINE_GRADIENT highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); #else v_uv=vec3(a_uv_x,0.0,line_progress); #endif #endif #ifdef RENDER_LINE_DASH float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y); #endif v_width2=vec2(outset,inset); #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),linePattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef LINE_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef LINE_JOIN_NONE in vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize lowp float emissive_strength vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif #ifdef LINE_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} #endif #ifdef LINE_JOIN_NONE highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} #endif #ifdef LIGHTING_3D_MODE color=apply_lighting_with_emission_ground(color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_z_offset); #endif glFragColor=color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) in vec3 a_z_offset_width; #endif #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 a_packed; #endif in highp float a_linesofar; #ifdef LINE_JOIN_NONE in highp vec3 a_pattern_data;out vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; #ifdef RENDER_LINE_TRIM_OFFSET out highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define mediump float offset #pragma mapbox: define mediump float gapwidth #pragma mapbox: define mediump float width #pragma mapbox: define mediump float floorwidth #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize mediump float offset #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float floorwidth #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); #endif v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); #ifdef LINE_JOIN_NONE v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),raster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_raster_array.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; #ifdef PROJECTION_GLOBE_VIEW in float v_split_fade; #endif uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; #ifndef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1; #endif #ifdef RASTER_COLOR uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; #endif void main() {vec4 color0,color1,color;vec2 value; #ifdef RASTER_COLOR #ifdef RASTER_ARRAY #ifdef RASTER_ARRAY_LINEAR value=mix( raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #else value=mix( raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #endif if (value.y > 0.0) value.x/=value.y; #else color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); #endif color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; #else color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); #endif color.a*=u_opacity; #ifdef GLOBE_POLES color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); #endif vec3 rgb=color.rgb;rgb=vec3( dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef PROJECTION_GLOBE_VIEW glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); #endif #ifdef RENDER_CUTOFF glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos;in vec2 a_texture_pos; #endif out vec2 v_pos0;out vec2 v_pos1;out float v_depth; #ifdef PROJECTION_GLOBE_VIEW out float v_split_fade; #endif void main() {vec2 uv; #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); #endif #else float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; #ifdef RENDER_CUTOFF v_depth=gl_Position.z; #endif }`),rasterParticle:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Xs("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Xs("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Xs(`#include "_prelude_raster_particle.glsl" uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) );highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Xs(`#include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #define SDF_PX 8.0 #define SDF 1.0 #define ICON 0.0 uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; #ifdef ICON_TRANSITION uniform float u_icon_transition; #endif #ifdef COLOR_ADJUSTMENT uniform mat4 u_color_adj_mat; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #else #ifdef RENDER_SHADOWS in highp float v_z_offset; #endif #endif in vec2 v_tex_a; #ifdef ICON_TRANSITION in vec2 v_tex_b; #endif in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL in float is_sdf;in vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; #ifdef RENDER_TEXT_AND_SYMBOL if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif return;} #endif #ifdef RENDER_SDF float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; #else #ifdef ICON_TRANSITION vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); #else out_color=texture(u_texture,v_tex_a); #endif #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef COLOR_ADJUSTMENT out_color=u_color_adj_mat*out_color; #endif #endif out_color*=opacity*fade_opacity; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef TERRAIN out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #else out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #endif #endif #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #define APPEARANCE_ICON 1.0 in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; #ifdef Z_OFFSET in float a_auto_z_offset; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_globe_anchor;in vec3 a_globe_normal; #endif #ifdef ICON_TRANSITION in vec2 a_texb; #endif #ifdef OCCLUSION_QUERIES in float a_occlusion_query_opacity; #endif #ifdef ELEVATED_ROADS in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #else #ifdef RENDER_SHADOWS out highp float v_z_offset; #endif #endif uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; #endif out vec2 v_tex_a; #ifdef ICON_TRANSITION out vec2 v_tex_b; #endif out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL out float is_sdf;out vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength #pragma mapbox: define lowp float occlusion_opacity #pragma mapbox: define lowp float z_offset void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength #pragma mapbox: initialize lowp float occlusion_opacity #pragma mapbox: initialize lowp float z_offset vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance_icon=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance_icon==APPEARANCE_ICON) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); #ifdef Z_OFFSET e+=a_auto_z_offset; #endif vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; #ifdef PROJECTION_GLOBE_VIEW mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; #else world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; #endif vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; #ifdef PROJECTION_GLOBE_VIEW vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; #else offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; #endif vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; #ifdef PROJECTION_GLOBE_VIEW #ifdef PROJECTED_POS_ON_VIEWPORT projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); #else vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); #endif #else projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); #endif highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); #ifdef TERRAIN #ifdef PITCH_WITH_MAP_TERRAIN vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); #endif #endif #ifdef Z_OFFSET z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; #else z+=u_pitch_with_map ? z_offset : 0.0; #endif float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); #ifdef DEPTH_OCCLUSION float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; #endif #ifdef OCCLUSION_QUERIES float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; #endif #ifdef Z_TEST_OCCLUSION out_fade_opacity*=occlusion_opacity; #endif float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else #ifdef ELEVATED_ROADS vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else pos=vec3(projected_pos.xy/projected_pos.w+offset,z); #endif #endif gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; #ifdef RENDER_TEXT_AND_SYMBOL is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; #endif #ifdef ICON_TRANSITION v_tex_b=a_texb/u_texsize; #endif #ifdef RENDER_SHADOWS vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef INDICATOR_CUTOUT v_z_offset=e; #else #ifdef RENDER_SHADOWS v_z_offset=e; #endif #endif }`),terrainRaster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif in vec2 v_pos0; #ifdef FOG in float v_fog_opacity; #endif #ifdef RENDER_SHADOWS in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #endif uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; #ifdef LIGHTING_3D_MODE const vec3 normal=vec3(0.0,0.0,1.0); #ifdef RENDER_SHADOWS float cutoffOpacity=1.0; #ifdef RENDER_CUTOFF cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); #endif #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; #else float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); #endif #else float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0; #endif #endif #else color=image_color; #endif #ifdef FOG #ifdef ZERO_EXAGGERATION color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #else color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); #endif #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; #ifdef FOG out float v_fog_opacity; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #endif void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); #ifdef FOG #ifdef ZERO_EXAGGERATION v_fog_pos=fog_position(decodedPos); #else v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); #endif #endif #ifdef RENDER_SHADOWS vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); #endif }`),terrainDepth:Xs("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Xs(`#include "_prelude_fog.fragment.glsl" in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; #ifdef FOG sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); #endif sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,jk),skyboxGradient:Xs(`#include "_prelude_fog.fragment.glsl" in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); #ifdef FOG color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; #endif color*=u_opacity;glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,jk),skyboxCapture:Xs(` in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; #define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) #define BETA_M vec3(21e-6,21e-6,21e-6) #define MIE_G 0.76 #define DENSITY_HEIGHT_SCALE_R 8000.0 #define DENSITY_HEIGHT_SCALE_M 1200.0 #define PLANET_RADIUS 6360e3 #define ATMOSPHERE_RADIUS 6420e3 #define SAMPLE_STEPS 10 #define DENSITY_STEPS 4 float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif uniform float u_far_z_cutoff;in vec2 v_pos0; #ifndef FOG uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; #endif void main() {vec4 color; #ifdef CUSTOM_ANTIALIASING highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); #else raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0; #else color=apply_lighting_ground(color); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos; #endif out vec2 v_pos0;void main() { #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; #else float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); #endif v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; #ifdef GLOBE_POLES vec3 up_vector=globe_derived_up_vector; #else vec3 up_vector=elevationVector(tile_pos); #endif float height=elevation(tile_pos);globe_pos+=up_vector*height; #ifndef GLOBE_POLES globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; #endif #ifdef GLOBE_POLES vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); #else vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); #endif gl_Position=u_proj_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif }`),globeAtmosphere:Xs(`#include "_prelude_fog.fragment.glsl" uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; #ifdef PROJECTION_GLOBE_VIEW globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { #ifdef ALPHA_PASS glFragColor=vec4(0,0,0,0);return; #else #ifdef NATIVE glFragColor=vec4(1,1,1,1); #else glFragColor=vec4(0,0,0,1); #endif return; #endif } #endif highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; #ifdef PROJECTION_GLOBE_VIEW highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); #else horizon_angle=horizon_angle_mercator; #endif horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb; #ifdef ALPHA_PASS float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); #else vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); #endif }`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; #endif #ifdef OCCLUSION_TEXTURE_TRANSFORM uniform vec4 u_occlusionTextureTransform; #endif #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute highp vec2 uv_2f #ifdef HAS_ATTRIBUTE_a_pbr in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; #endif #ifdef HAS_TEXTURE_u_baseColorTexture uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; #endif #ifdef HAS_TEXTURE_u_metallicRoughnessTexture uniform sampler2D u_metallicRoughnessTexture; #endif #ifdef HAS_TEXTURE_u_occlusionTexture uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; #endif #ifdef HAS_TEXTURE_u_normalTexture uniform sampler2D u_normalTexture; #endif #ifdef HAS_TEXTURE_u_emissionTexture uniform sampler2D u_emissionTexture; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; #ifdef DEPTH_D24 highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} #else highp float unpack_depth_rgba(highp vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; #ifdef FLIP_Y coord.y=1.0-coord.y; #endif #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depthTexture,coord).r); #else highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); #endif return v_depth > depth+0.0005;} #endif #define saturate(_x) clamp(_x,0.,1.) vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) { #ifdef LIGHTING_3D_MODE vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); #endif return apply_lighting(albedo,transformed_normal,lighting_factor); #else vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3; #endif }vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; #ifdef HAS_ATTRIBUTE_a_color_3f albedo*=vec4(color_3f,1.0); #endif #ifdef HAS_ATTRIBUTE_a_pbr #else #ifdef HAS_ATTRIBUTE_a_color_4f albedo*=color_4f; #endif #endif #if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} #ifdef UNPREMULT_TEXTURE_IN_SHADER if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; #endif if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} #endif vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { #ifdef HAS_TEXTURE_u_normalTexture highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y; #ifdef FLIP_Y T=-T;B=-B; #endif highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; #else return mat3(1.0); #endif }highp vec3 getNormal(){highp vec3 n; #ifdef HAS_ATTRIBUTE_a_normal_3f n=normalize(normal_3f); #else highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z)); #ifdef FLIP_Y n=normalize(cross(fdx,fdy)); #else n=normalize(cross(fdx,fdy))*-1.0; #endif #endif #if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); #endif return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; #ifdef HAS_ATTRIBUTE_a_pbr mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; #endif #if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; #endif const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) {float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) {return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) {float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) {highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) {float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) { #ifdef LIGHTING_3D_MODE return mat.diffuseColor; #else return mat.diffuseColor/PI; #endif }vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) {vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) {vec3 env_light=vec3(0.65,0.65,0.65); #ifdef LIGHTING_3D_MODE float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; #endif vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) {highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=NdotL; #endif vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; #if !defined(LIGHTING_3D_MODE) const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); #endif color*=intensityFactor;return color;}void main() { #ifdef TERRAIN_FRAGMENT_OCCLUSION if (isOccluded()) {discard;} #endif vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; #ifdef LIGHTING_3D_MODE lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; #endif vec4 finalColor; #ifdef DIFFUSE_SHADED vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); #ifdef HAS_TEXTURE_u_occlusionTexture float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; #endif finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; #else Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; #if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) #ifdef OCCLUSION_TEXTURE_TRANSFORM vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; #else vec2 uv=uv_2f; #endif ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; #endif vec4 emissive=u_emissiveFactor; #if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); #endif #ifdef APPLY_LUT_ON_GPU float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; #endif color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; #ifdef HAS_ATTRIBUTE_a_pbr float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; #ifdef APPLY_LUT_ON_GPU color_mix=applyLUT(u_lutTexture,color_mix); #endif color=mix(color,color_mix,min(1.0,resEmission)); #ifdef HAS_ATTRIBUTE_a_color_4f float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); #endif #endif vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); #endif #ifdef FOG finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); #endif #ifdef RENDER_CUTOFF finalColor*=v_cutoff_opacity; #endif #ifdef INDICATOR_CUTOUT finalColor=applyCutout(finalColor,v_position_height.w); #endif #ifdef FEATURE_CUTOUT finalColor=apply_feature_cutout(finalColor,gl_FragCoord); #endif glFragColor=finalColor; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f; #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr #pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_normal_matrix; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; #endif out vec4 v_position_height;out lowp vec4 v_color_mix; #ifdef TERRAIN_FRAGMENT_OCCLUSION out highp float v_depth; #endif #ifdef HAS_ATTRIBUTE_a_pbr out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; #endif vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute-custom highp vec4 pbr #pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength highp mat4 normal_matrix; #ifdef INSTANCED_ARRAYS normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else normal_matrix=u_normal_matrix; #endif vec3 local_pos;mat3 rs; #ifdef MODEL_POSITION_ON_GPU vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; #else local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); #endif v_position_height.w=a_pos_3f.z; #ifdef HAS_ATTRIBUTE_a_pbr vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; #endif #ifdef FOG v_fog_pos=fog_position(local_pos); #endif #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION v_depth=gl_Position.z/gl_Position.w; #ifdef CLIP_ZERO_TO_ONE v_depth=-1.0+2.0*v_depth; #endif #endif #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); #else normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); #endif #endif #ifdef HAS_ATTRIBUTE_a_pbr #ifdef HAS_ATTRIBUTE_a_color_4f v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); #endif #endif #ifdef RENDER_SHADOWS vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); #ifdef NORMAL_OFFSET #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #else vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #endif #endif #endif v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; #endif }`),modelDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; #ifdef MODEL_POSITION_ON_GPU #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_instance; #endif uniform highp mat4 u_node_matrix; #endif void main() { #ifdef MODEL_POSITION_ON_GPU highp mat4 instance; #ifdef INSTANCED_ARRAYS instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else instance=u_instance; #endif vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); #else gl_Position=u_matrix*vec4(a_pos_3f,1); #endif v_depth=gl_Position.z/gl_Position.w;}`),stars:Xs(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) {float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Xs("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; uniform float u_horizontalOscillationRate; uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:Xs("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity; uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:Xs("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Xs("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; #ifdef TERRAIN float e=elevation(world_pos.xy);world_pos.z+=e; #endif vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Fm(_,d){const m=_.split(` `);for(let b of m){if(b=b.trimStart(),b[0]!=="#"||!b.includes("if")||b.startsWith("#endif"))continue;const M=b.match(U3);if(M)for(const L of M)Gg.has(L)||d.add(L)}}function Xs(_,d){const m=new Set,b=[],M=[];_=_.replace(jv,(D,B)=>(M.push(B),"")),d=d.replace(jv,(D,B)=>(b.push(B),""));let L=new Set(Kg);Fm(_,L),Fm(d,L);for(const D of[...b,...M])Ck[D]||(Ck[D]=new Set,Fm(Rm[D],Ck[D])),L=new Set([...L,...Ck[D]]);return{fragmentSource:_=_.replace(mf,(D,B,V,Y,Q)=>(m.add(Q),B==="define"?` #ifndef HAS_UNIFORM_u_${Q} in ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${Q} ${V} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} ${Q}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(mf,(D,B,V,Y,Q)=>{const le=`MATERIAL_ATTRIBUTE_OFFSET_${Q}`,oe=Y==="float"?"vec2":Y,ce=`GET_ATTRIBUTE_${oe}(a_${Q}, materialInfo, ${le})`,je=Q.match(/color/)?"color":oe;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; #endif `:m.has(Q)?B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${le}) in ${V} ${oe} a_${Q}; #endif out ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize"?je==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} ${Q} = a_${Q}; #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #if !defined(HAS_UNIFORM_u_${Q}) #ifdef ${le} ${Q} = unpack_mix_${je}(${ce}, u_${Q}_t); #else ${Q} = unpack_mix_${je}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; out ${V} ${Y} ${Q}; #endif `:B==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${Q} = a_${Q}; #endif `:void 0:B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${le}) in ${V} ${oe} a_${Q}; #endif #else uniform ${V} ${Y} u_${Q}; #endif `:B==="define-instanced"?je==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${Q}0; in vec4 a_${Q}1; in vec4 a_${Q}2; in vec4 a_${Q}3; #else uniform ${V} ${Y} u_${Q}; #endif `:` #ifdef INSTANCED_ARRAYS in ${V} ${oe} a_${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${V} ${Y} ${Q} = a_${Q}; #endif `:je==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${le} ${V} ${Y} ${Q} = ${ce}; #else ${V} ${Y} ${Q} = a_${Q}; #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${le} ${V} ${Y} ${Q} = unpack_mix_${je}(${ce}, u_${Q}_t); #else ${V} ${Y} ${Q} = unpack_mix_${je}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `}),usedDefines:L,vertexIncludes:b,fragmentIncludes:M}}class Yie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,m,b,M,L,D,B,V){this.context=d;let Y=this.boundPaintVertexBuffers.length!==M.length;for(let le=0;!Y&&le{const xt=Ze.paint.get("hillshade-shadow-color"),lt=Ze.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ft=Ze.paint.get("hillshade-highlight-color"),ot=Ze.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",st=Ze.paint.get("hillshade-accent-color"),bt=Ze.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Ot=Ze.paint.get("hillshade-emissive-strength");let Pt=a.an(Ze.paint.get("hillshade-illumination-direction"));if(Ze.paint.get("hillshade-illumination-anchor")==="viewport")Pt-=Pe.transform.angle;else if(Pe.style&&Pe.style.enable3dLights()&&Pe.style.directionalLight){const Ht=Pe.style.directionalLight.properties.get("direction"),sr=a.d4(Ht.x,Ht.y,Ht.z);Pt=a.an(sr[1])}const Vt=!Pe.options.moving;return{u_matrix:qe||Pe.transform.calculateProjMatrix($e.tileID.toUnwrapped(),Vt),u_image:0,u_latrange:Xie(0,$e.tileID),u_light:[Ze.paint.get("hillshade-exaggeration"),Pt],u_shadow:xt.toPremultipliedRenderColor(lt?null:Ze.lut),u_highlight:ft.toPremultipliedRenderColor(ot?null:Ze.lut),u_emissive_strength:Ot,u_accent:st.toPremultipliedRenderColor(bt?null:Ze.lut)}})(_,m,b,_.terrain?d.projMatrix:null);_.uploadCommonUniforms(B,oe,d.toUnwrapped());const{tileBoundsBuffer:je,tileBoundsIndexBuffer:ve,tileBoundsSegments:Le}=_.getTileBoundsBuffers(m);oe.draw(_,V.TRIANGLES,M,L,D,Bn.disabled,ce,b.id,je,ve,Le)}function V3(_,d,m){if(!d.needsDEMTextureUpload)return;const b=_.context,M=b.gl;b.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||_.getTileTexture(m.stride);const L=m.getPixels();d.demTexture?d.demTexture.update(L,{premultiply:!1}):d.demTexture=new a.T(b,L,M.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function Jie(_,d,m){const b=_.context,M=b.gl;if(!d.dem)return;const L=d.dem;if(b.activeTexture.set(M.TEXTURE1),V3(_,d,L),!d.demTexture)return;d.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);const D=L.dim;b.activeTexture.set(M.TEXTURE0);let B=d.hillshadeFBO;if(!B){const oe=new a.T(b,{width:D,height:D,data:null},M.RGBA8);oe.bind(M.LINEAR,M.CLAMP_TO_EDGE),B=d.hillshadeFBO=b.createFramebuffer(D,D,1,"renderbuffer"),B.colorAttachment0.set(oe.texture)}b.bindFramebuffer.set(B.framebuffer),b.viewport.set([0,0,D,D]);const{tileBoundsBuffer:V,tileBoundsIndexBuffer:Y,tileBoundsSegments:Q}=_.getMercatorTileBoundsBuffers(),le=[];_.linearFloatFilteringSupported()&&le.push("TERRAIN_DEM_FLOAT_FORMAT"),_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&le.push("USE_MRT1"),_.getOrCreateProgram("hillshadePrepare",{defines:le}).draw(_,M.TRIANGLES,un.disabled,$n.disabled,is.unblended,Bn.disabled,((oe,ce)=>{const je=ce.stride,ve=a.bC();return a.ce(ve,0,a.al,-a.al,0,0,1),a.br(ve,ve,[0,-a.al,0]),{u_matrix:ve,u_image:1,u_dimension:[je,je],u_zoom:oe.overscaledZ}})(d.tileID,L),m.id,V,Y,Q),d.needsHillshadePrepare=!1}class ja{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class eae extends ja{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class eP extends ja{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class H3 extends ja{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class Tk extends ja{getDefault(){return[!0,!0,!0,!0]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class W3 extends ja{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class Zg extends ja{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Cy extends ja{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const m=this.current;(d.func!==m.func||d.ref!==m.ref||d.mask!==m.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class kv extends ja{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class My extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.STENCIL_TEST):m.disable(m.STENCIL_TEST),this.current=d,this.dirty=!1}}class tP extends ja{getDefault(){return[0,1]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class G3 extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),this.current=d,this.dirty=!1}}class rP extends ja{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Ty extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.BLEND):m.disable(m.BLEND),this.current=d,this.dirty=!1}}class Ak extends ja{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Ek extends ja{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class K3 extends ja{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(d,d),this.current=d,this.dirty=!1)}}class Ik extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.CULL_FACE):m.disable(m.CULL_FACE),this.current=d,this.dirty=!1}}class Nv extends ja{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class nP extends ja{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let sP=class extends ja{getDefault(){return null}set(_){(_!==this.current||this.dirty)&&(this.gl.useProgram(_),this.current=_,this.dirty=!1)}};class iP extends ja{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class Ay extends ja{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class aP extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class tae extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class rae extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindTexture(m.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class nae extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindBuffer(m.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Z3 extends ja{getDefault(){return null}set(d){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Y3 extends ja{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class X3 extends ja{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class Q3 extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class oP extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Pk extends ja{constructor(d,m){super(d),this.context=d,this.parent=m}getDefault(){return null}}class Lk extends Pk{constructor(d,m,b=0){super(d,m),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+b}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachmentPoint,m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class Ey extends Pk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferRenderbuffer(m.FRAMEBUFFER,this.attachment(),m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Sv extends Pk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachment(),m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class lP extends Ey{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const lu=(_,d,m,b)=>({u_matrix:_,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:m,u_emissive_texture_available:b}),Ok=(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le)=>({u_proj_matrix:Float32Array.from(_),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(b),u_merc_matrix:m,u_zoom_transition:M,u_merc_center:L,u_image0:0,u_image1:1,u_frustum_tl:D,u_frustum_tr:B,u_frustum_br:V,u_frustum_bl:Y,u_globe_pos:Q,u_globe_radius:le,u_viewport:oe,u_grid_matrix:Le?Float32Array.from(Le):new Float32Array(9),u_skirt_height:ce,u_far_z_cutoff:je,u_emissive_texture_available:ve});function Cv(_,d){return _!=null&&d!=null&&!(!_.hasData()||!d.hasData())&&_.demTexture!=null&&d.demTexture!=null&&_.tileID.key!==d.tileID.key}const vp=new class{constructor(){this.operations={}}newMorphing(_,d,m,b,M){if(_ in this.operations){const L=this.operations[_];L.to.tileID.key!==m.tileID.key&&(L.queued=m)}else this.operations[_]={startTime:b,phase:0,duration:M,from:d,to:m,queued:null}}getMorphValuesForProxy(_){if(!(_ in this.operations))return null;const d=this.operations[_];return{from:d.from,to:d.to,phase:d.phase}}update(_){for(const d in this.operations){const m=this.operations[d];for(m.phase=(_-m.startTime)/m.duration;m.phase>=1||!this._validOp(m);)if(!this._nextOp(m,_)){delete this.operations[d];break}}}_nextOp(_,d){return!!_.queued&&(_.from=_.to,_.to=_.queued,_.queued=null,_.phase=0,_.startTime=d,!0)}_validOp(_){return _.from.hasData()&&_.to.hasData()}},Dk={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Rk(_,d,m){if(d===0)return 0;const b=d<1&&m===514?.25/d:1;return 6*Math.pow(1.5,22-_)*Math.max(d,1)*b}function J3(_,d){const m=1<<_.z;return!d&&(_.x===0||_.x===m-1)||_.y===0||_.y===m-1}function Iy(_,d){if(!_.style||!_.style.enable3dLights())return;const m=_.context,b=m.gl;m.activeTexture.set(b.TEXTURE1),d?d.bind(b.LINEAR,b.CLAMP_TO_EDGE):_.emptyTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE)}const Mv=_=>({u_matrix:_});function Tv(_,d,m,b,M){if(M>0){const L=a.o.now(),D=(L-_.timeAdded)/M,B=d?(L-d.timeAdded)/M:-1,V=m.getSource(),Y=b.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Q=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(_.tileID.overscaledZ-Y),le=Q&&_.refreshedUponExpiration?1:a.aA(Q?D:1-B,0,1);return d?{opacity:1,mix:1-le,isFading:D<1}:{opacity:le,mix:0,isFading:D<1}}return{opacity:1,mix:0,isFading:!1}}class Fk extends Yc{constructor(d){const m=zo("mock-dem",{type:"raster-dem",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("mock-dem",m,!1),m.setEventedParent(this),this._sourceLoaded=!0}_loadTile(d,m){d.state="loaded",m(null)}}class e5 extends Yc{constructor(d){const m=zo("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",m,!1),m.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,m,b){if(d.freezeTileCoverage)return;this.transform=d;const M=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((L,D)=>{if(L[D.key]="",!this._tiles[D.key]){const B=new fp(D,this._source.tileSize*D.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);B.state="loaded",this._tiles[D.key]=B}return L},{});for(const L in this._tiles)L in M||(this.freeFBO(L),this._tiles[L].unloadVectorData(),delete this._tiles[L])}freeFBO(d){const m=this.proxyCachedFBO[d];if(m!==void 0){const b=Object.values(m);this.renderCachePool.push(...b),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class t5 extends a.aQ{constructor(d,m,b){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=m,this.projMatrix=b}}class r5 extends a.bV{constructor(d,m){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[b,M,L]=function(V){const Y=new a.bd,Q=new a.b0,le=131;Y.reserve(17161),Q.reserve(33800);const oe=a.al/128,ce=a.al+oe/2,je=ce+oe;for(let Le=-oe;Lece||Le<0||Le>ce?24575:0,Ze=a.aA(Math.round(Pe),0,a.al),qe=a.aA(Math.round(Le),0,a.al);Y.emplaceBack(Ze+$e,qe)}const ve=(Le,Pe)=>{const $e=Pe*le+Le;Q.emplaceBack($e+1,$e,$e+le),Q.emplaceBack($e+le,$e+le+1,$e+1)};for(let Le=1;Le<129;Le++)for(let Pe=1;Pe<129;Pe++)ve(Pe,Le);return[0,129].forEach(Le=>{for(let Pe=0;Pe<130;Pe++)ve(Pe,Le),ve(Le,Pe)}),[Y,Q,32768]}(),D=d.context;this.gridBuffer=D.createVertexBuffer(b,a.bf.members),this.gridIndexBuffer=D.createIndexBuffer(M),this.gridSegments=a.bg.simpleSegment(0,0,b.length,M.length),this.gridNoSkirtSegments=a.bg.simpleSegment(0,0,b.length,L),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new e5(m.map),this.orthoMatrix=a.bC(),a.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,a.al,0,a.al,0,1);const B=D.gl;this._overlapStencilMode=new $n({func:B.GEQUAL,mask:255},0,255,B.KEEP,B.KEEP,B.REPLACE),this._previousZoom=d.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=m,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Fk(m.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(d){d.on("data",this._onStyleDataEvent.bind(this)),this._style=d,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(d,m,b){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const M=d.terrain.properties,L=d.terrain.drapeRenderMode===0,D=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=a.o.now();const B=d.terrain&&d.terrain.scope,V=M.get("source"),Y=L?this._mockSourceCache:d.getSourceCache(V,B);if(!Y)return void a.w(`Couldn't find terrain source "${V}".`);if(this.sourceCache=Y,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=D?this.calculateExaggeration(m):M.get("exaggeration"),!m.projection.requiresDraping&&D&&this._exaggeration===0)return void this._disable();this.enabled=!0;const Q=()=>{this.sourceCache.used&&a.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const le=this.getScaledDemTileSize();this.sourceCache.update(m,le,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,Q(),this._initializing=!0),Q(),m.updateElevation(!0,b),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(m),this._emptyDEMTextureDirty=!0,this._previousZoom=m.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const m=this._previousCameraAltitude,b=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=b;const M=m!=null?b-m:Number.MAX_VALUE;if(Math.abs(M)<2)return this._exaggeration;const L=d.zoom,D=this._style.terrain;if(!this._previousUpdateTimestamp)return D.getExaggeration(L);let B=L-this._previousZoom;const V=this._previousUpdateTimestamp;let Y=L;this._evaluationZoom!=null&&(Y=this._evaluationZoom,Math.abs(L-Y)>.5&&(B=.5*(L-Y+B)),B*M<0&&(Y+=B)),this._evaluationZoom=Y;const Q=D.getExaggeration(Y),le=Q===D.getExaggeration(Math.max(0,Y-.1));if(le&&Math.abs(Q-this._exaggeration)<.01)return Q;let oe=Math.min(.1,.00375*(this._updateTimestamp-V));return(le||Q<.1||Math.abs(B)<1e-4)&&(oe=Math.min(.2,4*oe)),a.ak(this._exaggeration,Q,oe)}resetTileLookupCache(d){this._findCoveringTileCache[d]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(d){d.dataType==="source"&&d.coord?this._clearRenderCacheForTile(d.sourceCacheId,d.coord):d.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const d in this._style._mergedSourceCaches)this._style._mergedSourceCaches[d].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(d=>d.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const d=2*this.proxySourceCache.getSource().tileSize;return[d,d]}set useVertexMorphing(d){this._useVertexMorphing=d}updateTileBinding(d){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const m=this.proxySourceCache,b=this.painter.transform;this._initializing&&(this._initializing=b._centerAltitude===0&&this.getAtPointOrZero(a.ae.fromLngLat(b.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const M=this.proxyCoords=m.getIds().map(V=>{const Y=m.getTileByID(V).tileID;return Y.projMatrix=b.calculateProjMatrix(Y.toUnwrapped()),Y});(function(V,Y){const Q=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),le=new a.P(Q.x,Q.y);V.sort((oe,ce)=>{if(ce.overscaledZ-oe.overscaledZ)return ce.overscaledZ-oe.overscaledZ;const je=new a.P(oe.canonical.x+(1<{this.proxyToSource[V.key]={}}),this.terrainTileForTile={};const D=this._style._mergedSourceCaches;for(const V in D){const Y=D[V];if(!Y.used||(Y!==this.sourceCache&&this.resetTileLookupCache(Y.id),this._setupProxiedCoordsForOrtho(Y,d[V],L),Y.usedForTerrain))continue;const Q=d[V];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(Q)}this.proxiedCoords[m.id]=M.map(V=>new t5(V,V.key,this.orthoMatrix)),this._assignTerrainTiles(M),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(L),this.renderingToTexture=!1;const B={};this._visibleDemTiles=[];for(const V of this.proxyCoords){const Y=this.terrainTileForTile[V.key];if(!Y)continue;const Q=Y.tileID.key;Q in B||(this._visibleDemTiles.push(Y),B[Q]=Q)}}_assignTerrainTiles(d){this._initializing||d.forEach(m=>{if(this.terrainTileForTile[m.key])return;const b=this._findTileCoveringTileID(m,this.sourceCache);b&&(this.terrainTileForTile[m.key]=b)})}_prepareDEMTextures(){const d=this.painter.context,m=d.gl;for(const b in this.terrainTileForTile){const M=this.terrainTileForTile[b],L=M.dem;!L||M.demTexture&&!M.needsDEMTextureUpload||(d.activeTexture.set(m.TEXTURE1),V3(this.painter,M,L))}}_prepareDemTileUniforms(d,m,b,M){if(!m||m.demTexture==null)return!1;const L=d.tileID.canonical,D=Math.pow(2,m.tileID.canonical.z-L.z),B=M||"";return b[`u_dem_tl${B}`]=[L.x*D%1,L.y*D%1],b[`u_dem_scale${B}`]=D,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const m=this._visibleDemTiles.reduce((b,M)=>{if(!M.dem)return b;const L=M.dem.tree.minimums[0];return L>0&&d++,b+L},0);return d?m/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,m=d.gl;d.activeTexture.set(m.TEXTURE2);const b=this._getLoadedAreaMinimum(),M=new a.dL({width:1,height:1},new Float32Array([b]));this._emptyDEMTextureDirty=!1;let L=this._emptyDEMTexture;return L?L.update(M,{premultiply:!1}):L=this._emptyDEMTexture=new a.T(d,M,m.R32F,{premultiply:!1}),L}setupElevationDraw(d,m,b){const M=this.painter.context,L=M.gl,D={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};D.u_exaggeration=this.exaggeration();let B=null,V=null,Y=1;if(b&&b.morphing&&this._useVertexMorphing){const ce=b.morphing.srcDemTile,je=b.morphing.dstDemTile;Y=b.morphing.phase,ce&&je&&(this._prepareDemTileUniforms(d,ce,D,"_prev")&&(V=ce),this._prepareDemTileUniforms(d,je,D)&&(B=je))}const Q=ce=>ce&&ce.demTexture&&this.painter.linearFloatFilteringSupported()?L.LINEAR:L.NEAREST;let le=null;var oe;if(this.enabled?V&&B?(le=B.demTexture,M.activeTexture.set(L.TEXTURE4),V.demTexture.bind(Q(V),L.CLAMP_TO_EDGE),D.u_dem_lerp=Y):(B=this.terrainTileForTile[d.tileID.key],le=this._prepareDemTileUniforms(d,B,D)?B.demTexture:this.emptyDEMTexture):le=this.emptyDEMTexture,M.activeTexture.set(L.TEXTURE2),le&&(D.u_dem_size=(oe=le).size[0]===1?1:oe.size[0]-2,le.bind(Q(B),L.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(b&&b.useDepthForOcclusion,m,D),b&&b.useMeterToDem&&B){const ce=(1<{if(Pe===Ht)return;const sr=[Dk[Ht],"PROJECTION_GLOBE_VIEW"];Ze&&sr.push("CUSTOM_ANTIALIASING");const br=Y.isTileAffectedByFog(Vt);Le=Y.getOrCreateProgram("globeRaster",{defines:sr,overrideFog:br}),Pe=Ht},xt=Y.colorModeForRenderPass(),lt=new un(ve.LEQUAL,un.ReadWrite,Y.depthRangeFor3D);vp.update(ce);const ft=a.dF($e),ot=[a.aF($e.center.lng),a.aJ($e.center.lat)],st=Y.globeSharedBuffers,bt=[$e.width*a.o.devicePixelRatio,$e.height*a.o.devicePixelRatio],Ot=Float32Array.from($e.globeMatrix),Pt={useDenormalizedUpVectorScale:!0};{const Vt=Y.transform,Ht=Rk(Vt.zoom,Q.exaggeration(),Q.sourceCache._source.tileSize);Pe=-1;const sr=ve.TRIANGLES;for(const br of oe){const zt=le.getTile(br),Mt=$n.disabled,Yt=Q.prevTerrainTileForTile[br.key],qt=Q.terrainTileForTile[br.key];Cv(Yt,qt)&&vp.newMorphing(br.key,Yt,qt,ce,250),Iy(Y,zt.emissiveTexture),je.activeTexture.set(ve.TEXTURE0),zt.texture&&zt.texture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const ur=vp.getMorphValuesForProxy(br.key),Er=ur?1:0;ur&&Object.assign(Pt,{morphing:{srcDemTile:ur.from,dstDemTile:ur.to,phase:a.dD(ur.phase)}});const Gr=a.dG(br.canonical),Sr=a.dH(Gr.getCenter().lat),wr=a.dI(br.canonical,Gr,Sr,Vt.worldSize/Vt._pixelsPerMercatorPixel),on=a.bk(a.dJ(br.canonical)),en=Y.emissiveMode==="mrt-fallback"?1:0,$r=Ok(Vt.expandedFarZProjMatrix,Ot,ft,on,a.aj(Vt.zoom),ot,Vt.frustumCorners.TL,Vt.frustumCorners.TR,Vt.frustumCorners.BR,Vt.frustumCorners.BL,Vt.globeCenterInViewSpace,Vt.globeRadius,bt,Ht,Vt._farZ,en,wr);if(qe(br,Er),Le&&(Q.setupElevationDraw(zt,Le,Pt),Y.uploadCommonUniforms(je,Le,br.toUnwrapped()),st)){const[Kr,Nn,Yn]=st.getGridBuffers(Sr,Ht!==0);Le.draw(Y,sr,lt,Mt,xt,Bn.backCCW,$r,"globe_raster",Kr,Nn,Yn)}}}if(st&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const Vt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Ze&&Vt.push("CUSTOM_ANTIALIASING"),Le=Y.getOrCreateProgram("globeRaster",{defines:Vt});for(const Ht of oe){const{x:sr,y:br,z:zt}=Ht.canonical,Mt=br===0,Yt=br===(1<Kr.draw(Y,ve.TRIANGLES,lt,$n.disabled,xt,Bn.disabled,Ok($e.expandedFarZProjMatrix,wr,wr,on,0,ot,$e.frustumCorners.TL,$e.frustumCorners.TR,$e.frustumCorners.BR,$e.frustumCorners.BL,$e.globeCenterInViewSpace,$e.globeRadius,bt,0,$e._farZ,en),"globe_pole_raster",Nn,Er,Gr);Q.setupElevationDraw(Sr,Le,Pt),Y.uploadCommonUniforms(je,Le,Ht.toUnwrapped()),Mt&&Y.renderDefaultNorthPole&&$r(Le,qt),Yt&&Y.renderDefaultSouthPole&&(wr=a.cS(a.bC(),wr,[1,-1,1]),$r(Le,ur))}}}})(M,L,D,B,V);else{const Y=M.context,Q=Y.gl;let le,oe;const ce=M.shadowRenderer,je=Pm(M,M.longestCutoffRange),ve=xt=>{if(oe===xt)return;const lt=[];lt.push(Dk[xt]),je.shouldRenderCutoff&<.push("RENDER_CUTOFF"),ce&&(lt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ce.useNormalOffset&<.push("NORMAL_OFFSET")),le=M.getOrCreateProgram("terrainRaster",{defines:lt}),oe=xt},Le=M.colorModeForRenderPass(),Pe=new un(Q.LEQUAL,un.ReadWrite,M.depthRangeFor3D);vp.update(V);const $e=M.transform,Ze=Rk($e.zoom,L.exaggeration(),L.sourceCache._source.tileSize);let qe=[0,0,0];if(ce){const xt=M.style.directionalLight,lt=M.style.ambientLight;xt&<&&(qe=yp(M.style,xt,lt))}{oe=-1;const xt=Q.TRIANGLES,[lt,ft]=[L.gridIndexBuffer,L.gridSegments];for(const ot of B){const st=D.getTile(ot),bt=$n.disabled,Ot=L.prevTerrainTileForTile[ot.key],Pt=L.terrainTileForTile[ot.key];Cv(Ot,Pt)&&vp.newMorphing(ot.key,Ot,Pt,V,250),Iy(M,st.emissiveTexture),Y.activeTexture.set(Q.TEXTURE0),st.texture&&st.texture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const Vt=vp.getMorphValuesForProxy(ot.key),Ht=Vt?1:0;let sr;Vt&&(sr={morphing:{srcDemTile:Vt.from,dstDemTile:Vt.to,phase:a.dD(Vt.phase)}});const br=M.emissiveMode==="mrt-fallback"?1:0,zt=lu(ot.projMatrix,J3(ot.canonical,$e.renderWorldCopies)?Ze/10:Ze,qe,br);if(ve(Ht),!le)continue;L.setupElevationDraw(st,le,sr);const Mt=ot.toUnwrapped();ce&&ce.setupShadows(Mt,le),M.uploadCommonUniforms(Y,le,Mt,null,je),le.draw(M,xt,Pe,bt,Le,Bn.backCCW,zt,"terrain_raster",L.gridBuffer,lt,ft)}}}}(m,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,m.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const m=this.painter,b=this.painter.context,M=this.proxySourceCache,L=this.proxiedCoords[M.id],D=this._drapedRenderBatches.shift(),B=m.style.order,V=[];this._updateFBOs(m.emissiveMode==="mrt-fallback");let Y=0;for(const Q of L){const le=M.getTileByID(Q.proxyTileKey),oe=M.proxyCachedFBO[Q.key]?M.proxyCachedFBO[Q.key][d]:void 0,ce=oe!==void 0?M.renderCache[oe]:this.pool[Y++],je=oe!==void 0;if(le.texture=ce.tex,le.emissiveTexture=ce.emissiveTex,je&&!ce.dirty){V.push(le.tileID);continue}b.bindFramebuffer.set(ce.fb.framebuffer);const ve=b.gl;let Le;ve.drawBuffers(m.emissiveMode==="mrt-fallback"?[ve.COLOR_ATTACHMENT0,ve.COLOR_ATTACHMENT1]:[ve.COLOR_ATTACHMENT0]),this.renderedToTile=!1,ce.dirty&&(b.clear({color:a.ao.transparent,stencil:0}),ce.dirty=!1);for(let Pe=D.start;Pe<=D.end;++Pe){const $e=m.style._mergedLayers[B[Pe]];if($e.isHidden(m.transform.zoom))continue;const Ze=m.style.getLayerSourceCache($e),qe=Ze?this.proxyToSource[Q.key][Ze.id]:[Q];if(!qe)continue;const xt=qe;b.viewport.set([0,0,ce.fb.width,ce.fb.height]),Le!==(Ze?Ze.id:null)&&(this._setupStencil(ce,qe,$e,Ze),Le=Ze?Ze.id:null),m.renderLayer(m,Ze,$e,xt)}if(ve.drawBuffers([ve.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Pe of this._pendingGroundEffectLayers){const $e=m.style._mergedLayers[B[Pe]];if($e.isHidden(m.transform.zoom))continue;const Ze=m.style.getLayerSourceCache($e),qe=Ze?this.proxyToSource[Q.key][Ze.id]:[Q];if(!qe)continue;const xt=qe;b.viewport.set([0,0,ce.fb.width,ce.fb.height]),Le!==(Ze?Ze.id:null)&&(this._setupStencil(ce,qe,$e,Ze),Le=Ze?Ze.id:null),m.renderLayer(m,Ze,$e,xt)}this.renderedToTile?(ce.dirty=!0,V.push(le.tileID)):je||--Y,Y===5&&(Y=0,this.renderToBackBuffer(V))}return this.renderToBackBuffer(V),this.renderingToTexture=!1,b.bindFramebuffer.set(null),b.viewport.set([0,0,m.width,m.height]),D.end+1}postRender(){}isLayerOrderingCorrect(d){const m=d.order.length;let b=-1,M=m;for(let L=0;Lb}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(m=>m.dem).forEach(m=>{d=Math.min(d,m.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,m,b){if(!this._visibleDemTiles)return null;const M=this._visibleDemTiles.filter(L=>L.dem).map(L=>{const D=L.tileID,B=1<(L.t!==null?L.t:Number.MAX_VALUE)-(D.t!==null?D.t:Number.MAX_VALUE));for(const L of M){if(L.t==null)return null;const D=L.tile.dem.tree.raycast(L.minx,L.miny,L.maxx,L.maxy,d,m,b);if(D!=null)return D}return null}_createFBO(){const d=this.painter.context,m=d.gl,b=this.drapeBufferSize;d.activeTexture.set(m.TEXTURE0);const M=new a.T(d,{width:b[0],height:b[1],data:null},m.RGBA8);M.bind(m.LINEAR,m.CLAMP_TO_EDGE);const L=d.createFramebuffer(b[0],b[1],1,null);let D;return L.colorAttachment0.set(M.texture),this._emissiveTexture&&(D=new a.T(d,{width:b[0],height:b[1],data:null},m.R8),D.bind(m.LINEAR,m.CLAMP_TO_EDGE),L.createColorAttachment(d,1),L.colorAttachment1.set(D.texture)),L.depthAttachment=new lP(d,L.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,b[0],b[1]),this._stencilRef=0,L.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):L.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&m.texParameterf(m.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:L,tex:M,emissiveTex:D,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const m of this.pool)this._updateFBO(m,d);for(const m of this.proxySourceCache.renderCache)this._updateFBO(m,d);this._emissiveTexture=d}}_updateFBO(d,m){const b=d.fb,M=this.painter.context,L=M.gl,D=this.drapeBufferSize;if(m){const B=new a.T(M,{width:D[0],height:D[1],data:null},L.R8);B.bind(L.LINEAR,L.CLAMP_TO_EDGE),d.emissiveTex=B,b.createColorAttachment(M,1),b.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,b.removeColorAttachment(M,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const m=this._style._mergedLayers[d],b=m.isHidden(this.painter.transform.zoom);return m.type==="hillshade"||m.type==="custom"?!b&&m.shouldRedrape():!b&&m.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const b of this._style.getSources())if(b instanceof dp){d=!0;break}if(!d)return;const m={};for(let b=0;bV>B.end)||a.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=b}_setupRenderCache(d){const m=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,m.renderCache.length>m.renderCachePool.length){const D=Object.values(m.proxyCachedFBO);m.proxyCachedFBO={};for(let B=0;B=0;D--){const B=b[D];if(m.getTileByID(B.key),m.proxyCachedFBO[B.key]!==void 0){const V=d[B.key],Y=this.proxyToSource[B.key];let Q=0;for(const le in Y){const oe=Y[le],ce=V[le];if(!ce||ce.length!==oe.length||oe.some((je,ve)=>je!==ce[ve]||M[le]&&M[le].hasOwnProperty(je.key))){Q=-1;break}++Q}for(const le in m.proxyCachedFBO[B.key])m.renderCache[m.proxyCachedFBO[B.key][le]].dirty=Q<0||Q!==Object.values(V).length}}const L=[...this._drapedRenderBatches];L.sort((D,B)=>B.end-B.start-(D.end-D.start));for(const D of L)for(const B of b){if(m.proxyCachedFBO[B.key])continue;let V=m.renderCachePool.pop();V===void 0&&m.renderCache.length<50&&(V=m.renderCache.length,m.renderCache.push(this._createFBO())),V!==void 0&&(m.proxyCachedFBO[B.key]={},m.proxyCachedFBO[B.key][D.start]=V,m.renderCache[V].dirty=!0)}this._tilesDirty={}}_setupStencil(d,m,b,M){if(!M||!this._sourceTilesOverlap[M.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const L=this.painter.context,D=L.gl;if(m.length<=1)return void(this._overlapStencilType=!1);let B;if(b.isTileClipped())B=m.length,this._overlapStencilMode.test={func:D.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(m[0].overscaledZ>m[m.length-1].overscaledZ))return void(this._overlapStencilType=!1);B=1,this._overlapStencilMode.test={func:D.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+B>255&&(L.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=B,this._overlapStencilMode.ref=this._stencilRef,b.isTileClipped()&&this._renderTileClippingMasks(m,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(d){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[d.key]),this._overlapStencilMode):$n.disabled}_renderTileClippingMasks(d,m){const b=this.painter,M=this.painter.context,L=M.gl;b._tileClippingMaskIDs={},M.setColorMode(is.disabled),M.setDepthMode(un.disabled);const D=b.getOrCreateProgram("clippingMask");for(const B of d){const V=b._tileClippingMaskIDs[B.key]=--m;D.draw(b,L.TRIANGLES,un.disabled,new $n({func:L.ALWAYS,mask:0},V,255,L.KEEP,L.KEEP,L.REPLACE),is.disabled,Bn.disabled,Mv(B.projMatrix),"$clipping",b.tileExtentBuffer,b.quadTriangleIndexBuffer,b.tileExtentSegments)}}pointCoordinate(d){const m=this.painter.transform;if(d.x<0||d.x>m.width||d.y<0||d.y>m.height)return null;const b=[d.x,d.y,1,1];a.aC(b,b,m.pixelMatrixInverse),a.cK(b,b,1/b[3]),b[0]/=m.worldSize,b[1]/=m.worldSize;const M=m._camera.position,L=a.cf(1,m.center.lat),D=[M[0],M[1],M[2]/L,0],B=a.da([],b.slice(0,3),D);a.aw(B,B);const V=this.raycast(D,B,this._exaggeration);return V!==null&&V?(a.bH(D,D,B,V),D[3]=D[2],D[2]*=L,D):null}_setupProxiedCoordsForOrtho(d,m,b){if(d.getSource()instanceof a.aU)return this._setupProxiedCoordsForImageSource(d,m,b);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const M=this.proxiedCoords[d.id]=[],L=this.proxyCoords;for(let V=0;VQ.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,m,b){if(!d.getSource().loaded())return;const M=this.proxiedCoords[d.id]=[],L=this.proxyCoords,D=d.getSource(),B=D.tileID;if(!B)return;const V=new a.P(B.x,B.y)._div(1<(le.min.x=Math.min(le.min.x,oe.x-V.x),le.min.y=Math.min(le.min.y,oe.y-V.y),le.max.x=Math.max(le.max.x,oe.x-V.x),le.max.y=Math.max(le.max.y,oe.y-V.y),le),{min:new a.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),Q=(le,oe)=>{const ce=le.wrap+le.canonical.x/(1<Le+Y.max.x||je+vePe+Y.max.y};for(let le=0;leD.key===m.tileID.key);if(L)return L}if(m.tileID.key!==d.key){const L=d.canonical.z-m.tileID.canonical.z;let D,B,V;M=a.bC();const Y=m.tileID.wrap-d.wrap<0?(D=a.al>>L,B=D*((m.tileID.canonical.x<=le){const oe=d.canonical.z-le;m.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,m.transform.tileZoom),D=new a.aQ(B,d.wrap,le,d.canonical.x>>oe,d.canonical.y>>oe)):oe!==0&&(B=le,D=new a.aQ(B,d.wrap,le,d.canonical.x>>oe,d.canonical.y>>oe))}D.key!==d.key&&(Y.push(D.key),b=m.getTile(D))}const Q=le=>{Y.forEach(oe=>{M[oe]=le}),Y.length=0};for(B-=1;B>=V&&(!b||!b.hasData());B--){b&&Q(b.tileID.key);const le=D.calculateScaledKey(B);if(b=m.getTileByID(le),b&&b.hasData())break;const oe=M[le];if(oe===null)break;oe===void 0?Y.push(le):b=m.getTileByID(oe)}return Q(b?b.tileID.key:null),b&&b.hasData()?b:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,m){let b=this._tilesDirty[d];b||(b=this._tilesDirty[d]={}),b[m.key]=!0}}function Py(_,d,m){const b=function(B,V,Y){const Q=a.bJ(V,B),le=a.bJ(Y,[.2126,.7152,.0722]),oe=(je,ve,Le)=>(1-Le)*je+Le*ve,ce=oe(1-.3*Math.min(le,1),1,Math.min(Q+1,1));return oe(.92,1,Math.asin(a.aA(V[2],-1,1))/Math.PI+.5)*ce}(_,[0,0,1],d),M=[0,0,0];a.c5(M,m.slice(0,3),b);const L=[0,0,0];a.c5(L,d.slice(0,3),_[2]);const D=[0,0,0];return a.d8(D,M,L),a.db(D)}const sae=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],iae=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class cP{static cacheKey(d,m,b,M){const L=[m];M&&L.push(M.cacheKey);for(const D of b)d.usedDefines.has(D)&&L.push(D);return L.join("/")}constructor(d,m,b,M,L,D){const B=d.gl;this.program=B.createProgram(),this.configuration=M,this.name=m,this.fixedDefines=[...D];const V=`#version 300 es ${(M?M.defines():[]).concat(D.map(ve=>`#define ${ve}`)).join(` `)}`,Y=[V,Zie];for(const ve of b.fragmentIncludes)Y.push(Rm[ve]);Y.push(b.fragmentSource);const Q=Y.join(` `),le=[V,JI];for(const ve of b.vertexIncludes)le.push(Rm[ve]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&b.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&le.push("uniform int u_instanceID;"),le.push(b.vertexSource);let oe=le.join(` `);this.forceManualRenderingForInstanceIDShaders&&(oe=oe.replaceAll("gl_InstanceID","u_instanceID"));const ce=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(ce,Q),B.compileShader(ce),B.attachShader(this.program,ce);const je=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(je,oe),B.compileShader(je),B.attachShader(this.program,je),this.attributes={},B.linkProgram(this.program),B.deleteShader(je),B.deleteShader(ce),this.fixedUniforms=L(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=M?M.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(ve=>({u_instanceID:new a.ch(ve)}))(d)),(D.includes("TERRAIN")||m.includes("symbol")||m.includes("circle"))&&(this.terrainUniforms=(ve=>({u_dem:new a.ch(ve),u_dem_prev:new a.ch(ve),u_dem_tl:new a.ck(ve),u_dem_scale:new a.cj(ve),u_dem_tl_prev:new a.ck(ve),u_dem_scale_prev:new a.cj(ve),u_dem_size:new a.cj(ve),u_dem_lerp:new a.cj(ve),u_exaggeration:new a.cj(ve),u_depth:new a.ch(ve),u_depth_size_inv:new a.ck(ve),u_depth_range_unpack:new a.ck(ve),u_occluder_half_size:new a.cj(ve),u_occlusion_depth_offset:new a.cj(ve),u_meter_to_dem:new a.cj(ve),u_label_plane_matrix_inv:new a.cl(ve)}))(d)),D.includes("GLOBE")&&(this.globeUniforms=(ve=>({u_tile_tl_up:new a.ci(ve),u_tile_tr_up:new a.ci(ve),u_tile_br_up:new a.ci(ve),u_tile_bl_up:new a.ci(ve),u_tile_up_scale:new a.cj(ve)}))(d)),D.includes("FOG")&&(this.fogUniforms=(ve=>({u_fog_matrix:new a.cl(ve),u_fog_range:new a.ck(ve),u_fog_color:new a.d3(ve),u_fog_horizon_blend:new a.cj(ve),u_fog_vertical_limit:new a.ck(ve),u_fog_temporal_offset:new a.cj(ve),u_frustum_tl:new a.ci(ve),u_frustum_tr:new a.ci(ve),u_frustum_br:new a.ci(ve),u_frustum_bl:new a.ci(ve),u_globe_pos:new a.ci(ve),u_globe_radius:new a.cj(ve),u_globe_transition:new a.cj(ve),u_is_globe:new a.ch(ve),u_viewport:new a.ck(ve)}))(d)),D.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(ve=>({u_cutoff_params:new a.d3(ve)}))(d)),D.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(ve=>({u_lighting_ambient_color:new a.ci(ve),u_lighting_directional_dir:new a.ci(ve),u_lighting_directional_color:new a.ci(ve),u_ground_radiance:new a.ci(ve)}))(d)),D.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(ve=>({u_light_matrix_0:new a.cl(ve),u_light_matrix_1:new a.cl(ve),u_fade_range:new a.ck(ve),u_shadow_normal_offset:new a.ci(ve),u_shadow_intensity:new a.cj(ve),u_shadow_texel_size:new a.cj(ve),u_shadow_map_resolution:new a.cj(ve),u_shadow_direction:new a.ci(ve),u_shadow_bias:new a.ci(ve),u_shadowmap_0:new a.ch(ve),u_shadowmap_1:new a.ch(ve)}))(d)))}getAttributeLocation(d,m){let b=this.attributes[m];return b===void 0&&(b=this.attributes[m]=d.getAttribLocation(this.program,m)),b}setTerrainUniformValues(d,m){if(!this.terrainUniforms)return;const b=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)b[M]&&b[M].set(this.program,M,m[M])}}setGlobeUniformValues(d,m){if(!this.globeUniforms)return;const b=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)b[M]&&b[M].set(this.program,M,m[M])}}setFogUniformValues(d,m){if(!this.fogUniforms)return;const b=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)b[M].set(this.program,M,m[M])}}setCutoffUniformValues(d,m){if(!this.cutoffUniforms)return;const b=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)b[M].set(this.program,M,m[M])}}setLightsUniformValues(d,m){if(!this.lightsUniforms)return;const b=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)b[M].set(this.program,M,m[M])}}setShadowUniformValues(d,m){if(this.failedToCreate||!this.shadowUniforms)return;const b=this.shadowUniforms;d.program.set(this.program);for(const M in m)b[M].set(this.program,M,m[M])}_drawDebugWireframe(d,m,b,M,L,D,B,V,Y,Q){const le=d.options.wireframe;if(le.terrain===!1&&le.layers2D===!1&&le.layers3D===!1)return;const oe=d.context;if(!(!(!le.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!le.layers2D||d._terrain&&d._terrain.renderingToTexture||!sae.includes(this.name))||!(!le.layers3D||!iae.includes(this.name))))return;const ce=oe.gl,je=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,L,oe);if(!je)return;const ve=[...this.fixedDefines,"DEBUG_WIREFRAME"],Le=d.getOrCreateProgram(this.name,{config:this.configuration,defines:ve});oe.program.set(Le.program);const Pe=(qe,xt,lt)=>{if(xt[qe]&<[qe])for(const ft in xt[qe])lt[qe][ft]&<[qe][ft].set(lt.program,ft,xt[qe][ft].current)};Y&&Y.setUniforms(Le.program,oe,Le.binderUniforms,B,{zoom:V}),Pe("fixedUniforms",this,Le),Pe("terrainUniforms",this,Le),Pe("globeUniforms",this,Le),Pe("fogUniforms",this,Le),Pe("lightsUniforms",this,Le),Pe("shadowUniforms",this,Le),je.bind(),oe.setColorMode(new is([ce.ONE,ce.ONE_MINUS_SRC_ALPHA,ce.ZERO,ce.ONE],a.ao.transparent,[!0,!0,!0,!1])),oe.setDepthMode(new un(m.func===ce.LESS?ce.LEQUAL:m.func,un.ReadOnly,m.range)),oe.setStencilMode($n.disabled);const $e=3*D.primitiveLength*2,Ze=3*D.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const qe=Q||1;for(let xt=0;xt1?ce.drawElementsInstanced(ce.LINES,$e,ce.UNSIGNED_SHORT,Ze,Q):ce.drawElements(ce.LINES,$e,ce.UNSIGNED_SHORT,Ze);L.bind(),oe.program.set(this.program),oe.setDepthMode(m),oe.setStencilMode(b),oe.setColorMode(M)}checkUniforms(d,m,b){if(this.fixedDefines.includes(m)){for(const M of Object.keys(b))if(!b[M].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${M} not set but required by ${m} being defined`)}}draw(d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le){const Pe=d.context,$e=Pe.gl;if(this.failedToCreate)return;Pe.program.set(this.program),Pe.setDepthMode(b),Pe.setStencilMode(M),Pe.setColorMode(L),Pe.setCullFace(D);for(const[ot,st]of this.fixedUniformsEntries)st.set(this.program,ot,B[ot]);je&&je.setUniforms(this.program,Pe,this.binderUniforms,oe,{zoom:ce});const Ze={[$e.POINTS]:1,[$e.LINES]:2,[$e.TRIANGLES]:3,[$e.LINE_STRIP]:1}[m];this.checkUniforms(V,"RENDER_SHADOWS",this.shadowUniforms);const qe=ve||[],xt=je?je.getPaintVertexBuffers():[],lt=m===$e.TRIANGLES&&Q,ft=Le&&Le>0?1:void 0;for(const ot of le.get()){const st=ot.vaos||(ot.vaos={});if((st[V]||(st[V]=new Yie)).bind(Pe,this,Y,xt,Q,ot.vertexOffset,qe,ft),this.forceManualRenderingForInstanceIDShaders){const bt=Le||1;for(let Ot=0;Ot1?$e.drawElementsInstanced(m,ot.primitiveLength*Ze,$e.UNSIGNED_SHORT,ot.primitiveOffset*Ze*2,Le):Q?$e.drawElements(m,ot.primitiveLength*Ze,$e.UNSIGNED_SHORT,ot.primitiveOffset*Ze*2):$e.drawArrays(m,ot.vertexOffset,ot.vertexLength);lt&&this._drawDebugWireframe(d,b,M,L,Q,ot,oe,ce,je,Le)}}}function dP(_,d,m=0){const b=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,_.transform.tileZoom)/b,L=M*(d.tileID.canonical.x+d.tileID.wrap*b),D=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture?d.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/a.ay(d,1,_.transform.tileZoom),u_pixel_coord_upper:[L>>16,D>>16],u_pixel_coord_lower:[65535&L,65535&D],u_pattern_transition:m}}const zk={terrain:0,flat:1},aae=a.bC(),Bk=(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le,Pe)=>{const $e=d.style.light,Ze=$e.properties.get("position"),qe=[Ze.x,Ze.y,Ze.z],xt=a.dO();$e.properties.get("anchor")==="viewport"&&(a.dP(xt,-d.transform.angle),a.dQ(qe,qe,xt));const lt=$e.properties.get("color").toPremultipliedRenderColor(null),ft=d.transform,ot={u_matrix:_,u_lightpos:qe,u_lightintensity:$e.properties.get("intensity"),u_lightcolor:[lt.r,lt.g,lt.b],u_vertical_gradient:+m,u_opacity:b,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:aae,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:zk[Y],u_base_type:zk[Q],u_ao:M,u_edge_radius:L,u_width_scale:D,u_flood_light_color:je,u_vertical_scale:ve,u_flood_light_intensity:Le,u_ground_shadow_factor:Pe};return ft.projection.name==="globe"&&(ot.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:_,u_edge_radius:d,u_width_scale:m,u_vertical_scale:b,u_height_type:zk[M],u_base_type:zk[L]}),uP=(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le,Pe)=>{const $e=Bk(_,d,m,b,M,L,D,B,Y,Q,le,oe,ce,je,ve,Le,1,[0,0,0]),Ze={u_height_factor:-Math.pow(2,B.overscaledZ)/V.tileSize/8};return Object.assign($e,dP(d,V,Pe),Ze)},Ly=(_,d,m,b,M,L,D,B,V,Y,Q)=>({u_matrix:d,u_opacity:m,u_ao_pass:b?1:0,u_meter_to_tile:M,u_ao:L,u_flood_light_intensity:D,u_flood_light_color:B,u_attenuation:V,u_edge_radius:Y,u_fb:0,u_fb_size:Q,u_dynamic_offset:1}),s5=(_,d,m)=>({u_matrix:_,u_emissive_strength:d,u_ground_shadow_factor:m}),i5=(_,d,m,b,M,L=0)=>Object.assign(s5(_,d,M),dP(m,b,L)),hP=(_,d,m,b)=>({u_matrix:_,u_world:m,u_emissive_strength:d,u_ground_shadow_factor:b}),a5=(_,d,m,b,M,L,D=0)=>Object.assign(i5(_,d,m,b,L,D),{u_world:M}),zm=(_,d)=>({u_matrix:_,u_ground_shadow_factor:d}),Yg=(_,d,m,b,M)=>({u_matrix:_,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:m,u_height_scale:b,u_reset_depth:M}),$k=(_,d,m,b,M,L,D,B,V)=>({u_matrix:_,u_normal_matrix:d,u_opacity:m,u_faux_facade_ao_intensity:b,u_camera_pos:M,u_tile_to_meter:L,u_facade_emissive_chance:D,u_flood_light_color:B,u_flood_light_intensity:V}),fP=_=>({u_matrix:_}),Bm=_=>({u_matrix:_}),o5=(_,d,m,b,M,L,D,B)=>{const V=a.al/L.tileSize;return{u_matrix:_,u_inv_rot_matrix:d,u_camera_to_center_distance:m.getCameraToCenterDistance(B),u_extrude_scale:[m.pixelsToGLUnits[0]/V,m.pixelsToGLUnits[1]/V],u_zoom_transition:b,u_tile_id:D,u_merc_center:M}},Av=(_,d,m=1)=>({u_matrix:_,u_color:d,u_overlay:0,u_overlay_scale:m}),pP=a.bC(),mP=(_,d,m,b,M,L,D)=>{const B=_.transform,V=B.projection.name==="globe",Y=V?a.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:a.ay(m,1,L),Q={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:D,u_inv_rot_matrix:pP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(V){Q.u_inv_rot_matrix=b,Q.u_merc_center=M,Q.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:b,u_grid_matrix:M,u_tl_parent:L,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity*le.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:le.paint.get("raster-brightness-min"),u_brightness_high:le.paint.get("raster-brightness-max"),u_saturation_factor:a.dT(le.paint.get("raster-saturation")),u_contrast_factor:a.dS(le.paint.get("raster-contrast")),u_spin_weights:xP(le.paint.get("raster-hue-rotate")),u_perspective_transform:oe,u_raster_elevation:ce,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:V,u_colorization_mix:Uk(a.dU,ve,Pe),u_colorization_offset:qk(a.dU,Le,Pe),u_color_ramp:je,u_texture_offset:[Ze/($e+2*Ze),$e/($e+2*Ze)],u_texture_res:[$e+2*Ze,$e+2*Ze],u_emissive_strength:qe});function xP(_){_*=Math.PI/180;const d=Math.sin(_),m=Math.cos(_);return[(2*m+1)/3,(-Math.sqrt(3)*d-m+1)/3,(Math.sqrt(3)*d-m+1)/3]}const gf=.05,oae=(_,d,m,b,M,L,D,B,V,Y,Q,le)=>({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:b,u_grid_matrix:M,u_tl_parent:L,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity,u_image0:0,u_image1:1,u_raster_elevation:le,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:V}),lae=(_,d,m,b,M,L,D,B,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_tile_offset:m,u_velocity:b,u_color_ramp:L,u_velocity_res:M,u_max_speed:D,u_uv_offset:B,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[gf,gf]}),yP=(_,d,m,b,M,L,D,B,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_velocity:m,u_velocity_res:b,u_max_speed:M,u_speed_factor:L,u_reset_rate:D,u_rand_seed:Math.random(),u_uv_offset:B,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[gf,gf]}),vP=a.bC(),Vk=(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le,Pe,$e,Ze,qe,xt,lt,ft)=>{const ot=M.transform,st={u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ot.getCameraToCenterDistance($e),u_rotate_symbol:+m,u_aspect_ratio:ot.width/ot.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:L,u_label_plane_matrix:D,u_coord_matrix:B,u_is_text:+Y,u_elevation_from_sea:V?1:0,u_pitch_with_map:+b,u_texsize:Q,u_texsize_icon:le,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:vP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:vP,u_up_vector:[0,-1,0],u_color_adj_mat:xt,u_icon_transition:lt||0,u_gamma_scale:b?M.transform.getCameraToCenterDistance($e)*Math.cos(M.terrain?0:M.transform._pitch):1,u_device_pixel_ratio:a.o.devicePixelRatio,u_is_halo:1,u_scale_factor:ft||1,u_ground_shadow_factor:Ze,u_inv_matrix:a.bl(a.bC(),D),u_normal_scale:qe,u_lutTexture:Sl.LUT};return $e.name==="globe"&&(st.u_tile_id=[ce.canonical.x,ce.canonical.y,1<({u_matrix:_,u_emissive_strength:d,u_opacity:m,u_color:b}),$m=(_,d,m,b,M,L,D,B,V)=>Object.assign(function(Y,Q,le,oe,ce,je){const{width:ve,height:Le}=oe.imageManager.getPixelSize(Q),Pe=Math.pow(2,je.tileID.overscaledZ),$e=je.tileSize*Math.pow(2,oe.transform.tileZoom)/Pe,Ze=$e*(je.tileID.canonical.x+je.tileID.wrap*Pe),qe=$e*je.tileID.canonical.y;return{u_image:0,u_pattern_tl:le.tl,u_pattern_br:le.br,u_texsize:[ve,Le],u_pattern_size:le.displaySize,u_pattern_units_to_pixels:ce?[oe.transform.width,-1*oe.transform.height]:[1/a.ay(je,1,oe.transform.tileZoom),1/a.ay(je,1,oe.transform.tileZoom)],u_pixel_coord_upper:[Ze>>16,qe>>16],u_pixel_coord_lower:[65535&Ze,65535&qe]}}(0,L,D,b,B,V),{u_matrix:_,u_emissive_strength:d,u_opacity:m}),Oy=new Float32Array(a.bA([])),Xg=(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce=[0,0,0],je,ve,Le)=>{const Pe=M.style.light,$e=Pe.properties.get("position"),Ze=[-$e.x,-$e.y,$e.z],qe=a.dO();Pe.properties.get("anchor")==="viewport"&&(a.dP(qe,-M.transform.angle),a.dQ(Ze,Ze,qe));const xt=Q.alphaMode==="MASK",lt=Pe.properties.get("color").toNonPremultipliedRenderColor(null),ft=oe.paint.get("model-ambient-occlusion-intensity"),ot=oe.paint.get("model-color").constantOr(a.ao.white).toNonPremultipliedRenderColor(null);return ot.a=oe.paint.get("model-color-mix-intensity").constantOr(0),Le&&(ot.r=Le[0],ot.g=Le[1],ot.b=Le[2],ot.a=Le[3]),ve&&(ot.r=ve.color.r,ot.g=ve.color.g,ot.b=ve.color.b,ot.a=ve.colorMix,le=ve.emissionStrength,L*=ve.opacity),{u_matrix:_,u_lighting_matrix:d,u_normal_matrix:m,u_node_matrix:b||Oy,u_lightpos:Ze,u_lightintensity:Pe.properties.get("intensity"),u_lightcolor:[lt.r,lt.g,lt.b],u_camera_pos:ce,u_opacity:L,u_baseTextureIsAlpha:0,u_alphaMask:+xt,u_alphaCutoff:Q.alphaCutoff,u_baseColorFactor:D.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:V,u_roughnessFactor:Y,u_baseColorTexture:Sl.BaseColor,u_metallicRoughnessTexture:Sl.MetallicRoughness,u_normalTexture:Sl.Normal,u_occlusionTexture:Sl.Occlusion,u_emissionTexture:Sl.Emission,u_lutTexture:Sl.LUT,u_color_mix:ot.toArray01(),u_aoIntensity:ft,u_emissive_strength:le,u_occlusionTextureTransform:je||[0,0,0,0]}},l5=(_,d=Oy,m=Oy)=>({u_matrix:_,u_instance:d,u_node_matrix:m}),Hk={fillExtrusion:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_opacity:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_flood_light_color:new a.ci(_),u_vertical_scale:new a.cj(_),u_flood_light_intensity:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillExtrusionDepth:_=>({u_matrix:new a.cl(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_vertical_scale:new a.cj(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_)}),fillExtrusionPattern:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_height_factor:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_opacity:new a.cj(_),u_pattern_transition:new a.cj(_)}),fillExtrusionGroundEffect:_=>({u_matrix:new a.cl(_),u_opacity:new a.cj(_),u_ao_pass:new a.cj(_),u_meter_to_tile:new a.cj(_),u_ao:new a.ck(_),u_flood_light_intensity:new a.cj(_),u_flood_light_color:new a.ci(_),u_attenuation:new a.cj(_),u_edge_radius:new a.cj(_),u_fb:new a.ch(_),u_fb_size:new a.cj(_),u_dynamic_offset:new a.cj(_)}),fill:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),fillOutline:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_ground_shadow_factor:new a.ci(_)}),fillOutlinePattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),building:_=>({u_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_opacity:new a.cj(_),u_faux_facade_ao_intensity:new a.cj(_),u_camera_pos:new a.ci(_),u_tile_to_meter:new a.cj(_),u_facade_emissive_chance:new a.cj(_),u_flood_light_color:new a.ci(_),u_flood_light_intensity:new a.cj(_)}),buildingBloom:_=>({u_matrix:new a.cl(_)}),buildingDepth:_=>({u_matrix:new a.cl(_)}),elevatedStructuresDepth:_=>({u_matrix:new a.cl(_),u_depth_bias:new a.cj(_)}),elevatedStructures:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),elevatedStructuresDepthReconstruct:_=>({u_matrix:new a.cl(_),u_camera_pos:new a.ci(_),u_depth_bias:new a.cj(_),u_height_scale:new a.cj(_),u_reset_depth:new a.cj(_)}),circle:a.dY,collisionBox:_=>({u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_extrude_scale:new a.ck(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_)}),collisionCircle:_=>({u_matrix:new a.cl(_),u_inv_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_viewport_size:new a.ck(_)}),debug:_=>({u_color:new a.dB(_),u_matrix:new a.cl(_),u_overlay:new a.ch(_),u_overlay_scale:new a.cj(_)}),clippingMask:_=>({u_matrix:new a.cl(_)}),heatmap:_=>({u_extrude_scale:new a.cj(_),u_intensity:new a.cj(_),u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_up_dir:new a.ci(_)}),heatmapTexture:_=>({u_image:new a.ch(_),u_color_ramp:new a.ch(_),u_opacity:new a.cj(_)}),hillshade:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_latrange:new a.ck(_),u_light:new a.ck(_),u_shadow:new a.dB(_),u_highlight:new a.dB(_),u_emissive_strength:new a.cj(_),u_accent:new a.dB(_)}),hillshadePrepare:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_dimension:new a.ck(_),u_zoom:new a.cj(_)}),line:a.dX,linePattern:a.dW,raster:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_brightness_low:new a.cj(_),u_brightness_high:new a.cj(_),u_saturation_factor:new a.cj(_),u_contrast_factor:new a.cj(_),u_spin_weights:new a.ci(_),u_perspective_transform:new a.ck(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_),u_colorization_mix:new a.d3(_),u_colorization_offset:new a.cj(_),u_color_ramp:new a.ch(_),u_texture_offset:new a.ck(_),u_texture_res:new a.ck(_),u_emissive_strength:new a.cj(_)}),rasterParticle:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_)}),rasterParticleTexture:_=>({u_texture:new a.ch(_),u_opacity:new a.cj(_)}),rasterParticleDraw:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_tile_offset:new a.ck(_),u_velocity:new a.ch(_),u_color_ramp:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),rasterParticleUpdate:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_velocity:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_speed_factor:new a.cj(_),u_reset_rate:new a.cj(_),u_rand_seed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),symbol:_=>({u_is_size_zoom_constant:new a.ch(_),u_is_size_feature_constant:new a.ch(_),u_size_t:new a.cj(_),u_size:new a.cj(_),u_camera_to_center_distance:new a.cj(_),u_rotate_symbol:new a.ch(_),u_aspect_ratio:new a.cj(_),u_fade_change:new a.cj(_),u_matrix:new a.cl(_),u_label_plane_matrix:new a.cl(_),u_coord_matrix:new a.cl(_),u_is_text:new a.ch(_),u_elevation_from_sea:new a.ch(_),u_pitch_with_map:new a.ch(_),u_texsize:new a.ck(_),u_texsize_icon:new a.ck(_),u_texture:new a.ch(_),u_texture_icon:new a.ch(_),u_gamma_scale:new a.cj(_),u_device_pixel_ratio:new a.cj(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_camera_forward:new a.ci(_),u_tile_matrix:new a.cl(_),u_up_vector:new a.ci(_),u_ecef_origin:new a.ci(_),u_is_halo:new a.ch(_),u_icon_transition:new a.cj(_),u_color_adj_mat:new a.cl(_),u_scale_factor:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_inv_matrix:new a.cl(_),u_normal_scale:new a.cj(_),u_lutTexture:new a.ch(_)}),background:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_color:new a.dB(_)}),backgroundPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_image:new a.ch(_),u_pattern_tl:new a.ck(_),u_pattern_br:new a.ck(_),u_texsize:new a.ck(_),u_pattern_size:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_pattern_units_to_pixels:new a.ck(_)}),terrainRaster:_=>({u_matrix:new a.cl(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_skirt_height:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_emissive_texture_available:new a.cj(_)}),skybox:_=>({u_matrix:new a.cl(_),u_sun_direction:new a.ci(_),u_cubemap:new a.ch(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxGradient:_=>({u_matrix:new a.cl(_),u_color_ramp:new a.ch(_),u_center_direction:new a.ci(_),u_radius:new a.cj(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxCapture:_=>({u_matrix_3f:new a.dC(_),u_sun_direction:new a.ci(_),u_sun_intensity:new a.cj(_),u_color_tint_r:new a.d3(_),u_color_tint_m:new a.d3(_),u_luminance:new a.cj(_)}),globeRaster:_=>({u_proj_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_grid_matrix:new a.dC(_),u_skirt_height:new a.cj(_),u_far_z_cutoff:new a.cj(_),u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_globe_pos:new a.ci(_),u_globe_radius:new a.cj(_),u_viewport:new a.ck(_),u_emissive_texture_available:new a.cj(_)}),globeAtmosphere:_=>({u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_horizon:new a.cj(_),u_transition:new a.cj(_),u_fadeout_range:new a.cj(_),u_atmosphere_fog_color:new a.d3(_),u_high_color:new a.d3(_),u_space_color:new a.d3(_),u_temporal_offset:new a.cj(_),u_horizon_angle:new a.cj(_)}),model:_=>({u_matrix:new a.cl(_),u_lighting_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_node_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_camera_pos:new a.ci(_),u_opacity:new a.cj(_),u_baseColorFactor:new a.d3(_),u_emissiveFactor:new a.d3(_),u_metallicFactor:new a.cj(_),u_roughnessFactor:new a.cj(_),u_baseTextureIsAlpha:new a.ch(_),u_alphaMask:new a.ch(_),u_alphaCutoff:new a.cj(_),u_baseColorTexture:new a.ch(_),u_metallicRoughnessTexture:new a.ch(_),u_normalTexture:new a.ch(_),u_occlusionTexture:new a.ch(_),u_emissionTexture:new a.ch(_),u_lutTexture:new a.ch(_),u_color_mix:new a.d3(_),u_aoIntensity:new a.cj(_),u_emissive_strength:new a.cj(_),u_occlusionTextureTransform:new a.d3(_)}),modelDepth:_=>({u_matrix:new a.cl(_),u_instance:new a.cl(_),u_node_matrix:new a.cl(_)}),groundShadow:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),stars:_=>({u_matrix:new a.cl(_),u_up:new a.ci(_),u_right:new a.ci(_),u_intensity_multiplier:new a.cj(_)}),snowParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_horizontalOscillationRadius:new a.cj(_),u_horizontalOscillationRate:new a.cj(_),u_boxSize:new a.cj(_),u_billboardSize:new a.cj(_),u_simpleShapeParameters:new a.ck(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_particleColor:new a.d3(_),u_direction:new a.ci(_)}),rainParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_texScreen:new a.ch(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_boxSize:new a.cj(_),u_rainDropletSize:new a.ck(_),u_distortionStrength:new a.cj(_),u_rainDirection:new a.ci(_),u_color:new a.d3(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_shapeDirectionalPower:new a.cj(_),u_shapeNormalPower:new a.cj(_),u_mode:new a.cj(_)}),vignette:_=>({u_vignetteShape:new a.ci(_),u_vignetteColor:new a.d3(_)}),occlusion:_=>({u_matrix:new a.cl(_),u_anchorPos:new a.ci(_),u_screenSizePx:new a.ck(_),u_occluderSizePx:new a.ck(_),u_color:new a.d3(_)})};class Ch{constructor(d,m,b,M){this.id=Ch.uniqueIdxCounter,Ch.uniqueIdxCounter++,this.context=d;const L=d.gl;this.buffer=L.createBuffer(),this.dynamicDraw=!!b,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),L.bufferData(L.ELEMENT_ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?L.DYNAMIC_DRAW:L.STATIC_DRAW),this.dynamicDraw||M||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Ch.uniqueIdxCounter,Ch.uniqueIdxCounter++;const m=this.context.gl;this.context.unbindVAO(),this.bind(),m.bufferSubData(m.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Ch.uniqueIdxCounter=0;const c5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _P{constructor(d,m,b,M,L,D){this.length=m.length,this.attributes=b,this.itemSize=m.bytesPerElement,this.dynamicDraw=M,this.instanceCount=D,this.context=d;const B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||L||m.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const m=this.context.gl;this.bind(),m.bufferSubData(m.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,m){for(let b=0;b0&&d.vertexAttribDivisor(L,b)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class bP{constructor(d,m,b,M,L){this.context=d,this.width=m,this.height=b;const D=this.framebuffer=d.gl.createFramebuffer();M>0&&(this.colorAttachment0=new Lk(d,D,0)),M>1&&(this.colorAttachment1=new Lk(d,D,1)),L&&(this.depthAttachmentType=L,this.depthAttachment=L==="renderbuffer"?new Ey(d,D):new Sv(d,D))}createColorAttachment(d,m){m===0?this.colorAttachment0=new Lk(d,this.framebuffer,0):m===1&&(this.colorAttachment1=new Lk(d,this.framebuffer,1))}removeColorAttachment(d,m){const b=this.context.gl;let M;m===0?(M=this.colorAttachment0.get(),this.colorAttachment0=void 0):m===1&&(M=this.colorAttachment1.get(),this.colorAttachment1=void 0),M&&b.deleteTexture(M)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const m=this.colorAttachment0.get();m&&d.deleteTexture(m)}if(this.colorAttachment1){const m=this.colorAttachment1.get();m&&d.deleteTexture(m)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const m=this.depthAttachment.get();m&&d.deleteRenderbuffer(m)}else{const m=this.depthAttachment.get();m&&d.deleteTexture(m)}d.deleteFramebuffer(this.framebuffer)}}class Dy{constructor(d,m){this.gl=d,this.clearColor=new eae(this),this.clearDepth=new eP(this),this.clearStencil=new H3(this),this.colorMask=new Tk(this),this.depthMask=new W3(this),this.stencilMask=new Zg(this),this.stencilFunc=new Cy(this),this.stencilOp=new kv(this),this.stencilTest=new My(this),this.depthRange=new tP(this),this.depthTest=new G3(this),this.depthFunc=new rP(this),this.blend=new Ty(this),this.blendFunc=new Ak(this),this.blendColor=new Ek(this),this.blendEquation=new K3(this),this.cullFace=new Ik(this),this.cullFaceSide=new Nv(this),this.frontFace=new nP(this),this.program=new sP(this),this.activeTexture=new iP(this),this.viewport=new Ay(this),this.bindFramebuffer=new aP(this),this.bindRenderbuffer=new tae(this),this.bindTexture=new rae(this),this.bindVertexBuffer=new nae(this),this.bindElementBuffer=new Z3(this),this.bindVertexArrayOES=new Y3(this),this.pixelStoreUnpack=new X3(this),this.pixelStoreUnpackPremultiplyAlpha=new Q3(this),this.pixelStoreUnpackFlipY=new oP(this),this.options=m?Object.assign({},m):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=d.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=d.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=d.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=m&&!!m.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=d.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=d.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=d.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=d.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(d,m,b){return new Ch(this,d,m,b)}createVertexBuffer(d,m,b,M,L){return new _P(this,d,m,b,M,L)}createRenderbuffer(d,m,b){const M=this.gl,L=M.createRenderbuffer();return this.bindRenderbuffer.set(L),M.renderbufferStorage(M.RENDERBUFFER,d,m,b),this.bindRenderbuffer.set(null),L}createFramebuffer(d,m,b,M){return new bP(this,d,m,b,M)}clear({color:d,depth:m,stencil:b,colorMask:M}){const L=this.gl;let D=0;d&&(D|=L.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(M||[!0,!0,!0,!0])),m!==void 0&&(D|=L.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(m),this.depthMask.set(!0)),b!==void 0&&(D|=L.STENCIL_BUFFER_BIT,this.clearStencil.set(b),this.stencilMask.set(255)),L.clear(D)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){a.by(d.blendFunction,is.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor),d.blendEquation?this.blendEquation.set(d.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(d.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Qg;function Qr(_,d,m,b,M,L,D){const B=_.context,V=B.gl,Y=_.transform,Q=[a.aF(Y.center.lng),a.aJ(Y.center.lat)],le=m.layout.get("symbol-placement"),oe=m.layout.get("text-variable-anchor"),ce=m.layout.get("icon-rotation-alignment")==="map",je=m.layout.get("text-rotation-alignment")==="map",ve=le!=="point",Le=[];let Pe=0,$e=0;for(let st=0;st0){const $r=a.bC(),Kr=Sr;a.cP($r,Pt.placementInvProjMatrix,Y.glCoordMatrix),a.cP($r,$r,Pt.placementViewportMatrix),Le.push({circleArray:on,circleOffset:$e,transform:Kr,invTransform:$r,projection:Pt.getProjection()}),Pe+=on.length/4,$e=Pe}if(!wr)continue;_.terrain&&_.terrain.setupElevationDraw(Ot,Gr);const en=ur?[bt.canonical.x,bt.canonical.y,1<=0&&(ce[Ze.associatedIconIndex]={x:Pt,y:Vt,z:Ht,angle:Yt})}else kh(lt,le)}if(Y){oe.clear();const $e=_.icon.placedSymbolArray;for(let Ze=0;Ze<$e.length;Ze++){const qe=$e.get(Ze),{numGlyphs:xt}=qe,lt=ce[Ze];if(qe.hidden||!lt)kh(xt,oe);else{const{x:ft,y:ot,z:st,angle:bt}=lt;for(let Ot=0;Ot{let Qs=[0,0,0];if(xi){const ls=_.style.directionalLight,sa=_.style.ambientLight;ls&&sa&&(Qs=yp(_.style,ls,sa))}return Qs},ii=xi=>{st.depthOcclusionForSymbolsAndCircles&&(m.hasOcclusionOpacityProperties||_.terrain)&&(xi.push("DEPTH_D24"),xi.push("DEPTH_OCCLUSION"))},Hn=xi=>{m.lut&&!lt&&(m.lut.texture||(m.lut.texture=new a.d$(_.context,m.lut.image,[m.lut.image.height,m.lut.image.height,m.lut.image.height],ft.gl.RGBA8)),ft.activeTexture.set(ft.gl.TEXTURE0+Sl.LUT),m.lut.texture&&m.lut.texture.bind(ft.gl.LINEAR,ft.gl.CLAMP_TO_EDGE),xi.push("APPLY_LUT_ON_GPU"))},gi=()=>{const xi=bt&&m.layout.get("symbol-placement")!=="point",Qs=[];ii(Qs),Hn(Qs);const ls=xi||Yn,sa=wr.elevationType==="road",eo=_.shadowRenderer,Ea=sa&&Pt&&!!eo&&eo.enabled,qi=dn(Ea),rd=sa&&Pt&&!_.terrain?zt:br,ec=m.paint.get("icon-image-cross-fade");_.terrainRenderModeElevated()&&Pt&&Qs.push("PITCH_WITH_MAP_TERRAIN"),on&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),ec>0&&wr.hasAnySecondaryIcon&&Qs.push("ICON_TRANSITION"),!wr.icon.zOffsetVertexBuffer||sa&&_.terrain||Qs.push("Z_OFFSET"),Pe===0&&$e===0&&Ze===0&&qe===1||Qs.push("COLOR_ADJUSTMENT"),wr.sdfIcons&&Qs.push("RENDER_SDF"),Ea&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),sa&&Pt&&!_.terrain&&wr.icon.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS");const Uo=wr.icon.programConfigurations.get(m.id),gc=_.getOrCreateProgram("symbol",{config:Uo,defines:Qs}),xc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],Fl=wr.iconSizeData,uu=a.bK(Fl,st.zoom),eh=Pt||!st.isOrthographic,jd=Ic($r,Sr.tileID.canonical,Pt,bt,st,wr.getProjection(),Kr),Ua=pv($r,Sr.tileID.canonical,Pt,bt,st,wr.getProjection(),Kr),ao=_.translatePosMatrix(Ua,Sr,B,Y,!0),Vi=_.translatePosMatrix($r,Sr,B,Y),_o=ls?Iv:jd,Ra=bt&&!Pt&&!xi;let Ia=Er;!qt&&!st.mercatorFromTransition||bt||(Ia=_p(st));const th=on?Ia:Er,Hv=m.getColorAdjustmentMatrix(Pe,$e,Ze,qe),Ah=Vk(Fl.kind,uu,Ra,Pt,_,Vi,_o,ao,xt,!1,xc,[0,0],0,Gr,en,Mt,Os,th,wr.getProjection(),qi,ui,Hv,ec,null),Wv=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,Hy=m.layout.get("icon-size").constantOr(0)!==1||wr.iconsNeedLinear,bf=wr.sdfIcons||_.options.rotating||_.options.zooming||Hy||eh?ot.LINEAR:ot.NEAREST,Tp=wr.sdfIcons&&m.paint.get("icon-halo-width").constantOr(1)!==0,Wy=_.terrain&&Pt&&xi?a.bl(a.bC(),jd):Iv;if(xi&&wr.icon){const Gm=a.bV.getAtTileOffsetFunc(Gr,st.center.lat,st.worldSize,wr.getProjection()),Ap=fk($r,Sr.tileID.canonical,Pt,bt,st,wr.getProjection(),Kr),Eh=m.layout.get("icon-size-scale-range"),Ep=a.aA(_.scaleFactor,Eh[0],Eh[1]);HI(wr,$r,_,!1,Ap,Ua,Pt,ve,Gm,Gr,Ep)}return{program:gc,buffers:wr.icon,uniformValues:Ah,atlasTexture:Wv,atlasTextureIcon:null,atlasInterpolation:bf,atlasInterpolationIcon:null,isSDF:wr.sdfIcons,hasHalo:Tp,depthMode:rd,tile:Sr,renderWithShadows:Ea,labelPlaneMatrixInv:Wy}},Li=()=>{const xi=Ot&&m.layout.get("symbol-placement")!=="point",Qs=[],ls=xi||Yt||Yn,sa=wr.elevationType==="road",eo=_.shadowRenderer,Ea=sa&&Vt&&!!eo&&eo.enabled,qi=dn(Ea),rd=sa&&Vt&&!_.terrain?zt:br;_.terrainRenderModeElevated()&&Vt&&Qs.push("PITCH_WITH_MAP_TERRAIN"),on&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),!wr.text.zOffsetVertexBuffer||sa&&_.terrain||Qs.push("Z_OFFSET"),wr.iconsInText&&Qs.push("RENDER_TEXT_AND_SYMBOL"),Qs.push("RENDER_SDF"),Ea&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),sa&&Vt&&!_.terrain&&wr.text.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS"),ii(Qs);const ec=wr.text.programConfigurations.get(m.id),Uo=_.getOrCreateProgram("symbol",{config:ec,defines:Qs});let gc,xc=[0,0],Fl=null;const uu=wr.textSizeData;wr.iconsInText&&(xc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],Fl=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,gc=Vt||!st.isOrthographic||_.options.rotating||_.options.zooming||uu.kind==="composite"||uu.kind==="camera"?ot.LINEAR:ot.NEAREST);const eh=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture.size:[0,0],jd=m.layout.get("text-size-scale-range"),Ua=a.aA(_.scaleFactor,jd[0],jd[1]),ao=a.bK(uu,st.zoom,Ua),Vi=Ic($r,Sr.tileID.canonical,Vt,Ot,st,wr.getProjection(),Kr),_o=pv($r,Sr.tileID.canonical,Vt,Ot,st,wr.getProjection(),Kr),Ra=_.translatePosMatrix(_o,Sr,V,Q,!0),Ia=_.translatePosMatrix($r,Sr,V,Q),th=ls?Iv:Vi,Hv=Ot&&!Vt&&!xi;let Ah=Er;!qt&&!st.mercatorFromTransition||Ot||(Ah=_p(st));const Wv=Vk(uu.kind,ao,Hv,Vt,_,Ia,th,Ra,xt,!0,eh,xc,0,Gr,en,Mt,Os,on?Ah:Er,wr.getProjection(),qi,ui,null,null,Ua),Hy=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture:null,bf=ot.LINEAR,Tp=m.paint.get("text-halo-width").constantOr(1)!==0,Wy=_.terrain&&Vt&&xi?a.bl(a.bC(),Vi):Iv;if(xi&&wr.text){const Gm=a.bV.getAtTileOffsetFunc(Gr,st.center.lat,st.worldSize,wr.getProjection()),Ap=fk($r,Sr.tileID.canonical,Vt,Ot,st,wr.getProjection(),Kr);HI(wr,$r,_,!0,Ap,_o,Vt,Le,Gm,Gr,Ua)}return{program:Uo,buffers:wr.text,uniformValues:Wv,atlasTexture:Hy,atlasTextureIcon:Fl,atlasInterpolation:bf,atlasInterpolationIcon:gc,isSDF:!0,hasHalo:Tp,depthMode:rd,tile:Sr,renderWithShadows:Ea,labelPlaneMatrixInv:Wy}},ji=wr.icon.segments.get().length,ni=wr.text.segments.get().length,as=ji&&!D.onlyText?gi():null,pi=ni&&!D.onlyIcons?Li():null,Da=m.paint.get("icon-opacity").constantOr(1),xa=m.paint.get("text-opacity").constantOr(1);if(Ht&&wr.canOverlap){sr=!0;const xi=Da&&!D.onlyText?wr.icon.segments.get():[],Qs=xa&&!D.onlyIcons?wr.text.segments.get():[];for(const ls of xi)ur.push({segments:new a.bg([ls]),sortKey:ls.sortKey,state:as});for(const ls of Qs)ur.push({segments:new a.bg([ls]),sortKey:ls.sortKey,state:pi})}else D.onlyText||ur.push({segments:Da?wr.icon.segments:new a.bg([]),sortKey:0,state:as}),D.onlyIcons||ur.push({segments:xa?wr.text.segments:new a.bg([]),sortKey:0,state:pi})}sr&&ur.sort((Gr,Sr)=>Gr.sortKey-Sr.sortKey);for(const Gr of ur){const Sr=Gr.state;if(Sr)if(_.terrain?_.terrain.setupElevationDraw(Sr.tile,Sr.program,{useDepthForOcclusion:st.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Sr.labelPlaneMatrixInv}):_.setupDepthForOcclusion(st.depthOcclusionForSymbolsAndCircles,Sr.program),ft.activeTexture.set(ot.TEXTURE0),Sr.atlasTexture&&Sr.atlasTexture.bind(Sr.atlasInterpolation,ot.CLAMP_TO_EDGE,!0),Sr.atlasTextureIcon&&(ft.activeTexture.set(ot.TEXTURE1),Sr.atlasTextureIcon&&Sr.atlasTextureIcon.bind(Sr.atlasInterpolationIcon,ot.CLAMP_TO_EDGE,!0)),Sr.renderWithShadows&&_.shadowRenderer.setupShadows(Sr.tile.tileID.toUnwrapped(),Sr.program,"vector-tile"),_.uploadCommonLightUniforms(_.context,Sr.program),Sr.hasHalo){const wr=Sr.uniformValues;wr.u_is_halo=1,d5(Sr.buffers,Gr.segments,m,_,Sr.program,Sr.depthMode,M,L,wr,2),wr.u_is_halo=0}else{if(Sr.isSDF){const wr=Sr.uniformValues;Sr.hasHalo&&(wr.u_is_halo=1,d5(Sr.buffers,Gr.segments,m,_,Sr.program,Sr.depthMode,M,L,wr,1)),wr.u_is_halo=0}d5(Sr.buffers,Gr.segments,m,_,Sr.program,Sr.depthMode,M,L,Sr.uniformValues,1)}}}function d5(_,d,m,b,M,L,D,B,V,Y){const Q=[_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer,_.iconTransitioningVertexBuffer,_.globeExtVertexBuffer,_.zOffsetVertexBuffer,_.orientationVertexBuffer];M.draw(b,b.context.gl.TRIANGLES,L,D,B,Bn.disabled,V,m.id,_.layoutVertexBuffer,_.indexBuffer,d,m.paint,b.transform.zoom,_.programConfigurations.get(m.id),Q,Y)}function wP(_,d){const m=1<<_.canonical.z,b=(d.x*m-_.canonical.x-_.wrap*m)*a.al,M=(d.y*m-_.canonical.y)*a.al,L=a.e8(d.z,d.y);return a.d5(b,M,L)}function Wk(_,d,m,b,M){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const L=_.context.gl,D=new un(_.context.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D),B=new un(_.context.gl.GREATER,un.ReadWrite,_.depthRangeFor3D),V=function(ce){let je=.01;return ce.isOrthographic&&(je=a.ak(1e-4,je,a.d0(ce.pitch>=Sh?1:ce.pitch/Sh))),2*je}(_.transform),Y=_.transform.getFreeCameraOptions().position,Q="elevatedStructuresDepthReconstruct",le=_.getOrCreateProgram(Q,{defines:["DEPTH_RECONSTRUCTION"]}),oe=_.getOrCreateProgram(Q);for(const ce of b){const je=d.getTile(ce),ve=je.getBucket(m);if(!ve)continue;const Le=ve.elevatedStructures;if(!Le)continue;const Pe=ve.elevationBufferData.heightRange,$e=wP(ce.toUnwrapped(),Y),Ze=_.translatePosMatrix(ce.projMatrix,je,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));let qe,xt,lt,ft;if(M==="initialize"){if(!Pe||Pe.min>=1||Le.depthSegments.segments[0].primitiveLength===0)continue;qe=Yg(Ze,$e,V,1,0),xt=D,lt=Le.depthSegments,ft=le}else if(M==="reset"){if(!Pe||Pe.min>=0||Le.maskSegments.segments[0].primitiveLength===0)continue;qe=Yg(Ze,$e,0,0,1),xt=B,lt=Le.maskSegments,ft=le}else if(M==="geometry"){if(Le.depthSegments.segments[0].primitiveLength===0)continue;qe=Yg(Ze,$e,V,1,0),xt=D,lt=Le.depthSegments,ft=oe}ft.draw(_,L.TRIANGLES,xt,$n.disabled,is.disabled,Bn.disabled,qe,m.id,Le.vertexBuffer,Le.indexBuffer,lt,m.paint,_.transform.zoom)}}function Gk(_,d,m,b){const{painter:M,sourceCache:L,layer:D,coords:B,colorMode:V,elevationType:Y,terrainEnabled:Q,pass:le}=_,oe=M.context.gl,ce=D.paint.get("fill-pattern"),je=D.paint.get("fill-pattern-cross-fade"),ve=ce.constantOr(null);let Le=Y;Y!=="road"||d&&!Q||(Le="none");const Pe=Le==="road",$e=_.painter.shadowRenderer,Ze=Pe&&!!$e&&$e.enabled,qe=new un(M.context.gl.LEQUAL,un.ReadOnly,M.depthRangeFor3D);let xt=[0,0,0];if(Ze){const st=M.style.directionalLight,bt=M.style.ambientLight;st&&bt&&(xt=yp(M.style,st,bt))}const lt=ce&&ce.constantOr(1),ft=M.terrain&&M.terrain.renderingToTexture,ot=(st,bt)=>{let Ot,Pt,Vt,Ht,sr;bt?(Ot=lt&&!D.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Vt=oe.LINES):(Ot=lt?"fillPattern":"fill",Vt=oe.TRIANGLES);for(const br of B){const zt=L.getTile(br);if(lt&&!zt.patternsLoaded())continue;const Mt=zt.getBucket(D);if(!Mt)continue;const Yt=d?Mt.elevationBufferData:Mt.bufferData;if(Yt.isEmpty())continue;M.prepareDrawTile();const qt=Yt.programConfigurations.get(D.id),ur=M.isTileAffectedByFog(br),Er=[],Gr=[];Pe&&(Er.push("ELEVATED_ROADS"),Gr.push(Yt.elevatedLayoutVertexBuffer)),Ze&&Er.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ft&&m&&Er.push("USE_MRT1"),lt&&(M.context.activeTexture.set(oe.TEXTURE0),zt.imageAtlasTexture&&zt.imageAtlasTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),qt.updatePaintBuffers());let Sr=!1;if(ve&&zt.imageAtlas){const Kr=zt.imageAtlas,Nn=a.e3.from(ve),Yn=Nn.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Os=Nn.getSecondary(),ui=Kr.patternPositions.get(Yn),dn=Os?Kr.patternPositions.get(Os.scaleSelf(a.o.devicePixelRatio).toString()):null;Sr=!!ui&&!!dn,ui&&qt.setConstantPatternPositions(ui,dn)}je>0&&(Sr||qt.getPatternTransitionVertexBuffer("fill-pattern"))&&Er.push("FILL_PATTERN_TRANSITION");const wr=M.getOrCreateProgram(Ot,{config:qt,overrideFog:ur,defines:Er}),on=M.translatePosMatrix(br.projMatrix,zt,D.paint.get("fill-translate"),D.paint.get("fill-translate-anchor"));Ze&&$e.setupShadows(zt.tileID.toUnwrapped(),wr,"vector-tile");const en=D.paint.get("fill-emissive-strength");if(bt){Ht=Yt.lineIndexBuffer,sr=Yt.lineSegments;const Kr=M.terrain&&M.terrain.renderingToTexture?M.terrain.drapeBufferSize:[oe.drawingBufferWidth,oe.drawingBufferHeight];Pt=Ot==="fillOutlinePattern"&<?a5(on,en,M,zt,Kr,xt,je):hP(on,en,Kr,xt)}else Ht=Yt.indexBuffer,sr=Yt.triangleSegments,Pt=lt?i5(on,en,M,zt,xt,je):s5(on,en,xt);M.uploadCommonUniforms(M.context,wr,br.toUnwrapped());let $r=st;(Y==="road"&&!Q||Y==="offset")&&($r=qe),wr.draw(M,Vt,$r,b||M.stencilModeForClipping(br),V,Bn.disabled,Pt,D.id,Yt.layoutVertexBuffer,Ht,sr,D.paint,M.transform.zoom,qt,Gr)}};M.renderPass===le&&ot(M.depthModeForSublayer(1,M.renderPass==="opaque"?un.ReadWrite:un.ReadOnly),!1),Le==="none"&&M.renderPass==="translucent"&&D.paint.get("fill-antialias")&&ot(M.depthModeForSublayer(D.getPaintProperty("fill-outline-color")?2:0,un.ReadOnly),!0)}function Kk(_,d,m,b,M,L,D,B){m.resetLayerRenderingStats(_);const V=_.context,Y=V.gl,Q=_.transform,le=m.paint.get("fill-extrusion-pattern"),oe=m.paint.get("fill-extrusion-pattern-cross-fade"),ce=le.constantOr(null),je=le.constantOr(1),ve=m.paint.get("fill-extrusion-opacity"),Le=_.style.enable3dLights(),Pe=m.paint.get(Le&&!je?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),$e=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Pe],Ze=m.layout.get("fill-extrusion-edge-radius"),qe=Ze>0&&!m.paint.get("fill-extrusion-rounded-roof"),xt=qe?0:Ze,lt=Q.projection.name==="globe"?a.eb():0,ft=Q.projection.name==="globe",ot=ft?a.aj(Q.zoom):0,st=[a.aF(Q.center.lng),a.aJ(Q.center.lat)],bt=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ot=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(bt?null:m.lut).toArray01().slice(0,3),Pt=m.paint.get("fill-extrusion-flood-light-intensity"),Vt=m.paint.get("fill-extrusion-vertical-scale"),Ht=m.paint.get("fill-extrusion-line-width").constantOr(1)!==0,sr=m.paint.get("fill-extrusion-height-alignment"),br=m.paint.get("fill-extrusion-base-alignment"),zt=Pm(_,m.paint.get("fill-extrusion-cutoff-fade-range")),Mt=[];let Yt;ft&&Mt.push("PROJECTION_GLOBE_VIEW"),$e[0]>0&&Mt.push("FAUX_AO"),qe&&Mt.push("ZERO_ROOF_RADIUS"),B&&Mt.push("HAS_CENTROID"),Pt>0&&Mt.push("FLOOD_LIGHT"),zt.shouldRenderCutoff&&Mt.push("RENDER_CUTOFF"),Ht&&Mt.push("RENDER_WALL_MODE");const qt=_.renderPass==="shadow",ur=_.shadowRenderer,Er=qt&&!!ur,Gr=qt?Bn.disabled:Bn.backCCW;_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0);let Sr=[0,0,0];if(ur){const en=_.style.directionalLight,$r=_.style.ambientLight;en&&$r&&(Sr=yp(_.style,en,$r)),qt||(Mt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ur.useNormalOffset&&Mt.push("NORMAL_OFFSET")),Yt=Mt.concat(["SHADOWS_SINGLE_CASCADE"])}const wr=Er?"fillExtrusionDepth":je?"fillExtrusionPattern":"fillExtrusion",on=m.getLayerRenderingStats();for(const en of b){const $r=d.getTile(en),Kr=$r.getBucket(m);if(!Kr||Kr.projection.name!==Q.projection.name)continue;let Nn=!1;ur&&(Nn=ur.getMaxCascadeForTile(en.toUnwrapped())===0);const Yn=_.isTileAffectedByFog(en),Os=Kr.programConfigurations.get(m.id);let ui=!1;if(ce&&$r.imageAtlas){const ni=$r.imageAtlas,as=a.e3.from(ce),pi=as.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Da=as.getSecondary(),xa=ni.patternPositions.get(pi),xi=Da?ni.patternPositions.get(Da.scaleSelf(a.o.devicePixelRatio).toString()):null;ui=!!xa&&!!xi,xa&&Os.setConstantPatternPositions(xa,xi)}oe>0&&(ui||Os.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Mt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const dn=_.getOrCreateProgram(wr,{config:Os,defines:Nn?Yt:Mt,overrideFog:Yn});if(_.terrain&&_.terrain.setupElevationDraw($r,dn,{useMeterToDem:!0}),!Kr.centroidVertexBuffer){const ni=dn.getAttributeLocation(Y,"a_centroid_pos");ni!==-1&&Y.vertexAttrib2f(ni,0,0)}!qt&&ur&&ur.setupShadows($r.tileID.toUnwrapped(),dn,"vector-tile"),je&&(_.context.activeTexture.set(Y.TEXTURE0),$r.imageAtlasTexture&&$r.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Os.updatePaintBuffers());const ii=m.paint.get("fill-extrusion-vertical-gradient"),Hn=1/Kr.tileToMeter;let gi;if(qt&&ur){if(wp($r.tileID,Kr.maxHeight,_))continue;const ni=ur.calculateShadowPassMatrixFromTile($r.tileID.toUnwrapped());gi=n5(ni,xt,Hn,Vt,sr,br)}else{const ni=_.translatePosMatrix(en.expandedProjMatrix,$r,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),as=Q.projection.createInversionMatrix(Q,en.canonical);gi=je?uP(ni,_,ii,ve,$e,xt,Hn,en,$r,lt,sr,br,ot,st,as,Ot,Vt,oe):Bk(ni,_,ii,ve,$e,xt,Hn,en,lt,sr,br,ot,st,as,Ot,Vt,Pt,Sr)}_.uploadCommonUniforms(V,dn,en.toUnwrapped(),null,zt);let Li=Kr.segments;if(Q.projection.name==="mercator"&&!qt&&(Li=Kr.getVisibleSegments($r.tileID,_.terrain,_.transform.getFrustum(0)),!Li.get().length))continue;if(on)if(qt)for(const ni of Li.get())on.numRenderedVerticesInShadowPass+=ni.primitiveLength;else for(const ni of Li.get())on.numRenderedVerticesInTransparentPass+=ni.primitiveLength;const ji=[];(_.terrain||B)&&ji.push(Kr.centroidVertexBuffer),ft&&ji.push(Kr.layoutVertexExtBuffer),Ht&&ji.push(Kr.wallVertexBuffer),dn.draw(_,V.gl.TRIANGLES,M,L,D,Gr,gi,m.id,Kr.layoutVertexBuffer,Kr.indexBuffer,Li,m.paint,_.transform.zoom,Os,ji)}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1)}class u5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function bp(_,d,m,b,M,L,D,B,V,Y,Q,le,oe,ce,je,ve,Le,Pe,$e,Ze){const qe=d.context,xt=qe.gl,lt=d.transform,ft=d.transform.zoom,ot=[],st=_.translate,bt=_.translateAnchor,Ot=_.edgeRadius,Pt=Pm(d,_.cutoffFadeRange);Q==="clear"?(ot.push("CLEAR_SUBPASS"),Ze&&(ot.push("CLEAR_FROM_TEXTURE"),qe.activeTexture.set(xt.TEXTURE0),Ze.bind(xt.LINEAR,xt.CLAMP_TO_EDGE))):Q==="sdf"?ot.push("SDF_SUBPASS"):Q==="emissive"&&(ot.push("USE_MRT1"),qe.activeTexture.set(xt.TEXTURE0),Ze.bind(xt.LINEAR,xt.CLAMP_TO_EDGE)),Pe&&ot.push("HAS_CENTROID"),Pt.shouldRenderCutoff&&ot.push("RENDER_CUTOFF");const Vt=(Ht,sr,br,zt,Mt)=>{let Yt=ot;sr.groundRadiusBuffer!=null&&(Yt=ot.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const qt=sr.programConfigurations.get(b.id),ur=d.isTileAffectedByFog(Ht),Er=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:qt,defines:Yt,overrideFog:ur}),Gr=Ly(d,zt,le,Y,Mt,[oe,ce*Mt],je,ve,Le,ft>=17?0:Ot*Mt,Ze?Ze.size[0]:0),Sr=[];Pe&&Sr.push(sr.hiddenByLandmarkVertexBuffer),sr.groundRadiusBuffer!=null&&Sr.push(sr.groundRadiusBuffer),d.uploadCommonUniforms(qe,Er,Ht.toUnwrapped(),null,Pt),Er.draw(d,qe.gl.TRIANGLES,L,D,B,V,Gr,b.id,sr.vertexBuffer,sr.indexBuffer,br,b.paint,ft,qt,Sr)};for(const Ht of M){const sr=m.getTile(Ht),br=sr.getBucket(b);if(!br||br.projection.name!==lt.projection.name||!br.groundEffect||br.groundEffect&&!br.groundEffect.hasData())continue;const zt=br.groundEffect,Mt=1/br.tileToMeter;{const Yt=d.translatePosMatrix(Ht.projMatrix,sr,st,bt),qt=zt.getDefaultSegment();Vt(Ht,zt,qt,Yt,Mt)}if($e)for(let Yt=0;Yt<4;Yt++){const qt=a.e9[Yt](Ht),ur=m.getTile(qt);if(!ur)continue;const Er=ur.getBucket(b);if(!Er||Er.projection.name!==lt.projection.name||!Er.groundEffect||Er.groundEffect&&!Er.groundEffect.hasData())continue;const Gr=Er.groundEffect;let Sr,wr;Yt===0?(Sr=[-a.al,0,0],wr=1):Yt===1?(Sr=[a.al,0,0],wr=0):Yt===2?(Sr=[0,-a.al,0],wr=3):(Sr=[0,a.al,0],wr=2);const on=Gr.regionSegments[wr];if(!on)continue;const en=new Float32Array(16);a.br(en,Ht.projMatrix,Sr),Vt(Ht,Gr,on,d.translatePosMatrix(en,sr,st,bt),Mt)}}}function cae(_,d,m,b,M,L,D){b.centroidVertexArray.length===0&&b.createCentroidsBuffer();const B=L?L.findDEMTileFor(m):null;if(!(B&&B.dem||D))return;L&&B&&B.dem&&b.selfDEMTileTimestamp!==B.dem._timestamp&&(b.borderDoneWithNeighborZ=[-1,-1,-1,-1],b.selfDEMTileTimestamp=B.dem._timestamp);const V=Pe=>new a.P(Math.ceil((Pe+a.ed)*a.ee),0),Y=Pe=>{const $e=d.getSource().minzoom,Ze=xt=>{const lt=d.getTileByID(xt);if(lt&<.hasData())return lt.getBucket(M)},qe=[0,-1,1];for(const xt of qe){if(Pe.overscaledZ+xt<$e)continue;const lt=Ze(Pe.calculateScaledKey(Pe.overscaledZ+xt));if(lt)return lt}},Q=[0,0,0],le=(Pe,$e)=>(Q[0]=Math.min(Pe.min.y,$e.min.y),Q[1]=Math.max(Pe.max.y,$e.max.y),Q[2]=a.al-$e.min.x>Pe.max.x?$e.min.x-a.al:Pe.max.x,Q),oe=(Pe,$e)=>(Q[0]=Math.min(Pe.min.x,$e.min.x),Q[1]=Math.max(Pe.max.x,$e.max.x),Q[2]=a.al-$e.min.y>Pe.max.y?$e.min.y-a.al:Pe.max.y,Q),ce=[(Pe,$e)=>le(Pe,$e),(Pe,$e)=>le($e,Pe),(Pe,$e)=>oe(Pe,$e),(Pe,$e)=>oe($e,Pe)],je=(Pe,$e,Ze,qe,xt,lt,ft)=>{if(!L)return 0;const ot=[[lt?Ze:Pe,lt?Pe:Ze,0],[lt?Ze:$e,lt?$e:Ze,0]],st=ft<0?a.al+ft:ft,bt=[lt?st:(Pe+$e)/2,lt?(Pe+$e)/2:st,0];return Ze===0&&ft<0||Ze!==0&&ft>0?L.getForTilePoints(xt,[bt],!0,qe):ot.push(bt),L.getForTilePoints(m,ot,!0,B),Math.max(ot[0][2],ot[1][2],bt[2])/L.exaggeration()};for(let Pe=0;Pe<4;Pe++){const $e=b.borderFeatureIndices[Pe];if($e.length===0)continue;const Ze=a.e9[Pe](m),qe=Y(Ze);if(!(qe&&qe instanceof a.ea))continue;const xt=L?L.findDEMTileFor(Ze):null;if(!(xt&&xt.dem||D)||(L&&xt&&xt.dem&&b.borderDEMTileTimestamp[Pe]!==xt.dem._timestamp&&(b.borderDoneWithNeighborZ[Pe]=-1,b.borderDEMTileTimestamp[Pe]=xt.dem._timestamp),b.borderDoneWithNeighborZ[Pe]===qe.canonical.z))continue;qe.centroidVertexArray.length===0&&qe.createCentroidsBuffer();const lt=(Pe<2?1:5)-Pe,ft=qe.borderDoneWithNeighborZ[lt]!==b.canonical.z,ot=qe.borderFeatureIndices[lt];let st=0;if(b.canonical.z!==qe.canonical.z){for(const bt of $e)b.showCentroid(b.featuresOnBorder[bt]);if(ft)for(const bt of ot)qe.showCentroid(qe.featuresOnBorder[bt]);b.borderDoneWithNeighborZ[Pe]=qe.canonical.z,qe.borderDoneWithNeighborZ[lt]=b.canonical.z}for(const bt of $e){const Ot=b.featuresOnBorder[bt],Pt=b.centroidData[Ot.centroidDataIndex],Vt=Ot.borders[Pe];let Ht;for(;stVt[0]+3||sr[0]>Vt[0]-3)break;qe.showCentroid(Ht),st++}if(Ht&&stVt[1]-3)&&(br++,++st!==ot.length);)Ht=qe.featuresOnBorder[ot[st]];Ht=qe.featuresOnBorder[ot[sr]];let zt=!1;if(br>=1){const qt=Ht.borders[lt];Math.abs(Vt[0]-qt[0])<3&&Math.abs(Vt[1]-qt[1])<3&&(br=1,zt=!0,st=sr+1)}else if(br===0){b.showCentroid(Ot);continue}const Mt=qe.centroidData[Ht.centroidDataIndex];D&&zt&&(((ve=Pt).flags|(Le=Mt).flags)&a.ec?(ve.flags|=a.ec,Le.flags|=a.ec):(ve.flags&=~a.ec,Le.flags&=~a.ec));const Yt=Ot.intersectsCount()>1||Ht.intersectsCount()>1;if(br>1)st=sr,Pt.centroidXY=Mt.centroidXY=new a.P(0,0);else if(xt&&xt.dem&&!Yt){const qt=ce[Pe](Pt,Mt),ur=Pe%2?a.al-1:0,Er=je(qt[0],Math.min(a.al-1,qt[1]),ur,xt,Ze,Pe<2,qt[2]);Pt.centroidXY=Mt.centroidXY=V(Er)}else Yt?Pt.centroidXY=Mt.centroidXY=new a.P(0,0):(Pt.centroidXY=b.encodeBorderCentroid(Ot),Mt.centroidXY=qe.encodeBorderCentroid(Ht));b.writeCentroidToBuffer(Pt),qe.writeCentroidToBuffer(Mt)}else b.showCentroid(Ot)}b.borderDoneWithNeighborZ[Pe]=qe.canonical.z,qe.borderDoneWithNeighborZ[lt]=b.canonical.z}var ve,Le;(b.needsCentroidUpdate||!b.centroidVertexBuffer&&b.centroidVertexArray.length!==0)&&b.uploadCentroid(_)}const Ud=[1,0,0],h5=[0,1,0],ed=[0,0,1];function wp(_,d,m){const b=m.transform,M=m.shadowRenderer;if(!M)return!0;const L=_.toUnwrapped(),D=b.tileSize*M._cascades[m.currentShadowCascade].scale;let B=d;if(b.elevation){const ve=b.elevation.getMinMaxForTile(_);ve&&(B+=ve.max)}const V=[...M.shadowDirection];V[2]=-V[2];const Y=M.computeSimplifiedTileShadowVolume(L,B,D,V);if(!Y)return!1;const Q=[Ud,h5,ed,V,[V[0],0,V[2]],[0,V[1],V[2]]],le=b.projection.name==="globe",oe=b.scaleZoom(D),ce=a.cB.fromInvProjectionMatrix(b.invProjMatrix,b.worldSize,oe,!le),je=M.getCurrentCascadeFrustum();return ce.intersectsPrecise(Y.vertices,Y.planes,Q)===0||je.intersectsPrecise(Y.vertices,Y.planes,Q)===0}function Lv(_){const{painter:d,source:m,layer:b,coords:M}=_;let L=_.defines;const D=d.context,B=d.renderPass==="shadow",V=d.renderPass==="light-beam",Y=d.shadowRenderer,Q=a.ef(d.transform.center.lat,d.transform.zoom),le=Pm(d,b.paint.get("building-cutoff-fade-range"));le.shouldRenderCutoff&&(L=L.concat("RENDER_CUTOFF")),_.floodLightIntensity>0&&(L=L.concat("FLOOD_LIGHT"));for(const oe of M){const ce=m.getTile(oe),je=ce.getBucket(b);if(!je)continue;Y&&Y.getMaxCascadeForTile(oe.toUnwrapped())===0&&(L=L.concat("SHADOWS_SINGLE_CASCADE"));const ve=je.programConfigurations.get(b.id);let Le,Pe,$e,Ze=d.translatePosMatrix(oe.expandedProjMatrix,ce,[0,0],"map");if(Ze=a.cS(a.bC(),Ze,[1,1,_.verticalScale]),B&&Y){if(wp(ce.tileID,je.maxHeight*Q,d))continue;let xt=Y.calculateShadowPassMatrixFromTile(ce.tileID.toUnwrapped());xt=a.cS(a.bC(),xt,[1,1,_.verticalScale]),$e=Bm(xt),Le=Pe=d.getOrCreateProgram("buildingDepth",{config:ve,defines:L,overrideFog:!1})}else if(V)Le=Pe=d.getOrCreateProgram("buildingBloom",{config:ve,defines:L,overrideFog:!1}),$e=fP(Ze);else{const xt=d.transform.calculatePosMatrix(oe.toUnwrapped(),d.transform.worldSize);a.cS(xt,xt,[1,1,_.verticalScale]);const lt=a.bC();a.cS(lt,xt,[1,-1,1/Q]),a.bl(lt,lt),a.eg(lt,lt);const ft=d.transform.getFreeCameraOptions().position,ot=1<{if(V){const ft=xt.entranceBloom;lt.draw(d,D.gl.TRIANGLES,_.depthMode,$n.disabled,_.blendMode,Bn.disabled,$e,b.id,ft.layoutVertexBuffer,ft.indexBuffer,ft.segmentsBucket,b.paint,d.transform.zoom,ve,[ft.layoutAttenuationBuffer,ft.layoutColorBuffer])}else{const ft=xt.segmentsBucket;let ot=[xt.layoutNormalBuffer,xt.layoutCentroidBuffer,xt.layoutColorBuffer,xt.layoutFloodLightDataBuffer];xt.layoutFacadePaintBuffer&&(ot=ot.concat([xt.layoutFacadeDataBuffer,xt.layoutFacadeVerticalRangeBuffer,xt.layoutFacadePaintBuffer])),lt.draw(d,D.gl.TRIANGLES,_.depthMode,$n.disabled,_.blendMode,B?Bn.disabled:Bn.backCW,$e,b.id,xt.layoutVertexBuffer,xt.indexBuffer,ft,b.paint,d.transform.zoom,ve,ot)}};d.uploadCommonUniforms(D,Pe,oe.toUnwrapped(),null,le),je.buildingWithoutFacade&&qe(je.buildingWithoutFacade,Pe),je.buildingWithFacade&&(Le!==Pe&&d.uploadCommonUniforms(D,Le,oe.toUnwrapped(),null,le),qe(je.buildingWithFacade,Le))}}function Zk(_,d,m,b,M,L,D,B,V,Y,Q,le,oe){const ce=_.context.gl,je=_.depthModeForSublayer(1,un.ReadOnly,ce.LEQUAL,!0),ve=.1*(1-(Le=Q))+3*Le;var Le;const Pe=_._showOverdrawInspector,$e=le,Ze=new u5;Pe||bp(Ze,_,d,m,b,je,new $n({func:ce.ALWAYS,mask:255},255,255,ce.KEEP,ce.KEEP,ce.REPLACE),new is([ce.ONE,ce.ONE,ce.ONE,ce.ONE],a.ao.transparent,[!1,!1,!1,!0],ce.MIN),Bn.disabled,M,"sdf",L,D,B,V,Y,ve,$e,!1);{const qe=Pe?$n.disabled:new $n({func:ce.EQUAL,mask:255},255,255,ce.KEEP,ce.DECR,ce.DECR),xt=Pe?_.colorModeForRenderPass():new is([ce.ONE_MINUS_DST_ALPHA,ce.DST_ALPHA,ce.ONE,ce.ONE],a.ao.transparent,[!0,!0,!0,!0]);bp(Ze,_,d,m,b,je,qe,xt,Bn.disabled,M,"color",L,D,B,V,Y,ve,$e,!1)}}function Yk(_){return[_[0]*a.eh,_[1]*a.eh,_[2]*a.eh,0]}function Ov(_,d,m,b,M,L,D,B,V){const Y=b.getSource(),Q=m.globeSharedBuffers;if(!Q)return;let le,oe,ce;if(d&&(le=b.getTile(d)),Y instanceof a.aU?(oe=Y.texture,ce=a.dK(0,0,m.transform)):le&&d&&(oe=le.texture,ce=a.dK(d.canonical.z,d.canonical.x,m.transform)),!oe||!ce)return;_||(ce=a.cS(a.bC(),ce,[1,-1,1]));const je=m.context,ve=je.gl,Le=M.paint.get("raster-resampling")==="nearest"?ve.NEAREST:ve.LINEAR,Pe=m.colorModeForDrapableLayerRenderPass(L),$e=D.defines;$e.push("GLOBE_POLES");const Ze=new un(ve.LEQUAL,un.ReadWrite,m.depthRangeFor3D),qe=Float32Array.from(m.transform.expandedFarZProjMatrix),xt=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0))));m.terrain&&m.terrain.prepareDrawTile(),je.activeTexture.set(ve.TEXTURE0),oe.bind(Le,ve.CLAMP_TO_EDGE),je.activeTexture.set(ve.TEXTURE1),oe.bind(Le,ve.CLAMP_TO_EDGE),"useMipmap"in oe&&je.extTextureFilterAnisotropic&&m.transform.pitch>20&&ve.texParameterf(ve.TEXTURE_2D,je.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,je.extTextureFilterAnisotropicMax);const[lt,ft,ot,st]=d?Q.getPoleBuffers(d.canonical.z,!1):Q.getPoleBuffers(0,!0),bt=M.paint.get("raster-elevation");let Ot;_?(Ot=lt,m.renderDefaultNorthPole=bt!==0):(Ot=ft,m.renderDefaultSouthPole=bt!==0);const Pt=Yk(D.mix),Vt=((sr,br,zt,Mt,Yt,qt,ur,Er,Gr,Sr,wr,on,en)=>gP(sr,br,zt,new Float32Array(16),new Float32Array(9),[0,0],Mt,[0,0],[0,0,0,0],1,{opacity:1,mix:0},qt,[0,0],Er,2,Sr,wr,on,1,0,en))(qe,xt,ce,a.aj(m.transform.zoom),0,M,0,bt,0,Pt,D.offset,D.range,L),Ht=m.getOrCreateProgram("raster",{defines:$e});m.uploadCommonUniforms(je,Ht,null),Ht.draw(m,ve.TRIANGLES,Ze,V,Pe,B,Vt,M.id,Ot,ot,st)}function jP(_){const d=_._nearZ,m=_.projection.farthestPixelDistance(_),b=m-d,M=.2*_.height,L=d+M;return[d,m,(L-M-d)/b,(L-d)/b]}function jp(_,d,m,b){if(_)return d instanceof sl&&_ instanceof pp?d.getTextureDescriptor(_,m,!0):{texture:_.texture,mix:Yk(b.mix),offset:b.offset,buffer:0,tileSize:1}}var Ji=a.ei([{name:"a_index",type:"Int16",components:1}]);class Xk{constructor(d,m,b,M){const L={width:b[0],height:b[1],data:null},D=d.gl;this.targetColorTexture=new a.T(d,L,D.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new a.T(d,L,D.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(m,M),this.lastInvalidatedAt=0}updateParticleTexture(d,m){if(this.particleTextureDimension===m.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const b=this.context.gl,M=m.width*m.height;this.particleTexture0=new a.T(this.context,m,b.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new a.T(this.context,m,b.RGBA8,{premultiply:!1,useMipmap:!1});const L=new a.ej;L.reserve(M);for(let D=0;D0){const Pt=a.bj(m.canonical,V),Vt=a.el(Pt);oe=a.aB(new Float32Array(16),V.globeMatrix,Vt),a.aB(oe,V.projMatrix,oe)}const ce=a.bC();ce[12]+=2*M/(a.o.devicePixelRatio*V.width),ce[13]+=2*L/(a.o.devicePixelRatio*V.height),a.aB(oe,ce,oe);const je=_.getOrCreateProgram("debug",{defines:le}),ve=d.getTileByID(m.key);_.terrain&&_.terrain.setupElevationDraw(ve,je);const Le=un.disabled,Pe=$n.disabled,$e=_.colorModeForRenderPass(),Ze="$debug";B.activeTexture.set(Y.TEXTURE0),_.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Q?ve._makeGlobeTileDebugBuffers(_.context,V):ve._makeDebugTileBoundsBuffers(_.context,V.projection);const qe=ve._tileDebugBuffer||_.debugBuffer,xt=ve._tileDebugIndexBuffer||_.debugIndexBuffer,lt=ve._tileDebugSegments||_.debugSegments;if(je.draw(_,Y.LINE_STRIP,Le,Pe,$e,Bn.disabled,Av(oe,b.toPremultipliedRenderColor(null)),Ze,qe,xt,lt,null,null,null,[ve._globeTileDebugBorderBuffer]),D){const Pt=ve.latestRawTileData,Vt=Math.floor((Pt&&Pt.byteLength||0)/1024);let Ht=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(Ht+=` => ${m.overscaledZ}`),Ht+=` ${ve.state}`,Ht+=` ${Vt}kb`,function(sr,br){sr.initDebugOverlayCanvas();const zt=sr.debugOverlayCanvas,Mt=sr.context.gl,Yt=sr.debugOverlayCanvas.getContext("2d");Yt.clearRect(0,0,zt.width,zt.height),Yt.shadowColor="white",Yt.shadowBlur=2,Yt.lineWidth=1.5,Yt.strokeStyle="white",Yt.textBaseline="top",Yt.font="bold 36px Open Sans, sans-serif",Yt.fillText(br,5,5),Yt.strokeText(br,5,5),sr.debugOverlayTexture.update(zt),sr.debugOverlayTexture.bind(Mt.LINEAR,Mt.CLAMP_TO_EDGE)}(_,Ht)}const ft=d.getTile(m).tileSize,ot=512/Math.min(ft,512)*(m.overscaledZ/V.zoom)*.5,st=ve._tileDebugTextBuffer||_.debugBuffer,bt=ve._tileDebugTextIndexBuffer||_.quadTriangleIndexBuffer,Ot=ve._tileDebugTextSegments||_.debugSegments;je.draw(_,Y.TRIANGLES,Le,Pe,is.alphaBlended,Bn.disabled,Av(oe,a.ao.transparent.toPremultipliedRenderColor(null),ot),Ze,st,bt,Ot,null,null,null,[ve._globeTileDebugTextBuffer])}function tx(_,d,m,b){Rt(_,0,d+m/2,_.transform.width,m,b)}function $a(_,d,m,b){Rt(_,d-m/2,0,m,_.transform.height,b)}function Rt(_,d,m,b,M,L){const D=_.context,B=D.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*a.o.devicePixelRatio,m*a.o.devicePixelRatio,b*a.o.devicePixelRatio,M*a.o.devicePixelRatio),D.clear({color:L}),B.disable(B.SCISSOR_TEST)}const MP=a.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Qk}=MP;function xf(_,d,m,b){_.emplaceBack(d,m,b)}class Jk{constructor(d){this.vertexArray=new a.em,this.indices=new a.b0,xf(this.vertexArray,-1,-1,1),xf(this.vertexArray,1,-1,1),xf(this.vertexArray,-1,1,1),xf(this.vertexArray,1,1,1),xf(this.vertexArray,-1,-1,-1),xf(this.vertexArray,1,-1,-1),xf(this.vertexArray,-1,1,-1),xf(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=d.createVertexBuffer(this.vertexArray,Qk),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=a.bg.simpleSegment(0,0,36,12)}}function rx(_,d,m,b,M,L){const D=_.context.gl,B=d.paint.get("sky-atmosphere-color"),V=d.paint.get("sky-atmosphere-halo-color"),Y=d.paint.get("sky-atmosphere-sun-intensity"),Q=((le,oe,ce,je,ve)=>({u_matrix_3f:le,u_sun_direction:oe,u_sun_intensity:ce,u_color_tint_r:[je.r,je.g,je.b,je.a],u_color_tint_m:[ve.r,ve.g,ve.b,ve.a],u_luminance:5e-5}))(a.eo(a.dO(),b),M,Y,B.toPremultipliedRenderColor(null),V.toPremultipliedRenderColor(null));D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+L,d.skyboxTexture,0),m.draw(_,D.TRIANGLES,un.disabled,$n.disabled,is.unblended,Bn.frontCW,Q,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const TP=a.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ry{constructor(d){const m=new a.ep;m.emplaceBack(-1,1,1,0,0),m.emplaceBack(1,1,1,1,0),m.emplaceBack(1,-1,1,1,1),m.emplaceBack(-1,-1,1,0,1);const b=new a.b0;b.emplaceBack(0,1,2),b.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(m,TP.members),this.indexBuffer=d.createIndexBuffer(b),this.segments=a.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const dae=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class uae{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class AP{constructor(d){this.colorModeAlphaBlendedWriteRGB=new is([1,ff,1,ff],a.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new is([1,0,1,0],a.ao.transparent,[!1,!1,!1,!0]),this.params=new uae,this.updateNeeded=!0}update(d){const m=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ry(m);const b=this.params.sizeRange,M=this.params.intensityRange,L=function(Q){const le=a.eq(30),oe=[];for(let ce=0;ce{const ot=L.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ft&&ot.push("ALPHA_PASS");const st=d.getOrCreateProgram("globeAtmosphere",{defines:ot}),bt=((Pt,Vt,Ht,sr,br,zt,Mt,Yt,qt,ur,Er,Gr)=>({u_frustum_tl:Pt,u_frustum_tr:Vt,u_frustum_br:Ht,u_frustum_bl:sr,u_horizon:br,u_transition:zt,u_fadeout_range:Mt,u_atmosphere_fog_color:Yt.toArray01(),u_high_color:qt.toArray01(),u_space_color:ur.toArray01(),u_temporal_offset:Er,u_horizon_angle:Gr}))(L.frustumCorners.TL,L.frustumCorners.TR,L.frustumCorners.BR,L.frustumCorners.BL,L.frustumCorners.horizon,B,Le,Q,oe,je,$e,xt);d.uploadCommonUniforms(b,st);const Ot=this.atmosphereBuffer;Ot&&st.draw(d,M.TRIANGLES,D,$n.disabled,ft?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Bn.backCW,bt,ft?"atmosphere_glow_alpha":"atmosphere_glow",Ot.vertexBuffer,Ot.indexBuffer,Ot.segments)};lt(!1),lt(!0)}drawStars(d,m){const b=a.aA(m.properties.get("star-intensity"),0,1);if(b===0)return;const M=d.context,L=M.gl,D=d.transform,B=d.getOrCreateProgram("stars"),V=a.c7([]);a.c9(V,V,-D._pitch),a.c8(V,V,-D.angle),a.c9(V,V,a.an(D._center.lat)),a.et(V,V,-a.an(D._center.lng));const Y=a.cc(new Float32Array(16),V),Q=a.aB([],D.starsProjMatrix,Y),le=a.eo([],Y),oe=a.eu([],le),ce=[0,1,0];a.dQ(ce,ce,oe),a.c5(ce,ce,this.params.sizeMultiplier);const je=[1,0,0];a.dQ(je,je,oe),a.c5(je,je,this.params.sizeMultiplier);const ve=(Le=ce,Pe=je,$e=b,{u_matrix:Float32Array.from(Q),u_up:Le,u_right:Pe,u_intensity_multiplier:$e});var Le,Pe,$e;d.uploadCommonUniforms(M,B),this.starsVx&&this.starsIdx&&B.draw(d,L.TRIANGLES,un.disabled,$n.disabled,this.colorModeAlphaBlendedWriteRGB,Bn.disabled,ve,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class eN{constructor(){this.visibleTiles=[]}updateBorders(d,m){const b=[],M=[],L=d._getRenderableCoordinates(!1,!0);for(const V of L){const Y=d.getTile(V);if(!Y.hasData())continue;const Q=Y.getBucket(m);Q&&(Q.isEmpty()||(b.push(V.key),M.push({bucket:Q,tileID:V.canonical})))}let D=b.length!==this.visibleTiles.length;if(!D){b.sort();for(let V=0;VV.tileID.z-Y.tileID.z||V.tileID.x-Y.tileID.x||V.tileID.y-Y.tileID.y);for(const V of M){const Y=new Array,Q=new Array,le=V.bucket;for(const oe of le.featuresOnBorder)B.has(oe.featureId)?Q.push(oe.footprintIndex):(B.add(oe.featureId),Y.push(oe.footprintIndex));le.updateFootprintHiddenFlags(Y,a.ev,!1),le.updateFootprintHiddenFlags(Q,a.ev,!0)}}}function tN(_,d){const m=[..._],b=d.cameraWorldSizeForFog/d.worldSize,M=a.bA([]);return a.cS(M,M,[b,b,1]),a.aB(m,M,m),a.aB(m,d.worldToFogMatrix,m),m}function rN(_,d,m,b,M){const L=m.material,D=b.context,{baseColorTexture:B,metallicRoughnessTexture:V}=L.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:Q,emissionTexture:le}=L;function oe(je,ve,Le){if(je&&(_.push(ve),D.activeTexture.set(D.gl.TEXTURE0+Le),je.gfxTexture)){const{minFilter:Pe,magFilter:$e,wrapS:Ze,wrapT:qe}=je.sampler;je.gfxTexture.bindExtraParam(Pe,$e,Ze,qe)}}oe(B,"HAS_TEXTURE_u_baseColorTexture",Sl.BaseColor),oe(V,"HAS_TEXTURE_u_metallicRoughnessTexture",Sl.MetallicRoughness),oe(Y,"HAS_TEXTURE_u_normalTexture",Sl.Normal),oe(Q,"HAS_TEXTURE_u_occlusionTexture",Sl.Occlusion),oe(le,"HAS_TEXTURE_u_emissionTexture",Sl.Emission),M&&(M.texture||(M.texture=new a.d$(b.context,M.image,[M.image.height,M.image.height,M.image.height],D.gl.RGBA8)),D.activeTexture.set(D.gl.TEXTURE0+Sl.LUT),M.texture&&M.texture.bind(D.gl.LINEAR,D.gl.CLAMP_TO_EDGE),_.push("APPLY_LUT_ON_GPU")),m.texcoordBuffer&&(_.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(m.texcoordBuffer)),m.colorBuffer&&(_.push(m.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(m.colorBuffer)),m.normalBuffer&&(_.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(m.normalBuffer)),m.pbrBuffer&&(_.push("HAS_ATTRIBUTE_a_pbr"),_.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(m.pbrBuffer)),L.alphaMode!=="OPAQUE"&&L.alphaMode!=="MASK"||_.push("UNPREMULT_TEXTURE_IN_SHADER"),L.defined||_.push("DIFFUSE_SHADED");const ce=b.shadowRenderer;ce&&(_.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ce.useNormalOffset&&_.push("NORMAL_OFFSET"))}function nN(_,d,m,b,M,L){const D=_.modelOpacity,B=d.context,V=new un(d.context.gl.LEQUAL,_.isLightMesh?un.ReadOnly:un.ReadWrite,d.depthRangeFor3D),Y=d.transform,Q=_.mesh,le=Q.material,oe=le.pbrMetallicRoughness,ce=d.style.fog;let je;je=d.transform.projection.zAxisUnit==="pixels"?[..._.nodeModelMatrix]:a.aB([],b.zScaleMatrix,_.nodeModelMatrix),a.aB(je,b.negCameraPosMatrix,je);const ve=a.bl([],je);a.eg(ve,ve);const Le=m.paint.get("model-color-use-theme").constantOr("default")==="none",Pe=m.paint.get("model-emissive-strength").constantOr(0),$e=Xg(new Float32Array(_.worldViewProjection),new Float32Array(je),new Float32Array(ve),null,d,D,oe.baseColorFactor,le.emissiveFactor,oe.metallicFactor,oe.roughnessFactor,le,Pe,m,void 0,void 0,_.materialOverride,_.modelColor),Ze={defines:[]},qe=[],xt=d.shadowRenderer;xt&&(xt.useNormalOffset=!1),rN(Ze.defines,qe,Q,d,Le?null:m.lut);let lt=null;if(ce){const st=tN(_.nodeModelMatrix,d.transform);if(lt=new Float32Array(st),Y.projection.name!=="globe"){const bt=Q.aabb.min,Ot=Q.aabb.max,[Pt,Vt]=ce.getOpacityForBounds(st,bt[0],bt[1],Ot[0],Ot[1]);Ze.overrideFog=Pt>=ar||Vt>=ar}}const ft=Pm(d,m.paint.get("model-cutoff-fade-range"));ft.shouldRenderCutoff&&Ze.defines.push("RENDER_CUTOFF");const ot=d.getOrCreateProgram("model",Ze);d.uploadCommonUniforms(B,ot,null,lt,ft),d.renderPass!=="shadow"&&xt&&xt.setupShadowsFromMatrix(_.nodeModelMatrix,ot),ot.draw(d,B.gl.TRIANGLES,V,M,L,Q.material.doubleSided?Bn.disabled:Bn.backCCW,$e,m.id,Q.vertexBuffer,Q.indexBuffer,Q.segments,m.paint,d.transform.zoom,void 0,qe)}function Dv(_,d){return _.style._importedAsBasemap?"basemap":d.scope}function nx(_,d,m,b,M,L,D,B,V,Y){const Q=_.transform,le=!!d.isGeometryBloom&&d.isGeometryBloom;if(le&&_.renderPass==="shadow")return;const oe=Q.projection.name==="globe"?a.eD(m,Q):[...m];a.aB(oe,oe,d.globalMatrix);const ce=a.aB([],b,oe);if(d.meshes)for(const je of d.meshes){const ve=B.get(je.material.name);if(ve&&ve.opacity<=0)continue;if(je.material.alphaMode!=="BLEND"){D.push({mesh:je,depth:0,modelIndex:M,worldViewProjection:ce,nodeModelMatrix:oe,isLightMesh:le,materialOverride:ve,modelOpacity:V,modelColor:Y});continue}const Le=a.af([],je.centroid,ce);!Q.isOrthographic&&Le[2]<=0||L.push({mesh:je,depth:Le[2],modelIndex:M,worldViewProjection:ce,nodeModelMatrix:oe,isLightMesh:le,materialOverride:ve,modelOpacity:V,modelColor:Y})}if(d.children)for(const je of d.children)nx(_,je,m,b,M,L,D,B,V,Y)}function Mh(_,d,m,b){const M=m.shadowRenderer;if(!M)return;const L=M.getShadowPassDepthMode(),D=M.getShadowPassColorMode(),B=M.calculateShadowPassMatrixFromMatrix(d),V=l5(B);m.getOrCreateProgram("modelDepth",{defines:m._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(m,m.context.gl.TRIANGLES,L,$n.disabled,D,Bn.disabled,V,b.id,_.vertexBuffer,_.indexBuffer,_.segments,b.paint,m.transform.zoom,void 0,void 0)}function EP(_,d,m,b,M,L){for(const D of M){const B=Object.assign({},b);B.part=D;const V={type:"Unknown",id:d,properties:B},Y={orientation:_.paint.get("model-rotation").evaluate(V,m)};L.set(D,Y)}}function IP(_,d,m,b,M,L){for(const D of M){const B=Object.assign({},b);B.part=D;const V={type:"Unknown",id:d,properties:B},Y={color:_.paint.get("model-color").evaluate(V,m),colorMix:_.paint.get("model-color-mix-intensity").evaluate(V,m),opacity:_.paint.get("model-opacity").evaluate(V,m),emissionStrength:_.paint.get("model-emissive-strength").evaluate(V,m)};L.set(D,Y)}}function PP(_,d,m,b,M){let L=!1;for(const B of b)B.modelOpacity!==1&&(nN(B,_,d,M[B.modelIndex],$n.disabled,is.disabled),L=!0);for(const B of b)nN(B,_,d,M[B.modelIndex],B.modelOpacity!==1?_.stencilModeFor3D():$n.disabled,_.colorModeForRenderPass());L&&_.resetStencilClippingMasks();const D=is.additive;for(const B of m)nN(B,_,d,M[B.modelIndex],$n.disabled,B.isLightMesh?D:_.colorModeForRenderPass())}function LP(_,d,m){const b=d.updateZoomBasedPaintProperties(),M=function(L,D,B){let V,Y,Q,le=L.terrain?L.terrain.exaggeration():0;if(L.terrain&&le>0){const oe=L.terrain,ce=oe.findDEMTileFor(B);ce&&ce.dem?V=a.eF.create(oe,B,ce):le=0}if(le===0&&(D.terrainElevationMin=0,D.terrainElevationMax=0),le===D.validForExaggeration&&(le===0||V&&V._demTile&&V._demTile.tileID===D.validForDEMTile.id&&V._dem._timestamp===D.validForDEMTile.timestamp))return!1;for(const oe in D.instancesPerModel){const ce=D.instancesPerModel[oe];for(let je=0;jeY&&(Y=ce.max)}const Q=a.aA(b.x,L,D)-b.x,le=a.aA(b.y,B,V)-b.y,oe=a.cf(Y,d.center.lat)-b.z;return d._zoomFromMercatorZ(Math.sqrt(Q*Q+le*le+oe*oe))}function OP(_,d,m,b,M,L,D){const B=_.context,V=_.renderPass==="shadow",Y=_.shadowRenderer,Q=V&&Y?Y.getShadowPassDepthMode():new un(B.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D),le=_.isTileAffectedByFog(L),oe=_.transform.projection.name==="globe";if(m.meshes)for(const ce of m.meshes){const je=oe?[]:["MODEL_POSITION_ON_GPU"],ve=[];let Le,Pe,$e;const Ze=!oe&&b.instancedDataArray.length>20;Ze&&je.push("INSTANCED_ARRAYS");const qe=Pm(_,d.paint.get("model-cutoff-fade-range"));if(qe.shouldRenderCutoff&&je.push("RENDER_CUTOFF"),V&&Y)Le=_.getOrCreateProgram("modelDepth",{defines:je}),Pe=l5(D.shadowTileMatrix,D.shadowTileMatrix,Float32Array.from(m.globalMatrix)),$e=Y.getShadowPassColorMode();else{rN(je,ve,ce,_,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Le=_.getOrCreateProgram("model",{defines:je,overrideFog:le});const lt=ce.material,ft=lt.pbrMetallicRoughness,ot=d.paint.get("model-opacity").constantOr(1),st=d.paint.get("model-emissive-strength").constantOr(0);Pe=Xg(L.expandedProjMatrix,Float32Array.from(m.globalMatrix),new Float32Array(16),null,_,ot,ft.baseColorFactor,lt.emissiveFactor,ft.metallicFactor,ft.roughnessFactor,lt,st,d,M),Y&&(D.shadowUniformsInitialized?Le.setShadowUniformValues(B,Y.getShadowUniformValues()):(Y.setupShadows(L.toUnwrapped(),Le,"model-tile"),D.shadowUniformsInitialized=!0)),$e=qe.shouldRenderCutoff||ot<1||lt.alphaMode!=="OPAQUE"?is.alphaBlended:is.unblended}_.uploadCommonUniforms(B,Le,L.toUnwrapped(),null,qe);const xt=ce.material.doubleSided?Bn.disabled:Bn.backCCW;if(Ze)ve.push(b.instancedDataBuffer),Le.draw(_,B.gl.TRIANGLES,Q,$n.disabled,$e,xt,Pe,d.id,ce.vertexBuffer,ce.indexBuffer,ce.segments,d.paint,_.transform.zoom,void 0,ve,b.instancedDataArray.length);else{const lt=V?"u_instance":"u_normal_matrix";for(let ft=0;ftV[1]?D:V,L[0]=m.max[0],D=a.aC(a.eG(),L,M),B=D[1]V[1]?D:V,L[1]=m.min[1],D=a.aC(a.eG(),L,M),B=D[1]V[1]?D:V;const Y=a.aA(b[0],0,1),Q=100*d.pixelsPerMeter*a.aA(b[1],0,1),le=a.aA(b[2],0,1),oe=a.eH(a.eG(),B,V,Y),ce=Math.tan(.5*d.fovX),je=-oe[2]*ce;if(Q===0)return oe[1]<-Math.abs(je)?le:1;const ve=(-Math.abs(je)-oe[1])/Q,Le=($e,Ze,qe)=>(1-qe)*$e+qe*Ze,Pe=a.aA(Le(1,le,ve),le,1);return Le(1,Pe,a.aA((d.pitch-20)/20,0,1))}class DP{}class qm{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,m,b){{const le=this._storage.get(m.id);if(le)return le.lastUsedFrameIdx=d,le.buf}const M=b.gl,L=M.getBufferParameter(M.ELEMENT_ARRAY_BUFFER,M.BUFFER_SIZE),D=new ArrayBuffer(L),B=new Int16Array(D);M.getBufferSubData(M.ELEMENT_ARRAY_BUFFER,0,new Int16Array(D));const V=new a.eJ;for(let le=0;le30&&(b.buf.destroy(),this._storage.delete(m))}destroy(){for(const[d,m]of this._storage)m.buf.destroy(),this._storage.delete(d)}}class Fy{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const zy=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class kp{constructor(d){this.revealStart=11,this.revealRange=2}}const p5=a.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class m5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,m){const b=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const D=new a.eK,B=new a.b0;D.emplaceBack(-1,-1),D.emplaceBack(1,-1),D.emplaceBack(1,1),D.emplaceBack(-1,1),B.emplaceBack(0,1,2),B.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(D,p5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const M=a.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,b);const D={u_vignetteShape:(L={vignetteShape:[m.start,m.range,Math.pow(10,m.fadePower)],vignetteColor:[m.color.r,m.color.g,m.color.b,m.color.a*m.strength]}).vignetteShape,u_vignetteColor:L.vignetteColor};b.draw(d,d.context.gl.TRIANGLES,un.disabled,$n.disabled,is.alphaBlended,Bn.disabled,D,"vignette",this.vignetteVx,this.vignetteIdx,M)}var L}}class g5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,m){const b=d.getFreeCameraOptions().position,M=b.toAltitude(),L=b.toLngLat(),D=a.an(L.lng),B=a.an(L.lat),V=d.pixelsPerMeter/m,Y=D*a.eM,Q=a.eM*Math.log(Math.tan(Math.PI/4+B/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const le=-this._offsetYPrev+Q,oe=-this._elevationPrev+M;this._accumulatedOffsetX+=(-this._offsetXPrev+Y)*V,this._accumulatedOffsetY+=le*V,this._accumulatedElevation+=oe*V,this._offsetXPrev=Y,this._offsetYPrev=Q,this._elevationPrev=M}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function sN(_,d){return[-(_[0]-Math.floor(_[0]/d)*d),-(_[1]-Math.floor(_[1]/d)*d),-(_[2]-Math.floor(_[2]/d)*d)]}function cu(_){const d=a.eq(1323123451230),m=[];for(let b=0;b<_;++b){const M=2*d()-1,L=2*d()-1,D=2*d()-1;m.push(a.d5(M,L,D))}return m}function bd(_,d,m,b,M){const L=a.aA((M-m)/(b-m),0,1);return(1-L)*_+L*d}class sx{constructor(d){this._movement=new g5,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new m5,this._ppmScaleFactor=d}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(d,m){const b=d.transform;this._movement.update(b,this._ppmScaleFactor);const M=b.starsProjMatrix,L=a.c7([]);a.c9(L,L,a.an(90)-b._pitch),a.c8(L,L,-b.angle);const D=a.cc(new Float32Array(16),L),B=a.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),V=a.eg([],B),Y=a.aB([],V,D),Q=Date.now()/1e3;return this._accumulatedTimeFromStart+=(Q-this._prevTime)*m,this._prevTime=Q,{projectionMatrix:M,modelviewMatrix:Y}}}class iN extends sx{constructor(d){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new kp("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(d){const m=d.context;if(!this.particlesVx){const b=cu(this.particlesCount),M=new a.eN,L=new a.b0;let D=0;const B=a.eq(1323123451230);for(let V=0;Vb)return;const M=bd(0,1,m.revealStart,m.revealStart+m.revealRange,b);if(!this.particlesVx||!this.particlesIdx)return;const L=structuredClone(this._params);let D=[-L.direction.x,L.direction.y,-100];a.aw(D,D);const B=structuredClone(this._vignetteParams);B.strength*=M,L.overrideStyleParameters||(L.intensity=d.style.rain.state.density,L.timeFactor=d.style.rain.state.intensity,L.color=structuredClone(d.style.rain.state.color),D=structuredClone(d.style.rain.state.direction),L.screenThinning.intensity=d.style.rain.state.centerThinning,L.dropletSizeX=d.style.rain.state.dropletSize[0],L.dropletSizeYScale=d.style.rain.state.dropletSize[1]/d.style.rain.state.dropletSize[0],L.distortionStrength=100*d.style.rain.state.distortionStrength,B.strength=1,B.color=structuredClone(d.style.rain.state.vignetteColor));const V=this.updateOnRender(d,L.timeFactor),Y=d.context,Q=Y.gl,le=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new a.T(Y,{width:d.width,height:d.height,data:null},Q.RGBA8)),L.distortionStrength>0&&(Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE),Q.copyTexSubImage2D(Q.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const oe=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(Y,oe),Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const ce=[L.color.r,L.color.g,L.color.b,L.color.a],je=(ve,Le)=>{const Pe=sN(this._movement.getPosition(),ve),$e=L.dropletSizeX,Ze=L.dropletSizeX*L.dropletSizeYScale,qe=d.width/2,xt=d.height/2,lt=bd(0,L.screenThinning.start,0,1,L.screenThinning.intensity),ft=bd(.001,L.screenThinning.range,0,1,L.screenThinning.intensity),ot=bd(0,L.screenThinning.particleOffset,0,1,L.screenThinning.intensity),st=(bt={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Pe,velocityConeAperture:L.velocityConeAperture,velocity:L.velocity,boxSize:ve,rainDropletSize:[$e,Ze],distortionStrength:L.distortionStrength,rainDirection:D,color:ce,screenSize:[le.width,le.height],thinningCenterPos:[qe,xt],thinningShape:[lt,ft,Math.pow(10,L.screenThinning.fadePower)],thinningAffectedRatio:L.screenThinning.affectedRatio,thinningParticleOffset:ot,shapeDirectionalPower:L.shapeDirPower,shapeNormalPower:L.shapeNormalPower,mode:Le?0:1},{u_modelview:Float32Array.from(bt.modelview),u_projection:Float32Array.from(bt.projection),u_time:bt.time,u_cam_pos:bt.camPos,u_texScreen:0,u_velocityConeAperture:bt.velocityConeAperture,u_velocity:bt.velocity,u_boxSize:bt.boxSize,u_rainDropletSize:bt.rainDropletSize,u_distortionStrength:bt.distortionStrength,u_rainDirection:bt.rainDirection,u_color:bt.color,u_screenSize:bt.screenSize,u_thinningCenterPos:bt.thinningCenterPos,u_thinningShape:bt.thinningShape,u_thinningAffectedRatio:bt.thinningAffectedRatio,u_thinningParticleOffset:bt.thinningParticleOffset,u_shapeDirectionalPower:bt.shapeDirectionalPower,u_shapeNormalPower:bt.shapeNormalPower,u_mode:bt.mode});var bt;const Ot=Math.round(L.intensity*this.particlesCount),Pt=a.bg.simpleSegment(0,0,4*Ot,2*Ot);oe.draw(d,Q.TRIANGLES,un.disabled,$n.disabled,is.alphaBlended,Bn.disabled,st,"rain_particles",this.particlesVx,this.particlesIdx,Pt)};L.distortionStrength>0&&je(L.boxSize,!0),je(L.boxSize,!1),this._vignette.draw(d,B)}}const x5=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class y5 extends sx{constructor(d){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new kp("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(d){const m=d.context;if(!this.particlesVx){const b=cu(this.particlesCount),M=new a.eO,L=new a.b0;let D=0;const B=a.eq(1323123451230);for(let V=0;VD)return;const B=bd(0,1,L.revealStart,L.revealStart+L.revealRange,D);M.strength*=B,m.overrideStyleParameters||(m.intensity=d.style.snow.state.density,m.timeFactor=d.style.snow.state.intensity,m.color=structuredClone(d.style.snow.state.color),b=structuredClone(d.style.snow.state.direction),m.screenThinning.intensity=d.style.snow.state.centerThinning,m.billboardSize=2.79*d.style.snow.state.flakeSize,M.strength=1,M.color=structuredClone(d.style.snow.state.vignetteColor));const V=this.updateOnRender(d,m.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const Y=d.context,Q=Y.gl,le=d.transform,oe=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(Y,oe),((ce,je,ve)=>{const Le=sN(this._movement.getPosition(),ce),Pe=le.width/2,$e=le.height/2,Ze=bd(0,ve.screenThinning.start,0,1,ve.screenThinning.intensity),qe=bd(.001,ve.screenThinning.range,0,1,ve.screenThinning.intensity),xt=bd(0,ve.screenThinning.particleOffset,0,1,ve.screenThinning.intensity),lt=(ft={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Le,velocityConeAperture:ve.velocityConeAperture,velocity:ve.velocity,horizontalOscillationRadius:ve.horizontalOscillationRadius,horizontalOscillationRate:ve.horizontalOscillationRate,boxSize:ce,billboardSize:1*ve.billboardSize,simpleShapeParameters:[ve.shapeFadeStart,ve.shapeFadePower],screenSize:[le.width,le.height],thinningCenterPos:[Pe,$e],thinningShape:[Ze,qe,Math.pow(10,ve.screenThinning.fadePower)],thinningAffectedRatio:ve.screenThinning.affectedRatio,thinningParticleOffset:xt,color:[ve.color.r,ve.color.g,ve.color.b,ve.color.a],direction:b},{u_modelview:Float32Array.from(ft.modelview),u_projection:Float32Array.from(ft.projection),u_time:ft.time,u_cam_pos:ft.camPos,u_velocityConeAperture:ft.velocityConeAperture,u_velocity:ft.velocity,u_horizontalOscillationRadius:ft.horizontalOscillationRadius,u_horizontalOscillationRate:ft.horizontalOscillationRate,u_boxSize:ft.boxSize,u_billboardSize:ft.billboardSize,u_simpleShapeParameters:ft.simpleShapeParameters,u_screenSize:ft.screenSize,u_thinningCenterPos:ft.thinningCenterPos,u_thinningShape:ft.thinningShape,u_thinningAffectedRatio:ft.thinningAffectedRatio,u_thinningParticleOffset:ft.thinningParticleOffset,u_particleColor:ft.color,u_direction:ft.direction});var ft;const ot=Math.round(ve.intensity*this.particlesCount),st=a.bg.simpleSegment(0,0,4*ot,2*ot);this.particlesVx&&this.particlesIdx&&oe.draw(d,Q.TRIANGLES,un.disabled,$n.disabled,is.alphaBlended,Bn.disabled,lt,"snow_particles",this.particlesVx,this.particlesIdx,st)})(m.boxSize,0,m),this._vignette.draw(d,M)}}const Vm={symbol:function(_,d,m,b,M){if(_.renderPass!=="translucent")return;const L=$n.disabled,D=_.colorModeForRenderPass(),B=m.layout.get("text-variable-anchor"),V=m.layout.get("text-size-scale-range"),Y=a.aA(_.scaleFactor,V[0],V[1]);B&&function(oe,ce,je,ve,Le,Pe,$e,Ze){const qe=ce.transform,xt=Le==="map",lt=Pe==="map";for(const ft of oe){const ot=ve.getTile(ft),st=ot.getBucket(je);if(!st||!st.text||!st.text.segments.get().length)continue;const bt=a.bK(st.textSizeData,qe.zoom,Ze),Ot=uf(ft,st.getProjection(),qe),Pt=qe.calculatePixelsToTileUnitsMatrix(ot),Vt=Ic(Ot,ot.tileID.canonical,lt,xt,qe,st.getProjection(),Pt),Ht=st.hasIconTextFit()&&st.hasIconData();bt&&Tn(st,xt,lt,$e,qe,Vt,ft,Math.pow(2,qe.zoom-ot.tileID.overscaledZ),bt,Ht)}}(b,_,m,d,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),M,Y);const Q=m.paint.get("icon-opacity").constantOr(1)!==0,le=m.paint.get("text-opacity").constantOr(1)!==0;m.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(Q||le)?Pv(_,d,m,b,L,D):(Q&&Pv(_,d,m,b,L,D,{onlyIcons:!0}),le&&Pv(_,d,m,b,L,D,{onlyText:!0})),d.map.showCollisionBoxes&&(Qr(_,d,m,b,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),Qr(_,d,m,b,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(_,d,m,b){if(_.renderPass!=="translucent")return;const M=m.paint.get("circle-opacity"),L=m.paint.get("circle-stroke-width"),D=m.paint.get("circle-stroke-opacity"),B=m.layout.get("circle-sort-key").constantOr(1)!==void 0,V=m.paint.get("circle-emissive-strength");if(M.constantOr(1)===0&&(L.constantOr(1)===0||D.constantOr(1)===0))return;const Y=_.context,Q=Y.gl,le=_.transform,oe=!(!_.terrain||!_.terrain.enabled),ce=m.layout.get("circle-elevation-reference"),je=_.depthModeForSublayer(0,un.ReadOnly),ve=new un(_.context.gl.LEQUAL,un.ReadOnly,_.depthRangeFor3D),Le=ce==="none"||oe?je:ve,Pe=$n.disabled,$e=_.colorModeForDrapableLayerRenderPass(V),Ze=le.projection.name==="globe",qe=[a.aF(le.center.lng),a.aJ(le.center.lat)],xt=[];for(let ft=0;ftft.sortKey-ot.sortKey);const lt={useDepthForOcclusion:le.depthOcclusionForSymbolsAndCircles};for(const ft of xt){const{programConfiguration:ot,program:st,layoutVertexBuffer:bt,dynamicBuffers:Ot,indexBuffer:Pt,uniformValues:Vt,tile:Ht}=ft.state,sr=ft.segments;_.terrain&&_.terrain.setupElevationDraw(Ht,st,lt),_.uploadCommonUniforms(Y,st,Ht.tileID.toUnwrapped()),st.draw(_,Q.TRIANGLES,Le,Pe,$e,Bn.disabled,Vt,m.id,bt,Pt,sr,m.paint,le.zoom,ot,Ot)}},heatmap:function(_,d,m,b){if(m.paint.get("heatmap-opacity")!==0)if(_.renderPass==="offscreen"){const M=_.context,L=M.gl,D=$n.disabled,B=new is([L.ONE,L.ONE,L.ONE,L.ONE],a.ao.transparent,[!0,!0,!0,!0]);(function(ce,je,ve,Le){const Pe=ce.gl,$e=je.width*Le,Ze=je.height*Le;ce.activeTexture.set(Pe.TEXTURE1),ce.viewport.set([0,0,$e,Ze]);let qe=ve.heatmapFbo;if(!qe||qe&&(qe.width!==$e||qe.height!==Ze)){qe&&qe.destroy();const xt=Pe.createTexture();Pe.bindTexture(Pe.TEXTURE_2D,xt),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_S,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_T,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MIN_FILTER,Pe.LINEAR),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MAG_FILTER,Pe.LINEAR),qe=ve.heatmapFbo=ce.createFramebuffer($e,Ze,1,null),function(lt,ft,ot,st,bt,Ot){const Pt=lt.gl;Pt.texImage2D(Pt.TEXTURE_2D,0,lt.extRenderToTextureHalfFloat?Pt.RGBA16F:Pt.RGBA,bt,Ot,0,Pt.RGBA,lt.extRenderToTextureHalfFloat?Pt.HALF_FLOAT:Pt.UNSIGNED_BYTE,null),st.colorAttachment0.set(ot)}(ce,0,xt,qe,$e,Ze)}else Pe.bindTexture(Pe.TEXTURE_2D,qe.colorAttachment0.get()),ce.bindFramebuffer.set(qe.framebuffer)})(M,_,m,_.transform.projection.name==="globe"?.5:.25),M.clear({color:a.ao.transparent});const V=_.transform,Y=V.projection.name==="globe",Q=Y?["PROJECTION_GLOBE_VIEW"]:[],le=Y?Bn.frontCCW:Bn.disabled,oe=[a.aF(V.center.lng),a.aJ(V.center.lat)];for(let ce=0;ce({u_image:0,u_color_ramp:1,u_opacity:le.paint.get("heatmap-opacity")}))(0,L),L.id,M.viewportBuffer,M.quadTriangleIndexBuffer,M.viewportSegments,L.paint,M.transform.zoom)}(_,m))},line:function(_,d,m,b){if(_.renderPass!=="translucent")return;const M=m.paint.get("line-opacity"),L=m.paint.get("line-width");if(M.constantOr(1)===0||L.constantOr(1)===0)return;const D=m.paint.get("line-emissive-strength").isConstant(),B=m.paint.get("line-emissive-strength").constantOr(0),V=m.paint.get("line-occlusion-opacity"),Y=m.layout.get("line-elevation-reference"),Q=m.layout.get("line-width-unit")==="meters",le=Y==="sea",oe=!(!_.terrain||!_.terrain.enabled),ce=_.context,je=ce.gl;if(m.hasElevatedBuckets&&_.transform.projection.name==="globe")return;const ve=m.layout.get("line-cross-slope"),Le=ve!==void 0,Pe=ve<1,$e=_.colorModeForDrapableLayerRenderPass(D?B:null),Ze=_.terrain&&_.terrain.renderingToTexture,qe=Ze?1:a.o.devicePixelRatio,xt=m.paint.get("line-dasharray"),lt=xt.constantOr(1),ft=m.layout.get("line-cap"),ot=xt.constantOr(null),st=ft.constantOr(null),bt=m.paint.get("line-pattern"),Ot=bt.constantOr(1),Pt=m.paint.get("line-pattern-cross-fade"),Vt=bt.constantOr(null),Ht=m.paint.get("line-opacity").constantOr(1);let sr=!Ot&&Ht!==1||_.depthOcclusion&&V>0&&V<1;const br=m.paint.get("line-gradient"),zt=Ot?"linePattern":"line",Mt=a.e2(m);let Yt;if(Ze&&_.terrain&&_.terrain.clipOrMaskOverlapStencilType()&&(sr=!1),V!==0&&_.depthOcclusion){const Gr=m.paint._values["line-opacity"];Gr&&Gr.value&&Gr.value.kind==="constant"?Yt=Gr.value:a.w(`Occlusion opacity for layer ${m.id} is supported only when line-opacity isn't data-driven.`)}L.value.kind!=="constant"&&L.value.isLineProgressConstant===!1&&Mt.push("VARIABLE_LINE_WIDTH"),Ze&&(_.emissiveMode!=="dual-source-blending"||D?_.emissiveMode==="mrt-fallback"&&Mt.push("USE_MRT1"):Mt.push("DUAL_SOURCE_BLENDING"));const qt=(Gr,Sr,wr,on,en,$r)=>{for(const Kr of Gr){const Nn=d.getTile(Kr);if(Ot&&!Nn.patternsLoaded())continue;const Yn=Nn.getBucket(m);if(!Yn||Yn.elevationType!=="none"&&!en||Yn.elevationType==="none"&&en)continue;_.prepareDrawTile();const Os=[...Sr],ui=_.shadowRenderer,dn=Yn.elevationType==="road"&&!!ui&&ui.enabled;let ii=[0,0,0];if(dn){const ls=_.style.directionalLight,sa=_.style.ambientLight;ls&&sa&&(ii=yp(_.style,ls,sa)),Os.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Hn=Yn.programConfigurations.get(m.id);let gi=!1;if(Vt&&Nn.imageAtlas){const ls=a.e3.from(Vt),sa=ls.getPrimary().scaleSelf(qe).toString(),eo=Nn.imageAtlas.patternPositions.get(sa),Ea=ls.getSecondary(),qi=Ea?Nn.imageAtlas.patternPositions.get(Ea.scaleSelf(qe).toString()):null;gi=!!eo&&!!qi,eo&&Hn.setConstantPatternPositions(eo,qi)}Pt>0&&(gi||Hn.getPatternTransitionVertexBuffer("line-pattern"))&&Os.push("LINE_PATTERN_TRANSITION");const Li=_.isTileAffectedByFog(Kr),ji=_.getOrCreateProgram(zt,{config:Hn,defines:Os,overrideFog:Li});if(!Ot&&ot&&st&&Nn.lineAtlas){const ls=Nn.lineAtlas.getDash(ot,st);ls&&Hn.setConstantPatternPositions(ls)}dn&&ui.setupShadows(Nn.tileID.toUnwrapped(),ji,"vector-tile");let[ni,as]=m.paint.get("line-trim-offset");(st==="round"||st==="square")&&ni!==as&&(ni===0&&(ni-=1),as===1&&(as+=1));const pi=Ze?Kr.projMatrix:null,Da=Q?1/Yn.tileToMeter/a.ay(Nn,1,_.transform.zoom):1,xa=Q?1/Yn.tileToMeter/a.ay(Nn,1,Math.floor(_.transform.zoom)):1,xi=Ot?a.e4(_,Nn,m,pi,qe,Da,xa,[ni,as],ii,Pt):a.e5(_,Nn,m,pi,Yn.lineClipsArray.length,qe,Da,xa,[ni,as],ii);if(br){const ls=Yn.gradients[m.id];let sa=ls.texture;if(m.gradientVersion!==ls.version){let eo=256;if(m.stepInterpolant){const Ea=d.getSource().maxzoom,qi=Kr.canonical.z===Ea?Math.ceil(1<<_.transform.maxZoom-Kr.canonical.z):1;eo=a.aA(a.e6(Yn.maxLineLength/a.al*1024*qi),256,ce.maxTextureSize)}ls.gradient=a.e7({expression:m.gradientExpression(),evaluationKey:"lineProgress",resolution:eo,image:ls.gradient||void 0,clips:Yn.lineClipsArray}),ls.texture?ls.texture.update(ls.gradient):ls.texture=new a.T(ce,ls.gradient,je.RGBA8),ls.version=m.gradientVersion,sa=ls.texture}ce.activeTexture.set(je.TEXTURE1),sa.bind(m.stepInterpolant?je.NEAREST:je.LINEAR,je.CLAMP_TO_EDGE)}lt&&(ce.activeTexture.set(je.TEXTURE0),Nn.lineAtlasTexture&&Nn.lineAtlasTexture.bind(je.LINEAR,je.REPEAT),Hn.updatePaintBuffers()),Ot&&(ce.activeTexture.set(je.TEXTURE0),Nn.imageAtlasTexture&&Nn.imageAtlasTexture.bind(je.LINEAR,je.CLAMP_TO_EDGE),Hn.updatePaintBuffers()),en&&!le&&_.terrain.setupElevationDraw(Nn,ji),_.uploadCommonUniforms(ce,ji,Kr.toUnwrapped());const Qs=ls=>{Yt!=null&&(Yt.value=Ht*V),ji.draw(_,je.TRIANGLES,wr,ls,$e,Bn.disabled,xi,m.id,Yn.layoutVertexBuffer,Yn.indexBuffer,Yn.segments,m.paint,_.transform.zoom,Hn,[Yn.layoutVertexBuffer2,Yn.patternVertexBuffer,Yn.zOffsetVertexBuffer]),Yt!=null&&(Yt.value=Ht)};if(sr&&!en){const ls=_.stencilModeForClipping(Kr).ref;ls===0&&Ze&&ce.clear({stencil:0});const sa={func:je.EQUAL,mask:255};xi.u_alpha_discard_threshold=.8,Qs(new $n(sa,ls,255,je.KEEP,je.KEEP,je.INVERT)),xi.u_alpha_discard_threshold=0,Qs(new $n(sa,ls,255,je.KEEP,je.KEEP,je.KEEP))}else xi.u_alpha_discard_threshold=sr&&en&&$r?.8:0,Qs(en?on:_.stencilModeForClipping(Kr))}};let ur=_.depthModeForSublayer(0,un.ReadOnly);const Er=new un(_.depthOcclusion?je.GREATER:je.LEQUAL,un.ReadOnly,_.depthRangeFor3D);if(m.hasNonElevatedBuckets){const Gr=!Ze&&_.terrain;V!==0&&Gr?a.w(`Occlusion opacity for layer ${m.id} is supported on terrain only if the layer has line-z-offset enabled.`):Gr?a.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${m.id}.`):qt(b,Mt,ur,$n.disabled,!1,!0)}if(m.hasElevatedBuckets){Y==="hd-road-markup"?oe||(ur=Er,Mt.push("ELEVATED_ROADS")):(Mt.push("ELEVATED"),ur=Er,Le&&Mt.push(Pe?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),le&&Mt.push("ELEVATION_REFERENCE_SEA"));const Gr=sr?_.stencilModeFor3D():$n.disabled;_.forceTerrainMode=!0,qt(b,Mt,ur,Gr,!0,!0),sr&&qt(b,Mt,ur,Gr,!0,!1),_.forceTerrainMode=!1}sr&&(_.resetStencilClippingMasks(),Ze&&ce.clear({stencil:0})),V===0||_.depthOcclusion||Ze||_.layersWithOcclusionOpacity.push(_.currentLayer)},fill:function(_,d,m,b){const M=m.paint.get("fill-color"),L=m.paint.get("fill-opacity");if(L.constantOr(1)===0)return;const D=m.paint.get("fill-emissive-strength"),B=_.colorModeForDrapableLayerRenderPass(D),V=m.paint.get("fill-pattern"),Y=_.opaquePassEnabledForLayer()&&!V.constantOr(1)&&M.constantOr(a.ao.transparent).a===1&&L.constantOr(0)===1?"opaque":"translucent";let Q="none";m.layout.get("fill-elevation-reference")!=="none"?Q="road":m.paint.get("fill-z-offset").constantOr(1)!==0&&(Q="offset");const le=!(!_.terrain||!_.terrain.enabled),oe={painter:_,sourceCache:d,layer:m,coords:b,colorMode:B,elevationType:Q,terrainEnabled:le,pass:Y};if(_.renderPass==="shadow")return void(_.shadowRenderer&&Q==="road"&&!le&&function(je){const{painter:ve,sourceCache:Le,layer:Pe,coords:$e}=je,Ze=ve.context.gl,qe=je.painter.shadowRenderer;for(const xt of $e){const lt=Le.getTile(xt),ft=lt.getBucket(Pe);if(!ft)continue;const ot=ft.elevatedStructures;if(!ot||!ot.shadowCasterSegments||ot.shadowCasterSegments.segments[0].primitiveLength===0)continue;ve.prepareDrawTile();const st=ft.bufferData.programConfigurations.get(Pe.id),bt=ve.isTileAffectedByFog(xt),Ot=ve.getOrCreateProgram("elevatedStructuresDepth",{config:st,overrideFog:bt}),Pt=qe.calculateShadowPassMatrixFromTile(lt.tileID.toUnwrapped());ve.uploadCommonUniforms(ve.context,Ot,xt.toUnwrapped());const Vt={u_matrix:Pt,u_depth_bias:0};Ot.draw(ve,Ze.TRIANGLES,qe.getShadowPassDepthMode(),$n.disabled,qe.getShadowPassColorMode(),Bn.disabled,Vt,Pe.id,ot.vertexBuffer,ot.indexBuffer,ot.shadowCasterSegments,Pe.paint,ve.transform.zoom,st)}}(oe));const ce=_.emissiveMode==="mrt-fallback";if(Q!=="offset"){if(Gk(oe,!1,ce),Q==="road"){const je=!le&&_.renderPass==="translucent";je&&Wk(_,d,m,b,"geometry"),Gk(oe,!0,ce,$n.disabled),je&&function(ve){const{painter:Le,sourceCache:Pe,layer:$e,coords:Ze,colorMode:qe}=ve,xt=Le.context.gl,lt=ve.painter.shadowRenderer,ft=!!lt&<.enabled,ot=new un(Le.context.gl.LEQUAL,un.ReadOnly,Le.depthRangeFor3D);let st=[0,0,0];if(ft){const Ot=Le.style.directionalLight,Pt=Le.style.ambientLight;Ot&&Pt&&(st=yp(Le.style,Ot,Pt))}const bt=Ot=>{for(const Pt of Ze){const Vt=Pe.getTile(Pt),Ht=Vt.getBucket($e);if(!Ht)continue;const sr=Ht.elevatedStructures;if(!sr)continue;let br,zt;if(Ot?(br=sr.renderableBridgeSegments,zt=sr.bridgeProgramConfigurations.get($e.id)):(br=sr.renderableTunnelSegments,zt=sr.tunnelProgramConfigurations.get($e.id)),!br||br.segments[0].primitiveLength===0)continue;zt.updatePaintBuffers(),Le.prepareDrawTile();const Mt=Le.isTileAffectedByFog(Pt),Yt=[];ft&&Yt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const qt=Le.getOrCreateProgram("elevatedStructures",{config:zt,overrideFog:Mt,defines:Yt}),ur=Le.translatePosMatrix(Pt.projMatrix,Vt,$e.paint.get("fill-translate"),$e.paint.get("fill-translate-anchor"));ft&<.setupShadows(Vt.tileID.toUnwrapped(),qt,"vector-tile");const Er=zm(ur,st);Le.uploadCommonUniforms(Le.context,qt,Pt.toUnwrapped()),qt.draw(Le,xt.TRIANGLES,ot,$n.disabled,qe,Bn.backCCW,Er,$e.id,sr.vertexBuffer,sr.indexBuffer,br,$e.paint,Le.transform.zoom,zt,[sr.vertexBufferNormal])}};bt(!0),bt(!1)}(oe)}}else Gk(oe,!1,ce,_.stencilModeFor3D())},"fill-extrusion":function(_,d,m,b){const M=m.paint.get("fill-extrusion-opacity"),L=_.context,D=L.gl,B=_.terrain,V=B&&B.renderingToTexture;if(M===0)return;const Y=_.emissiveMode==="mrt-fallback",Q=_.conflationActive&&_.style.isLayerClipped(m,d.getSource()),le=_.style.order.indexOf(m.fqid);if(Q&&function(oe,ce,je,ve,Le){for(const Pe of ve){const $e=ce.getTile(Pe).getBucket(je);$e&&($e.updateReplacement(Pe,oe.replacementSource,Le),$e.uploadCentroid(oe.context))}}(_,d,m,b,le),B||Q)for(const oe of b){const ce=d.getTile(oe).getBucket(m);ce&&cae(_.context,d,oe,ce,m,B,Q)}if(_.renderPass==="shadow"&&_.shadowRenderer){const oe=_.shadowRenderer;if(B&&M<.65&&m._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof a.ad)return;const ce=oe.getShadowPassDepthMode(),je=oe.getShadowPassColorMode();Kk(_,d,m,b,ce,$n.disabled,je,Q)}else if(_.renderPass==="translucent"){const oe=!m.paint.get("fill-extrusion-pattern").constantOr(1),ce=m.paint.get("fill-extrusion-color").constantOr(a.ao.white);if(!V&&ce.a!==0){const je=new un(_.context.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D);M===1&&oe?Kk(_,d,m,b,je,$n.disabled,is.unblended,Q):(Kk(_,d,m,b,je,$n.disabled,is.disabled,Q),Kk(_,d,m,b,je,_.stencilModeFor3D(),_.colorModeForRenderPass(),Q),_.resetStencilClippingMasks())}if(_.style.enable3dLights()&&oe&&(!B&&_.transform.projection.name!=="globe"||V)){const je=m.paint.get("fill-extrusion-opacity"),ve=m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Le=m.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Pe=m.paint.get("fill-extrusion-flood-light-intensity"),$e=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ze=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor($e?null:m.lut).toArray01().slice(0,3),qe=ve>0&&Le>0,xt=Pe>0,lt=(st,bt,Ot)=>(1-Ot)*st+Ot*bt,ft=new u5;ft.translate=m.paint.get("fill-extrusion-translate"),ft.translateAnchor=m.paint.get("fill-extrusion-translate-anchor"),ft.edgeRadius=m.layout.get("fill-extrusion-edge-radius"),ft.cutoffFadeRange=m.paint.get("fill-extrusion-cutoff-fade-range");const ot=st=>{const bt=_.depthModeForSublayer(1,un.ReadOnly,D.LEQUAL,!0),Ot=m.paint.get(st?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Pt=lt(.1,3,Ot),Vt=_._showOverdrawInspector;if(!Vt){const Ht=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),sr=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!1,!1,!1,!0],D.MIN);bp(ft,_,d,m,b,bt,Ht,sr,Bn.disabled,st,"sdf",je,ve,Le,Pe,Ze,Pt,Q,!1)}{const Ht=Vt?$n.disabled:new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),sr=Vt?_.colorModeForRenderPass():new is([D.ONE_MINUS_DST_ALPHA,D.DST_ALPHA,D.ONE,D.ONE],a.ao.transparent,[!0,!0,!0,!0]);bp(ft,_,d,m,b,bt,Ht,sr,Bn.disabled,st,"color",je,ve,Le,Pe,Ze,Pt,Q,!1)}};if(V){const st=()=>{const Ot=B.drapeBufferSize[0],Pt=B.drapeBufferSize[1];let Vt=B.framebufferCopyTexture;return Vt&&(!Vt||Vt.size[0]===Ot&&Vt.size[1]===Pt)||(Vt&&Vt.destroy(),Vt=B.framebufferCopyTexture=new a.T(L,new a.q({width:Ot,height:Pt}),D.RGBA8)),Vt.bind(D.LINEAR,D.CLAMP_TO_EDGE),D.copyTexSubImage2D(D.TEXTURE_2D,0,0,0,0,0,Ot,Pt),Vt},bt=(Ot,Pt,Vt)=>{const Ht=_.depthModeForSublayer(1,un.ReadOnly,D.LEQUAL,!1),sr=m.paint.get(Ot?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),br=lt(.1,3,sr);{const zt=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!1,!1,!1,!0]);bp(ft,_,d,m,b,Ht,$n.disabled,zt,Bn.disabled,Ot,"clear",je,ve,Le,Pe,Ze,br,Q,Pt)}{const zt=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),Mt=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!1,!1,!1,!0],D.MIN);bp(ft,_,d,m,b,Ht,zt,Mt,Bn.disabled,Ot,"sdf",je,ve,Le,Pe,Ze,br,Q,Pt)}Y&&!Ot&&(Vt=st());{const zt=Ot?D.ZERO:D.ONE_MINUS_DST_ALPHA,Mt=new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),Yt=new is([zt,D.DST_ALPHA,D.ONE_MINUS_DST_ALPHA,D.ZERO],a.ao.transparent,[!0,!0,!0,!0]);bp(ft,_,d,m,b,Ht,Mt,Yt,Bn.disabled,Ot,"color",je,ve,Le,Pe,Ze,br,Q,Pt)}if(!Y||Ot){const zt=new is([D.ONE,D.ONE,D.ONE,Ot?D.ZERO:D.ONE],a.ao.transparent,[!1,!1,!1,!0],Ot?D.FUNC_ADD:D.MAX);bp(ft,_,d,m,b,Ht,$n.disabled,zt,Bn.disabled,Ot,"clear",je,ve,Le,Pe,Ze,br,Q,Pt,Vt)}else{D.drawBuffers([D.NONE,D.COLOR_ATTACHMENT1]);const zt=new $n({func:D.EQUAL,mask:255},254,255,D.KEEP,D.DECR,D.DECR),Mt=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!0,!1,!1,!1],D.MAX);bp(ft,_,d,m,b,Ht,zt,Mt,Bn.disabled,Ot,"emissive",je,ve,Le,Pe,Ze,br,Q,Pt,Vt),D.drawBuffers([D.COLOR_ATTACHMENT0])}};if(qe||xt){let Ot;_.prepareDrawTile(),Y&&!qe||(Ot=st()),qe&&bt(!0,!1,Ot),xt&&bt(!1,!0,Ot)}}else qe&&ot(!0),xt&&ot(!1),(qe||xt)&&_.resetStencilClippingMasks()}}},building:function(_,d,m,b){_.currentLayer<_.firstLightBeamLayer&&(_.firstLightBeamLayer=_.currentLayer);const M=m.paint.get("building-ambient-occlusion-ground-intensity"),L=m.paint.get("building-ambient-occlusion-ground-radius"),D=m.paint.get("building-ambient-occlusion-ground-attenuation"),B=m.paint.get("building-opacity");if(B<=0)return;let V=M>0&&L>0,Y=!0;const Q=m.paint.get("building-vertical-scale");if(Q<=0)return;_.shadowRenderer||(Y=!1);const le=_.conflationActive&&_.style.isLayerClipped(m,d.getSource()),oe=_.style.order.indexOf(m.fqid);if(function(ce,je,ve,Le,Pe,$e){for(const Ze of $e){const qe=je.getTile(Ze).getBucket(ve);qe&&(Pe&&qe.updateReplacement(Ze,ce.replacementSource,Le),qe.uploadUpdatedIndexBuffer(ce.context))}}(_,d,m,oe,le,b),function(ce,je,ve,Le){for(const Pe of Le){const $e=je.getTile(Pe).getBucket(ve);$e&&$e.needsEvaluation()&&$e.uploadUpdatedColorBuffer(ce.context)}}(_,d,m,b),m.resetLayerRenderingStats(_),_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0),_.renderPass==="shadow"&&_.shadowRenderer){const ce=_.shadowRenderer,je=[],ve=ce.getShadowPassDepthMode();Lv({painter:_,source:d,layer:m,coords:b,defines:je,blendMode:ce.getShadowPassColorMode(),depthMode:ve,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(_.renderPass==="translucent"){let ce=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(ce=ce.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),_.shadowRenderer&&_.shadowRenderer.useNormalOffset&&(ce=ce.concat("NORMAL_OFFSET"));const je=m.paint.get("building-facade-emissive-chance"),ve=m.paint.get("building-ambient-occlusion-intensity"),Le=m.paint.get("building-flood-light-intensity"),Pe=m.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",$e=m.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Pe?null:m.lut).toArray01().slice(0,3),Ze=m.paint.get("building-flood-light-ground-attenuation"),qe=Le>0,xt=new un(_.context.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D);B<1&&Lv({painter:_,source:d,layer:m,coords:b,defines:ce,blendMode:is.disabled,depthMode:xt,opacity:B,verticalScale:Q,facadeEmissiveChance:je,facadeAOIntensity:ve,floodLightIntensity:Le,floodLightColor:$e,depthOnly:!0});const lt=_.colorModeForRenderPass();Lv({painter:_,source:d,layer:m,coords:b,defines:ce,blendMode:lt,depthMode:xt,opacity:B,verticalScale:Q,facadeEmissiveChance:je,facadeAOIntensity:ve,floodLightIntensity:Le,floodLightColor:$e}),V&&Zk(_,d,m,b,!0,B,M,L,Le,$e,D,le),qe&&Zk(_,d,m,b,!1,B,M,L,Le,$e,Ze,le)}else if(_.renderPass==="light-beam"){const ce=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],je=new un(_.context.gl.LEQUAL,un.ReadOnly,_.depthRangeFor3D);Lv({painter:_,source:d,layer:m,coords:b,defines:ce,blendMode:is.alphaBlended,depthMode:je,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1),_.resetStencilClippingMasks()},hillshade:function(_,d,m,b){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent"||_.style.disableElevatedTerrain)return;const M=_.context,L=_.terrain&&_.terrain.renderingToTexture,[D,B]=_.renderPass!=="translucent"||L?[{},b]:_.stencilConfigForOverlap(b);for(const V of B){const Y=d.getTile(V);if(Y.needsHillshadePrepare&&_.renderPass==="offscreen")Jie(_,Y,m);else if(_.renderPass==="translucent"){const Q=_.depthModeForSublayer(0,un.ReadOnly),le=m.paint.get("hillshade-emissive-strength"),oe=_.colorModeForDrapableLayerRenderPass(le),ce=L&&_.terrain?_.terrain.stencilModeForRTTOverlap(V):D[V.overscaledZ];Qie(_,V,Y,m,Q,ce,oe)}}M.viewport.set([0,0,_.width,_.height]),_.resetStencilClippingMasks()},raster:function(_,d,m,b,M,L){if(_.renderPass!=="translucent"||m.paint.get("raster-opacity")===0)return;const D=_.transform.projection.name==="globe",B=m.paint.get("raster-elevation")!==0,V=B&&D;if(_.renderElevatedRasterBackface&&!V)return;const Y=_.context,Q=Y.gl,le=d.getSource(),oe=function(lt,ft,ot,st,bt){const Ot=ft.paint.get("raster-color"),Pt=lt.type==="raster-array",Vt=[],Ht=ft.paint.get("raster-resampling"),sr=ft.paint.get("raster-color-mix");let br=ft.paint.get("raster-color-range");const zt=[sr[0],sr[1],sr[2],0],Mt=sr[3];let Yt=Ht==="nearest"?st.NEAREST:st.LINEAR;if(Pt&&(Vt.push("RASTER_ARRAY"),Ot||Vt.push("RASTER_COLOR"),Ht==="linear"&&Vt.push("RASTER_ARRAY_LINEAR"),Yt=st.NEAREST,!br&<.rasterLayers)){const qt=lt.rasterLayers.find(({id:ur})=>ur===ft.sourceLayer);qt&&qt.fields&&qt.fields.range&&(br=qt.fields.range)}if(br=br||[0,1],Ot){Vt.push("RASTER_COLOR"),ot.activeTexture.set(st.TEXTURE2),ft.updateColorRamp(br);let qt=ft.colorRampTexture;qt||(qt=ft.colorRampTexture=new a.T(ot,ft.colorRamp,st.RGBA8)),qt.bind(st.LINEAR,st.CLAMP_TO_EDGE)}return bt&&Vt.push("USE_MRT1"),{mix:zt,range:br,offset:Mt,defines:Vt,resampling:Yt}}(le,m,Y,Q,_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback");if(le instanceof a.aU&&!b.length&&!D)return;const ce=m.paint.get("raster-emissive-strength"),je=_.colorModeForDrapableLayerRenderPass(ce),ve=_.terrain&&_.terrain.renderingToTexture,Le=!_.options.moving,Pe=m.paint.get("raster-resampling")==="nearest"?Q.NEAREST:Q.LINEAR;if(le instanceof a.aU&&!b.length&&(le.onNorthPole||le.onSouthPole)){const lt=B?_.stencilModeFor3D():$n.disabled;return void Ov(!!le.onNorthPole,null,_,d,m,ce,oe,Bn.disabled,lt)}if(!b.length)return;const[$e,Ze]=le instanceof a.aU||ve?[{},b]:_.stencilConfigForOverlap(b),qe=Ze[Ze.length-1].overscaledZ;V&&oe.defines.push("PROJECTION_GLOBE_VIEW"),B&&oe.defines.push("RENDER_CUTOFF");const xt=(lt,ft,ot)=>{for(const st of lt){const bt=st.toUnwrapped(),Ot=d.getTile(st);if(ve&&(!Ot||!Ot.hasData()))continue;Y.activeTexture.set(Q.TEXTURE0);const Pt=jp(Ot,le,m,oe);if(!Pt||!Pt.texture)continue;const{texture:Vt,mix:Ht,offset:sr,tileSize:br,buffer:zt}=Pt;let Mt,Yt;ve?(Mt=un.disabled,Yt=st.projMatrix):B?(Mt=new un(Q.LEQUAL,un.ReadWrite,_.depthRangeFor3D),Yt=D?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(bt,Le)):(Mt=_.depthModeForSublayer(st.overscaledZ-qe,m.paint.get("raster-opacity")===1?un.ReadWrite:un.ReadOnly,Q.LESS),Yt=_.transform.calculateProjMatrix(bt,Le));const qt=_.terrain&&ve?_.terrain.stencilModeForRTTOverlap(st):$e[st.overscaledZ],ur=L?0:m.paint.get("raster-fade-duration");Ot.registerFadeDuration(ur);const Er=d.findLoadedParent(st,0),Gr=Tv(Ot,Er,d,_.transform,ur);let Sr,wr;!Gr.isFading&&Ot.refreshedUponExpiration&&(Ot.refreshedUponExpiration=!1),_.terrain&&_.terrain.prepareDrawTile(),Y.activeTexture.set(Q.TEXTURE0),Vt.bind(Pe,Q.CLAMP_TO_EDGE),Y.activeTexture.set(Q.TEXTURE1),Er?(Er.texture&&Er.texture.bind(Pe,Q.CLAMP_TO_EDGE),Sr=Math.pow(2,Er.tileID.overscaledZ-Ot.tileID.overscaledZ),wr=[Ot.tileID.canonical.x*Sr%1,Ot.tileID.canonical.y*Sr%1]):Vt.bind(Pe,Q.CLAMP_TO_EDGE),"useMipmap"in Vt&&Y.extTextureFilterAnisotropic&&_.transform.pitch>20&&Q.texParameterf(Q.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const on=_.transform;let en;const $r=B?jP(on):[0,0,0,0];let Kr,Nn,Yn,Os,ui,dn=0;if(V&&le instanceof a.aU&&le.coordinates.length>3)Kr=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0)))),Nn=Float32Array.from(on.globeMatrix),Yn=Float32Array.from(a.dF(on)),Os=[a.aF(on.center.lng),a.aJ(on.center.lat)],en=le.elevatedGlobePerspectiveTransform,ui=le.elevatedGlobeGridMatrix||new Float32Array(9);else if(V){const Li=a.dG(st.canonical);dn=a.dH(Li.getCenter().lat),Kr=Float32Array.from(a.bk(a.dJ(st.canonical))),Nn=Float32Array.from(on.globeMatrix),Yn=Float32Array.from(a.dF(on)),Os=[a.aF(on.center.lng),a.aJ(on.center.lat)],en=[0,0],ui=Float32Array.from(a.dI(st.canonical,Li,dn,on.worldSize/on._pixelsPerMercatorPixel))}else en=le instanceof a.aU?le.perspectiveTransform:[0,0],Kr=new Float32Array(16),Nn=new Float32Array(9),Yn=new Float32Array(16),Os=[0,0],ui=new Float32Array(9);const ii=gP(Yt,Kr,Nn,Yn,ui,wr||[0,0],a.aj(_.transform.zoom),Os,$r,Sr||1,Gr,m,en,B?m.paint.get("raster-elevation"):0,2,Ht,sr,oe.range,br,zt,ce),Hn=_.isTileAffectedByFog(st),gi=_.getOrCreateProgram("raster",{defines:oe.defines,overrideFog:Hn});if(_.uploadCommonUniforms(Y,gi,bt),le instanceof a.aU){const Li=le.elevatedGlobeVertexBuffer,ji=le.elevatedGlobeIndexBuffer;if(ve||!D)le.boundsBuffer&&le.boundsSegments&&gi.draw(_,Q.TRIANGLES,Mt,$n.disabled,je,Bn.disabled,ii,m.id,le.boundsBuffer,_.quadTriangleIndexBuffer,le.boundsSegments);else if(Li&&ji){const ni=on.zoom<=a.c_?le.elevatedGlobeSegments:le.getSegmentsForLongitude(on.center.lng);ni&&gi.draw(_,Q.TRIANGLES,Mt,$n.disabled,je,ft,ii,m.id,Li,ji,ni)}}else if(V){Mt=new un(Q.LEQUAL,un.ReadOnly,_.depthRangeFor3D);const Li=_.globeSharedBuffers;if(Li){const[ji,ni,as]=Li.getGridBuffers(dn,!1);gi.draw(_,Q.TRIANGLES,Mt,ot||qt,_.colorModeForRenderPass(),ft,ii,m.id,ji,ni,as)}}else{const{tileBoundsBuffer:Li,tileBoundsIndexBuffer:ji,tileBoundsSegments:ni}=_.getTileBoundsBuffers(Ot);gi.draw(_,Q.TRIANGLES,Mt,qt,je,Bn.disabled,ii,m.id,Li,ji,ni)}}if(!(le instanceof a.aU)&&V)for(const st of lt){const bt=st.canonical.y===(1<>>16,2654435769),((st=Math.imul(st^st>>>16,2654435769))>>>0)/4294967296},ot=1/1.1;for(let st=0;sta.e9[qt](Vt));zt.push(Vt);const Mt=Vt.canonical.x,Yt=Vt.canonical.y;for(const qt of zt){const ur=qe.getTile(bt?qt.wrapped():qt);if(!ur)continue;const Er=ur.rasterParticleState;if(!Er)continue;const Gr=qt.canonical.x+(1<ft.tileID)),ce&&(Y.activeTexture.set(Q.TEXTURE0),_.imageManager.bind(_.context,m.scope));const lt=[];if(_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&<.push("USE_MRT1"),V){const ft=_.getOrCreateProgram(Ze,{overrideFog:!1,overrideRtt:!0,defines:lt}),ot=new Float32Array(a.bA([])),st=new a.aQ(0,0,0,0,0),bt=ce?$m(ot,B,D,_,0,m.scope,je,V,{tileID:st,tileSize:oe}):Ev(ot,B,D,M.toPremultipliedRenderColor(L?null:m.lut));ft.draw(_,Q.TRIANGLES,Pe,Le,$e,Bn.disabled,bt,m.id,_.viewportBuffer,_.quadTriangleIndexBuffer,_.viewportSegments)}else for(const ft of xt){const ot=_.isTileAffectedByFog(ft),st=_.getOrCreateProgram(Ze,{overrideFog:ot,defines:lt}),bt=ft.toUnwrapped(),Ot=b?ft.projMatrix:_.transform.calculateProjMatrix(bt);_.prepareDrawTile();const Pt=d?d.getTile(ft):qe?qe[ft.key]:new fp(ft,oe,le.zoom,_),Vt=ce?$m(Ot,B,D,_,0,m.scope,je,V,{tileID:ft,tileSize:oe}):Ev(Ot,B,D,M.toPremultipliedRenderColor(L?null:m.lut));_.uploadCommonUniforms(Y,st,bt);const{tileBoundsBuffer:Ht,tileBoundsIndexBuffer:sr,tileBoundsSegments:br}=_.getTileBoundsBuffers(Pt);st.draw(_,Q.TRIANGLES,Pe,Le,$e,Bn.disabled,Vt,m.id,Ht,sr,br)}},sky:function(_,d,m){const b=_._atmosphere?a.aj(_.transform.zoom):1,M=m.paint.get("sky-opacity")*b;if(M===0)return;const L=_.context,D=m.paint.get("sky-type"),B=new un(L.gl.LEQUAL,un.ReadOnly,[0,1]),V=_.frameCounter/1e3%1;D==="atmosphere"?_.renderPass==="offscreen"?m.needsSkyboxCapture(_)&&(function(Y,Q,le,oe){const ce=Y.context,je=ce.gl;let ve=Q.skyboxFbo;if(!ve){ve=Q.skyboxFbo=ce.createFramebuffer(32,32,1,null),Q.skyboxGeometry=new Jk(ce),Q.skyboxTexture=ce.gl.createTexture(),je.bindTexture(je.TEXTURE_CUBE_MAP,Q.skyboxTexture),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_MIN_FILTER,je.LINEAR),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_MAG_FILTER,je.LINEAR);for(let Ze=0;Ze<6;++Ze)je.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,je.RGBA,32,32,0,je.RGBA,je.UNSIGNED_BYTE,null)}ce.bindFramebuffer.set(ve.framebuffer),ce.viewport.set([0,0,32,32]);const Le=Q.getCenter(Y,!0),Pe=Y.getOrCreateProgram("skyboxCapture"),$e=new Float64Array(16);a.bA($e),a.en($e,$e,.5*-Math.PI),rx(Y,Q,Pe,$e,Le,0),a.bA($e),a.en($e,$e,.5*Math.PI),rx(Y,Q,Pe,$e,Le,1),a.bA($e),a.cU($e,$e,.5*-Math.PI),rx(Y,Q,Pe,$e,Le,2),a.bA($e),a.cU($e,$e,.5*Math.PI),rx(Y,Q,Pe,$e,Le,3),a.bA($e),rx(Y,Q,Pe,$e,Le,4),a.bA($e),a.en($e,$e,Math.PI),rx(Y,Q,Pe,$e,Le,5),ce.viewport.set([0,0,Y.width,Y.height])}(_,m),m.markSkyboxValid(_)):_.renderPass==="sky"&&function(Y,Q,le,oe,ce){const je=Y.context,ve=je.gl,Le=Y.transform,Pe=Y.getOrCreateProgram("skybox");je.activeTexture.set(ve.TEXTURE0),ve.bindTexture(ve.TEXTURE_CUBE_MAP,Q.skyboxTexture);const $e=((Ze,qe,xt,lt,ft)=>({u_matrix:Ze,u_sun_direction:qe,u_cubemap:0,u_opacity:lt,u_temporal_offset:ft}))(Le.skyboxMatrix,Q.getCenter(Y,!1),0,oe,ce);Y.uploadCommonUniforms(je,Pe),Pe.draw(Y,ve.TRIANGLES,le,$n.disabled,Y.colorModeForRenderPass(),Bn.backCW,$e,"skybox",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,m,B,M,V):D==="gradient"&&_.renderPass==="sky"&&function(Y,Q,le,oe,ce){const je=Y.context,ve=je.gl,Le=Y.transform,Pe=Y.getOrCreateProgram("skyboxGradient");Q.skyboxGeometry||(Q.skyboxGeometry=new Jk(je)),je.activeTexture.set(ve.TEXTURE0);let $e=Q.colorRampTexture;$e||($e=Q.colorRampTexture=new a.T(je,Q.colorRamp,ve.RGBA8)),$e.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const Ze=((qe,xt,lt,ft,ot)=>({u_matrix:qe,u_color_ramp:0,u_center_direction:xt,u_radius:a.an(lt),u_opacity:ft,u_temporal_offset:ot}))(Le.skyboxMatrix,Q.getCenter(Y,!1),Q.paint.get("sky-gradient-radius"),oe,ce);Y.uploadCommonUniforms(je,Pe),Pe.draw(Y,ve.TRIANGLES,le,$n.disabled,Y.colorModeForRenderPass(),Bn.backCW,Ze,"skyboxGradient",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,m,B,M,V)},custom:function(_,d,m,b){const M=_.context,L=m.implementation;if(!_.transform.projection.unsupportedLayers||!_.transform.projection.unsupportedLayers.includes("custom")||_.terrain&&(_.terrain.renderingToTexture||_.renderPass==="offscreen")&&m.isDraped(d)){if(_.renderPass==="offscreen"){const D=L.prerender;if(D){if(_.setCustomLayerDefaults(),M.setColorMode(_.colorModeForRenderPass()),_.transform.projection.name==="globe"){const B=_.transform.pointMerc;D.call(L,M.gl,_.transform.customLayerMatrix(),_.transform.getProjection(),_.transform.globeToMercatorMatrix(),a.aj(_.transform.zoom),[B.x,B.y],_.transform.pixelsPerMeterRatio)}else D.call(L,M.gl,_.transform.customLayerMatrix());M.setDirty(),_.setBaseState()}}else if(_.renderPass==="translucent"){if(_.terrain&&_.terrain.renderingToTexture){const B=L.renderToTile;if(B){const V=b[0].canonical,Y={x:V.x+b[0].wrap*(L.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,Q||(Y.enabled=!0))},oe=d.getSource();if(_.renderPass==="light-beam"&&oe.type!=="batched-model")return;if(oe.type==="vector"||oe.type==="geojson")return function(qe,xt,lt,ft,ot){const st=qe.transform,bt=st.projection.name==="globe",Ot=st.getFreeCameraOptions().position;if(!qe.modelManager)return;const Pt=qe.modelManager;lt.modelManager=Pt;const Vt=qe.shadowRenderer;if(!lt._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Ht=lt._unevaluatedLayout._values["model-id"],sr=Object.assign({},lt.layout.get("model-id").parameters),br=qe.style.order.indexOf(lt.fqid),zt=lt.paint.get("model-opacity").constantOr(1);for(const Mt of ft){const Yt=xt.getTile(Mt).getBucket(lt);if(!Yt||Yt.projection.name!==st.projection.name)continue;const qt=Yt.getModelUris();if(qt&&!Yt.modelsRequested&&(Pt.addModelsFromBucket(qt,ot),Yt.modelsRequested=!0),bt)sr.zoom=Mt.overscaledZ;else{const $r=td(Mt,st);sr.zoom=$r}const ur=Ht.possiblyEvaluate(sr);if(LP(qe,Yt,Mt),yf.shadowUniformsInitialized=!1,yf.useSingleShadowCascade=!!Vt&&Vt.getMaxCascadeForTile(Mt.toUnwrapped())===0,qe.renderPass==="shadow"&&Vt){if(qe.currentShadowCascade===1&&Yt.isInsideFirstShadowMapFrustum)continue;const $r=st.calculatePosMatrix(Mt.toUnwrapped(),st.worldSize);if(yf.tileMatrix.set($r),yf.shadowTileMatrix=Float32Array.from(Vt.calculateShadowPassMatrixFromMatrix($r)),yf.aabb.min=[0,0,0],yf.aabb.max[0]=yf.aabb.max[1]=a.al,yf.aabb.max[2]=0,hae(Yt,yf,qe,lt.scope))continue}const Er=1<0&&qe.style.isLayerClipped(lt,xt.getSource())&&Yt.updateReplacement(Mt,qe.replacementSource,br,lt.scope)&&(Yt.uploaded=!1,Yt.upload(qe.context));let Sr=0;const wr=new Array,on=new Array,en=new Array;for(let $r in Yt.instancesPerModel){const Kr=Yt.instancesPerModel[$r];Kr.features.length>0&&!bt&&($r=ur.evaluate(Kr.features[0].feature,{}));const Nn=Pt.getModel($r,ot);if(Nn||Pt.hasURLBeenRequested($r)||Yt.modelUris.includes($r)||(Yt.modelUris.push($r),Yt.modelsRequested=!1),Nn&&Nn.uploaded)if(bt){const Yn=a.c5([],[Ot.x,Ot.y,Ot.z],qe.transform.worldSize);a.ew(Yn,Yn);for(let Os=0;Os0&&ii.elevationUpdate($r.terrain,Os,dn,Nn.source),ii.needsReEvaluation($r,ui,Nn)&&ii.evaluate(Nn))}})(qe,xt,lt,ft),function(){let $r,Kr,Nn;wr?($r=ft.length-1,Kr=-1,Nn=-1):($r=0,Kr=ft.length,Nn=1);const Yn=new Float64Array(16),Os=a.cA(),ui=new a.P(0,0);for(let dn=$r;dn!==Kr;dn+=Nn){const ii=ft[dn],Hn=xt.getTile(ii).getBucket(lt);if(!Hn||!Hn.uploaded)continue;let gi=!1;Ot&&(gi=Ot.getMaxCascadeForTile(ii.toUnwrapped())===0);const Li=st.calculatePosMatrix(ii.toUnwrapped(),st.worldSize),ji=Hn.modelTraits;!Er&&wr&&(a.bl(Yn,Li),a.af(Os,Vt,Yn),ui.x=Os[0],ui.y=Os[1]);const ni=[];Hn.setFilter(lt.filter);for(const as of Hn.getNodesInfo()){if(as.hiddenByReplacement||!as.node.meshes)continue;const pi=as.node;let Da=0;qe.terrain&&pi.elevation&&(Da=pi.elevation*qe.terrain.exaggeration());const xa=(()=>{const gc=as.aabb;return ur.min=[...gc.min],ur.max=[...gc.max],ur.min[2]+=Da,ur.max[2]+=Da,a.af(ur.min,ur.min,Li),a.af(ur.max,ur.max,Li),ur})(),xi=as.evaluatedScale;if(xi[0]<=1&&xi[1]<=1&&xi[2]<=1&&xa.intersects(Gr)===0)continue;if(!Er&&wr){const gc=.16666666666666666;as.cameraCollisionOpacity=Vt[0]>xa.min[0]&&Vt[0]xa.min[1]&&Vt[1]!wr||as.opacity===1&&pi.opacity===1?as.depthpi.depth?-1:1);for(const as of ni){const pi=as.nodeInfo,Da=pi.node;let xa=a.aB([],zt,as.tileModelMatrix);a.aB(xa,sr,xa);const xi=a.bl([],xa);a.eg(xi,xi),a.cS(xi,xi,Rv),xa=a.aB(xa,xa,Da.globalMatrix);const Qs=qe.renderPass==="light-beam",ls=lt.paint.get("model-color-use-theme").constantOr("default")==="none",sa=ji&a.eI.HasMapboxMeshFeatures,eo=sa?0:pi.evaluatedRMEA[0][2];for(let Ea=0;Ea=ar||Ia>=ar}}const Fl=qi.material;let uu;Fl.occlusionTexture&&Fl.occlusionTexture.offsetScale&&(uu=Fl.occlusionTexture.offsetScale,Uo.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const eh=qe.getOrCreateProgram("model",Uo);!Er&&Ot&&Ot.setupShadowsFromMatrix(as.tileModelMatrix,eh,Ot.useNormalOffset),qe.uploadCommonUniforms(ot,eh,null,xc);const jd=Fl.pbrMetallicRoughness;jd.metallicFactor=.9,jd.roughnessFactor=.5;const Ua=Xg(new Float32Array(ec),new Float32Array(xa),new Float32Array(xi),new Float32Array(Da.globalMatrix),qe,as.opacity,jd.baseColorFactor,Fl.emissiveFactor,jd.metallicFactor,jd.roughnessFactor,Fl,eo,lt,[0,0,0],uu);!rd&&(pi.hasTranslucentParts||as.opacity<1)&&eh.draw(qe,ot.gl.TRIANGLES,Yt,$n.disabled,is.disabled,Bn.backCCW,Ua,lt.id,qi.vertexBuffer,qi.indexBuffer,qi.segments,lt.paint,qe.transform.zoom,void 0,gc),eh.draw(qe,ot.gl.TRIANGLES,rd?qt:Yt,$n.disabled,rd||as.opacity<1||pi.hasTranslucentParts?is.alphaBlended:is.unblended,Bn.backCCW,Ua,lt.id,qi.vertexBuffer,qi.indexBuffer,qi.segments,lt.paint,qe.transform.zoom,void 0,gc)}}}}()}(_,d,m,b),void le();if(oe.type!=="model")return;const ce=oe.getModels(),je=[],ve=_.transform.getFreeCameraOptions().position,Le=a.c5([],[ve.x,ve.y,ve.z],_.transform.worldSize);a.ew(Le,Le);const Pe=[],$e=[];let Ze=0;for(const qe of ce){const xt=d.getFeatureState("",qe.id),lt={type:"Unknown",id:qe.id,properties:qe.featureProperties},ft=m.paint.get("model-rotation").evaluate(lt,xt),ot=m.paint.get("model-scale").evaluate(lt,xt),st=m.paint.get("model-translation").evaluate(lt,xt),bt=m.paint.get("model-opacity").evaluate(lt,xt);EP(m,qe.id,xt,qe.featureProperties,qe.nodeOverrideNames,qe.nodeOverrides),IP(m,qe.id,xt,qe.featureProperties,qe.materialOverrideNames,qe.materialOverrides),qe.nodeOverrides.size>0&&qe.computeBoundsAndApplyParent(),qe.computeModelMatrix(_,ft,ot,st,B,D,!1);const Ot=a.bA([]),Pt=a.ef(qe.position.lat,_.transform.zoom),Vt=a.bq([],[1,1,1/Pt]);a.br(Ot,Ot,Le),je.push({zScaleMatrix:Vt,negCameraPosMatrix:Ot});for(const Ht of qe.nodes)nx(_,Ht,qe.matrix,_.transform.expandedFarZProjMatrix,Ze,Pe,$e,qe.materialOverrides,bt);Ze++}if(Pe.sort((qe,xt)=>xt.depth-qe.depth),_.renderPass!=="shadow")PP(_,m,Pe,$e,je),le();else{for(const qe of $e)Mh(qe.mesh,qe.nodeModelMatrix,_,m);for(const qe of Pe)Mh(qe.mesh,qe.nodeModelMatrix,_,m);le()}}},aN={line:function(_,d,m){if(_.hasElevatedBuckets=!1,_.hasNonElevatedBuckets=!1,_._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||_._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const b=d.getVisibleCoordinates();for(const M of b){const L=d.getTile(M).getBucket(_);if(L&&(L.elevationType!=="none"?_.hasElevatedBuckets=!0:_.hasNonElevatedBuckets=!0,_.hasElevatedBuckets&&_.hasNonElevatedBuckets))break}}}else _.hasNonElevatedBuckets=!0},model:function(_,d,m){const b=d.getSource();if(!b.loaded())return;if(b.type==="vector"||b.type==="geojson")return void(m.modelManager&&m.modelManager.upload(m,Dv(m,_)));if(b.type==="batched-model"||b.type!=="model")return;const M=b.getModels();for(const L of M)L.upload(m.context)},raster:function(_,d,m){const b=d.getSource();if(!(b instanceof sl&&b.loaded()))return;const M=_.sourceLayer||b.rasterLayerIds&&b.rasterLayerIds[0];if(!M)return;const L=_.paint.get("raster-array-band")||b.getInitialBand(M);if(L==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(_.id,L)&&b.prepareTile(B,M,_.id,L)},"raster-particle":function(_,d,m){const b=d.getSource();if(!(b instanceof sl&&b.loaded()))return;const M=_.sourceLayer||b.rasterLayerIds&&b.rasterLayerIds[0];if(!M)return;const L=_.paint.get("raster-particle-array-band")||b.getInitialBand(M);if(L==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(_.id,L)&&b.prepareTile(B,M,_.id,L)}},du={fill:Wk},oN={fill:function(_,d,m,b){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const M=_.context.gl,L=new un(M.LEQUAL,un.ReadOnly,_.depthRangeFor3D),D=new $n({func:M.ALWAYS,mask:255},255,255,M.KEEP,M.KEEP,M.REPLACE),B=_.transform.getFreeCameraOptions().position,V=_.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of b){const Q=d.getTile(Y),le=Q.getBucket(m);if(!le)continue;const oe=le.elevatedStructures;if(!oe||oe.depthSegments.segments[0].primitiveLength===0)continue;const ce=wP(Y.toUnwrapped(),B),je=_.translatePosMatrix(Y.projMatrix,Q,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor")),ve=Yg(je,ce,0,1,0);V.draw(_,M.TRIANGLES,L,D,is.disabled,Bn.disabled,ve,m.id,oe.vertexBuffer,oe.indexBuffer,oe.depthSegments,m.paint,_.transform.zoom)}}};class lN{constructor(d,m,b,M,L){this.context=new Dy(d,m),this.transform=b,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=a.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const D=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const V of D)this._debugParams.enabledLayers[V]=!0;for(const V of D);this.occlusionParams=new Fy,this.setup(),this.numSublayers=Yc.maxUnderzooming+Yc.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new a.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new ky(this),this._wireframeDebugCache=new qm,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const B=new a.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new a.T(this.context,B,d.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=M,this.worldview=L,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,m){const b=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(b||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new r5(this,d));const M=this._terrain;this.transform.elevation=b?M:null,M.update(d,this.transform,m),this.transform.elevation&&!M.enabled&&(this.transform.elevation=null)}_updateFog(d){const m=d.fog;if(!m||this.transform.projection.name==="globe"||m.getOpacity(this.transform.pitch)<1||m.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[b,M]=m.getFovAdjustedRange(this.transform._fov);if(b>M)return void(this.transform.fogCullDistSq=null);const L=b+.78*(M-b);this.transform.fogCullDistSq=L*L}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(d){d&&!this._terrain&&(this._terrain=new r5(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,m){if(this.width=d*a.o.devicePixelRatio,this.height=m*a.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const b of this.style.order)this.style._mergedLayers[b].resize()}setup(){const d=this.context,m=new a.bd;m.emplaceBack(0,0),m.emplaceBack(a.al,0),m.emplaceBack(0,a.al),m.emplaceBack(a.al,a.al),this.tileExtentBuffer=d.createVertexBuffer(m,a.bf.members),this.tileExtentSegments=a.bg.simpleSegment(0,0,4,2);const b=new a.bd;b.emplaceBack(0,0),b.emplaceBack(a.al,0),b.emplaceBack(0,a.al),b.emplaceBack(a.al,a.al),this.debugBuffer=d.createVertexBuffer(b,a.bf.members),this.debugSegments=a.bg.simpleSegment(0,0,4,5);const M=new a.bd;M.emplaceBack(-1,-1),M.emplaceBack(1,-1),M.emplaceBack(-1,1),M.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(M,a.bf.members),this.viewportSegments=a.bg.simpleSegment(0,0,4,2);const L=new a.b1;L.emplaceBack(0,0,0,0),L.emplaceBack(a.al,0,a.al,0),L.emplaceBack(0,a.al,0,a.al),L.emplaceBack(a.al,a.al,a.al,a.al),this.mercatorBoundsBuffer=d.createVertexBuffer(L,a.bi.members),this.mercatorBoundsSegments=a.bg.simpleSegment(0,0,4,2);const D=new a.b0;D.emplaceBack(0,1,2),D.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(D);const B=new a.be;for(const Y of[0,1,3,2,0])B.emplaceBack(Y);this.debugIndexBuffer=d.createIndexBuffer(B),this.emptyTexture=new a.T(d,new a.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=a.bC();const V=this.context.gl;this.stencilClearMode=new $n({func:V.ALWAYS,mask:0},0,255,V.ZERO,V.ZERO,V.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(d){return d._makeTileBoundsBuffers(this.context,this.transform.projection),d._tileBoundsBuffer?{tileBoundsBuffer:d._tileBoundsBuffer,tileBoundsIndexBuffer:d._tileBoundsIndexBuffer,tileBoundsSegments:d._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const d=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,d.TRIANGLES,un.disabled,this.stencilClearMode,is.disabled,Bn.disabled,Mv(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,m,b){if(!m||this.currentStencilSource===m.id||!d.isTileClipped()||!b||b.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const V of b)if(this._tileClippingMaskIDs[V.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=m.id;const M=this.context,L=M.gl;this.nextStencilID+b.length>256&&this.clearStencil(),M.setColorMode(is.disabled),M.setDepthMode(un.disabled);const D=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of b){const V=m.getTile(B),Y=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:Q,tileBoundsIndexBuffer:le,tileBoundsSegments:oe}=this.getTileBoundsBuffers(V);D.draw(this,L.TRIANGLES,un.disabled,new $n({func:L.ALWAYS,mask:0},Y,255,L.KEEP,L.KEEP,L.REPLACE),is.disabled,Bn.disabled,Mv(B.projMatrix),"$clipping",Q,le,oe)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,m=this.context.gl;return new $n({func:m.NOTEQUAL,mask:255},d,255,m.KEEP,m.KEEP,m.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const m=this.context.gl;return new $n({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(d){const m=this.context.gl,b=d.sort((D,B)=>B.overscaledZ-D.overscaledZ),M=b[b.length-1].overscaledZ,L=b[0].overscaledZ-M+1;if(L>1){this.currentStencilSource=void 0,this.nextStencilID+L>256&&this.clearStencil();const D={};for(let B=0;Bthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((d,m)=>d+m/this._fpsHistory.length,0))}render(d,m){const b=a.o.now();this._dt=b-this._timeStamp,this._timeStamp=b,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=m;const M=this.style._mergedLayers,L=!(!this.terrain||!this.terrain.enabled),D=()=>this.style._getOrder(L).filter(zt=>{const Mt=M[zt];return!(Mt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Mt.type]});let B=D(),V=!1,Y=!1,Q=null,le=0,oe=!1;for(const zt of B){const Mt=M[zt];Mt.visibility!=="none"&&(Mt.type==="circle"?V=!0:Mt.type==="building"?(Q=Mt,++le):Mt.type==="symbol"&&(Mt.hasOcclusionOpacityProperties?Y=!0:V=!0))}this.updateEmissiveMode();let ce=B.map(zt=>M[zt]);const je=this.style._mergedSourceCaches;this.imageManager=d.imageManager,this.modelManager=d.modelManager,this.symbolFadeChange=d.placement.symbolFadeChange(a.o.now()),this.imageManager.beginFrame();for(const zt in je){const Mt=je[zt];Mt.used&&(Mt.prepare(this.context),Mt.getSource().usedInConflation&&++le)}let ve=!1;for(const zt of ce)zt.isHidden(this.transform.zoom)||(zt.type==="clip"&&(ve=!0),this.prepareLayer(zt));const Le={},Pe={},$e={},Ze={},qe={};for(const zt in je){const Mt=je[zt];Le[zt]=Mt.getVisibleCoordinates(),Pe[zt]=Le[zt].slice().reverse(),$e[zt]=Mt.getVisibleCoordinates(!0).reverse(),Ze[zt]=Mt.getShadowCasterCoordinates(),qe[zt]=Mt.sortCoordinatesByDistance(Le[zt])}const xt=zt=>{const Mt=this.style.getLayerSourceCache(zt);return Mt&&Mt.used?Mt.getSource():null};if(le||ve||this._clippingActiveLastFrame){const zt=[],Mt=[];let Yt=0;for(const qt of ce)this.isSourceForClippingOrConflation(qt,xt(qt))&&(zt.push(qt),Mt.push(Yt)),Yt++;if(zt&&(ve||zt.length>1)||this._clippingActiveLastFrame){ve=!1;const qt=[];for(let ur=0;ur0){const qt=xt(Mt);qt&&(this.minCutoffZoom=Math.max(qt.minzoom,this.minCutoffZoom)),Mt.minzoom&&(this.minCutoffZoom=Math.max(Mt.minzoom,this.minCutoffZoom))}Mt.is3D(L)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=zt),this._lastOcclusionLayer=zt)}const lt=this.style&&this.style.fog;lt?(this._fogVisible=lt.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=lt.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding($e),this.opaquePassCutoff=0,B=D(),ce=B.map(zt=>M[zt]));const ft=this._shadowRenderer;if(ft){ft.updateShadowParameters(this.transform,this.style.directionalLight);for(const zt in je)for(const Mt of Le[zt]){let Yt={min:0,max:0};this.terrain&&(Yt=this.terrain.getMinMaxForTile(Mt)||Yt),ft.addShadowReceiver(Mt.toUnwrapped(),Yt.min,Yt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new AP(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ot=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),st=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ot&&!this._snow&&(this._snow=new y5(this)),!ot&&this._snow&&(this._snow.destroy(),delete this._snow),st&&!this._rain&&(this._rain=new iN(this)),!st&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),Q){this.buildingTileBorderManager||(this.buildingTileBorderManager=new eN);const zt=this.style.getLayerSourceCache(Q);this.buildingTileBorderManager.updateBorders(zt,Q)}if(!et.has(this.context.gl))return;this.renderPass="offscreen";for(const zt of ce){const Mt=d.getLayerSourceCache(zt);if(!zt.hasOffscreenPass()||zt.isHidden(this.transform.zoom))continue;const Yt=Mt?Pe[Mt.id]:void 0;(zt.type==="custom"||zt.type==="raster"||zt.type==="raster-particle"||zt.isSky()||Yt&&Yt.length)&&this.renderLayer(this,Mt,zt,Yt)}this.depthRangeFor3D=[0,1-(ce.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Ze)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const bt=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Ot=(()=>{if(m.showOverdrawInspector)return a.ao.black;const zt=this.style.fog;if(zt&&this.transform.projection.supportsFog){const Mt=this.style.getLut(zt.scope);if(!bt){const Yt=zt.properties.get("color-use-theme")==="none",qt=zt.properties.get("color").toNonPremultipliedRenderColor(Yt?null:Mt).toArray01();return new a.ao(...qt)}if(bt){const Yt=zt.properties.get("space-color-use-theme")==="none",qt=zt.properties.get("space-color").toNonPremultipliedRenderColor(Yt?null:Mt).toArray01();return new a.ao(...qt)}}return a.ao.transparent})();if(this.context.clear({color:Ot,depth:1}),this.clearStencil(),this._showOverdrawInspector=m.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&bt&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=B.length-1;this.currentLayer>=0;this.currentLayer--){const zt=ce[this.currentLayer],Mt=d.getLayerSourceCache(zt);if(zt.isSky())continue;const Yt=Mt?(zt.is3D(L)?qe:Pe)[Mt.id]:void 0;this._renderTileClippingMasks(zt,Mt,Yt),this.renderLayer(this,Mt,zt,Yt)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&bt&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||a.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer{for(this.currentLayer=0;this.currentLayer0&&zt.hasShadowPass()&&--Vt==0){{this.clearStencil(),this.resetStencilClippingMasks();const Yt=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Yt=this.currentLayer;this.depthOcclusion=!0;for(const qt of this.layersWithOcclusionOpacity){this.currentLayer=qt;const ur=ce[this.currentLayer],Er=d.getLayerSourceCache(ur),Gr=Er?Pe[Er.id]:void 0;this.terrain||this._renderTileClippingMasks(ur,Er,Er?Le[Er.id]:void 0),this.renderLayer(this,Er,ur,Gr)}this.depthOcclusion=!1,this.currentLayer=Yt,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let zt=null;ce.forEach(Mt=>{const Yt=d.getLayerSourceCache(Mt);Yt&&!Mt.isHidden(this.transform.zoom)&&Yt.getVisibleCoordinates().length&&(!zt||zt.getSource().maxzoom0?m.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,m,b){const M=b===void 0?this.terrain&&this.terrain.renderingToTexture:b,L=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(L.push("LIGHTING_3D_MODE"),L.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):M||L.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||L.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(L.push("TERRAIN"),this.linearFloatFilteringSupported()&&L.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&L.push("GLOBE"),!this._fogVisible||M||m!==void 0&&!m||L.push("FOG","FOG_DITHERING"),M&&L.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&L.push("OVERDRAW_INSPECTOR"),L}getOrCreateProgram(d,m){this.cache=this.cache||{};const b=m&&m.defines||[],M=m&&m.config,L=this.currentGlobalDefines(d,m&&m.overrideFog,m&&m.overrideRtt).concat(b),D=cP.cacheKey(q3[d],d,L,M);return this.cache[D]||(this.cache[D]=new cP(this.context,d,q3[d],M,Hk[d],L)),this.cache[D]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(d,m){if(this.style.enable3dLights()){const b=this.style.directionalLight,M=this.style.ambientLight;if(b&&M){const L=((D,B,V)=>{const Y=D.properties.get("direction"),Q=D.properties.get("color-use-theme")==="none",le=D.properties.get("color").toNonPremultipliedRenderColor(Q?null:V.getLut(D.scope)).toArray01(),oe=D.properties.get("intensity"),ce=B.properties.get("color-use-theme")==="none",je=B.properties.get("color").toNonPremultipliedRenderColor(ce?null:V.getLut(B.scope)).toArray01(),ve=B.properties.get("intensity"),Le=[Y.x,Y.y,Y.z],Pe=a.dN(je,ve),$e=a.dN(le,oe);return{u_lighting_ambient_color:Pe,u_lighting_directional_dir:Le,u_lighting_directional_color:$e,u_ground_radiance:Py(Le,$e,Pe)}})(b,M,this.style);m.setLightsUniformValues(d,L)}}}uploadCommonUniforms(d,m,b,M,L){if(this.uploadCommonLightUniforms(d,m),this.terrain&&this.terrain.renderingToTexture)return;const D=this.style.fog;if(D){const B=D.getOpacity(this.transform.pitch),V=((Y,Q,le,oe,ce,je,ve,Le,Pe,$e,Ze,qe)=>{const xt=Y.transform,lt=Q.properties.get("color-use-theme")==="none",ft=Q.properties.get("color").toNonPremultipliedRenderColor(lt?null:Y.style.getLut(Q.scope)).toArray01();ft[3]=oe;const ot=Y.frameCounter/1e3%1,[st,bt]=Q.properties.get("vertical-range");return{u_fog_matrix:le?xt.calculateFogTileMatrix(le):qe||Y.identityMat,u_fog_range:Q.getFovAdjustedRange(xt._fov),u_fog_color:ft,u_fog_horizon_blend:Q.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(st,bt),bt],u_fog_temporal_offset:ot,u_frustum_tl:ce,u_frustum_tr:je,u_frustum_br:ve,u_frustum_bl:Le,u_globe_pos:Pe,u_globe_radius:$e,u_viewport:Ze,u_globe_transition:a.aj(xt.zoom),u_is_globe:+(xt.projection.name==="globe")}})(this,D,b,B,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*a.o.devicePixelRatio,this.transform.height*a.o.devicePixelRatio],M);m.setFogUniformValues(d,V)}L&&m.setCutoffUniformValues(d,L.uniformValues)}setTileLoadedFlag(d){this.tileLoaded=d}saveCanvasCopy(){const d=this.canvasCopy();d&&(this.frameCopies.push(d),this.tileLoaded=!1)}canvasCopy(){const d=this.context.gl,m=d.createTexture();return d.bindTexture(d.TEXTURE_2D,m),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),m}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const d=this.style&&this.style.fog;return!!d&&d.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const d=this._backgroundTiles,m=this._backgroundTiles={},b=this.transform.coveringTiles({tileSize:512});for(const M of b)m[M.key]=d[M.key]||new fp(M,512,this.transform.tileZoom,this,void 0,this.worldview);return m}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,m){return!(!d.is3D(!(!this.terrain||!this.terrain.enabled))||d.type!=="clip"&&d.type!=="building"&&(d.minzoom&&d.minzoom>this.transform.zoom||(this.style._clipLayerPresent||d.sourceLayer!=="building"&&d.sourceLayer!=="procedural_buildings")&&(!m||m.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let m=this._cachedTileFogOpacities[d.key];return m||(this._cachedTileFogOpacities[d.key]=m=this.style.fog.getOpacityForTile(d)),m[0]>=ar||m[1]>=ar}setupDepthForOcclusion(d,m,b){const M=this.context,L=M.gl,D=!!b;var B;b||(b={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),M.activeTexture.set(L.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE),b.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],b.u_depth_range_unpack=[2/((B=this.depthRangeFor3D)[1]-B[0]),-1-2*B[0]/(B[1]-B[0])],b.u_occluder_half_size=.5*this.occlusionParams.occluderSize,b.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE),M.activeTexture.set(L.TEXTURE0),D||m.setTerrainUniformValues(M,b)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function cN(_,d){let m=!1,b=null;const M=()=>{b=null,m&&(_(),b=setTimeout(M,d),m=!1)};return()=>(m=!0,b||M(),b)}class v5{constructor(d){this._hashName=d&&encodeURIComponent(d),a.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=cN(this._updateHashUnthrottled.bind(this),300)}addTo(d){return this._map=d,window.addEventListener("hashchange",this._onHashChange,!1),d.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const d=this._map;if(!d)return"";const m=Bo(d);if(this._hashName){const b=this._hashName;let M=!1;const L=location.hash.slice(1).split("&").map(D=>{const B=D.split("=")[0];return B===b?(M=!0,`${B}=${m}`):D}).filter(D=>D);return M||L.push(`${b}=${m}`),`#${L.join("&")}`}return`#${m}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(b=>b.split("=")).forEach(b=>{b[0]===this._hashName&&(m=b)}),(m&&m[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const m=this._getCurrentHash();if(m.length>=3&&!m.some(b=>isNaN(Number(b)))){const b=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(m[3]||0):d.getBearing();return d.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:b,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Bo(_,d){const m=_.getCenter(),b=Math.round(100*_.getZoom())/100,M=Math.ceil((b*Math.LN2+Math.log(512/360/.5))/Math.LN10),L=Math.pow(10,M),D=Math.round(m.lng*L)/L,B=Math.round(m.lat*L)/L,V=_.getBearing(),Y=_.getPitch();let Q=d?`/${D}/${B}/${b}`:`${b}/${B}/${D}`;return(V||Y)&&(Q+="/"+Math.round(10*V)/10),Y&&(Q+=`/${Math.round(Y)}`),Q}const By={linearity:.3,easing:a.eT(0,0,.3,1)},_5=Object.assign({deceleration:2500,maxSpeed:1400},By),b5=Object.assign({deceleration:20,maxSpeed:1400},By),ix=Object.assign({deceleration:1e3,maxSpeed:360},By),w5=Object.assign({deceleration:1e3,maxSpeed:90},By);class j5{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,m=a.o.now();for(;d.length>0&&m-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const m={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:L}of this._inertiaBuffer)m.zoom+=L.zoomDelta||0,m.bearing+=L.bearingDelta||0,m.pitch+=L.pitchDelta||0,L.panDelta&&m.pan._add(L.panDelta),L.around&&(m.around=L.around),L.pinchAround&&(m.pinchAround=L.pinchAround);const b=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,M={};if(m.pan.mag()){const L=vf(m.pan.mag(),b,Object.assign({},_5,d||{}));M.offset=m.pan.mult(L.amount/m.pan.mag()),M.center=this._map.transform.center,$y(M,L)}if(m.zoom){const L=vf(m.zoom,b,b5);M.zoom=this._map.transform.zoom+L.amount,$y(M,L)}if(m.bearing){const L=vf(m.bearing,b,ix);M.bearing=this._map.transform.bearing+a.aA(L.amount,-179,179),$y(M,L)}if(m.pitch){const L=vf(m.pitch,b,w5);M.pitch=this._map.transform.pitch+L.amount,$y(M,L)}if(M.zoom||M.bearing){const L=m.pinchAround===void 0?m.around:m.pinchAround;M.around=L?this._map.unproject(L):this._map.getCenter()}return this.clear(),M.noMoveStart=!0,M}}function $y(_,d){(!_.duration||_.durationm.unproject(V)),B=L.reduce((V,Y,Q,le)=>V.add(Y.div(le.length)),new a.P(0,0));super(d,{points:L,point:B,lngLats:D,lngLat:m.unproject(B),originalEvent:b}),this._defaultPrevented=!1}}class k5 extends a.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,m){super("wheel",{originalEvent:m}),this._defaultPrevented=!1}}class dN{constructor(d,m){this._map=d,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new k5(this._map,d))}mousedown(d,m){return this._mousedownPos=m,this._firePreventable(new wd(d.type,this._map,d))}mouseup(d){this._map.fire(new wd(d.type,this._map,d))}preclick(d){const m=new MouseEvent("preclick",d);this._map.fire(new wd(m.type,this._map,m))}click(d,m){this._mousedownPos&&this._mousedownPos.dist(m)>=this._clickTolerance||(this.preclick(d),this._map.fire(new wd(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new wd(d.type,this._map,d))}mouseover(d){this._map.fire(new wd(d.type,this._map,d))}mouseout(d){this._map.fire(new wd(d.type,this._map,d))}touchstart(d){return this._firePreventable(new Hm(d.type,this._map,d))}touchmove(d){this._map.fire(new Hm(d.type,this._map,d))}touchend(d){this._map.fire(new Hm(d.type,this._map,d))}touchcancel(d){this._map.fire(new Hm(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class N5{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new wd(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new wd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new wd(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class uN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=m.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,m){this.isEnabled()&&d.shiftKey&&d.button===0&&(z(),this._startPos=this._lastPos=m,this._active=!0)}mousemoveWindow(d,m){if(!this._active)return;const b=m,M=this._startPos,L=this._lastPos;if(!M||!L||L.equals(b)||!this._box&&b.dist(M){this._box&&(this._box.style.transform=`translate(${D}px,${V}px)`,this._box.style.width=B-D+"px",this._box.style.height=Y-V+"px")})}mouseupWindow(d,m){if(!this._active)return;const b=this._startPos,M=m;if(b&&d.button===0){if(this.reset(),H(),b.x!==M.x||b.y!==M.y)return this._map.fire(new a.z("boxzoomend",{originalEvent:d})),{cameraAnimation:L=>L.fitScreenCoordinates(b,M,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",d)}}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),F(),delete this._startPos,delete this._lastPos}_fireEvent(d,m){return this._map.fire(new a.z(d,{originalEvent:m}))}}function hN(_,d){const m={};for(let b=0;b<_.length;b++)m[_[b].identifier]=d[b];return m}class RP{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(d,m,b){(this.centroid||b.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),b.length===this.numTouches&&(this.centroid=function(M){const L=new a.P(0,0);for(const D of M)L._add(D);return L.div(M.length)}(m),this.touches=hN(b,m)))}touchmove(d,m,b){if(this.aborted||!this.centroid)return;const M=hN(b,m);for(const L in this.touches){const D=M[L];(!D||D.dist(this.touches[L])>30)&&(this.aborted=!0)}}touchend(d,m,b){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),b.length===0){const M=!this.aborted&&this.centroid;if(this.reset(),M)return M}}}class fN{constructor(d){this.singleTap=new RP(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,m,b){this.singleTap.touchstart(d,m,b)}touchmove(d,m,b){this.singleTap.touchmove(d,m,b)}touchend(d,m,b){const M=this.singleTap.touchend(d,m,b);if(M){const L=d.timeStamp-this.lastTime<500,D=!this.lastTap||this.lastTap.dist(M)<30;if(L&&D||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=M,this.count===this.numTaps)return this.reset(),M}}}class FP{constructor(){this._zoomIn=new fN({numTouches:1,numTaps:2}),this._zoomOut=new fN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,m,b){this._zoomIn.touchstart(d,m,b),this._zoomOut.touchstart(d,m,b)}touchmove(d,m,b){this._zoomIn.touchmove(d,m,b),this._zoomOut.touchmove(d,m,b)}touchend(d,m,b){const M=this._zoomIn.touchend(d,m,b),L=this._zoomOut.touchend(d,m,b);return M?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()+1,around:D.unproject(M)},{originalEvent:d})}):L?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()-1,around:D.unproject(L)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const zP={0:1,2:2},S5={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class pN{constructor(d){this.reset(),this._clickTolerance=d.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(d,m){return!1}_move(d,m){return{}}mousedown(d,m){if(this._lastPoint)return;const b=re(d);this._correctButton(d,b)&&(this._lastPoint=m,this._eventButton=b)}mousemoveWindow(d,m){const b=this._lastPoint;if(b){if(d.preventDefault(),this._eventButton!=null&&function(M,L){const D=zP[L];return M.buttons===void 0||(M.buttons&D)!==D}(d,this._eventButton))this.reset();else if(this._moved||!(m.dist(b)0&&(this._active=!0);const M=hN(b,m),L=new a.P(0,0),D=new a.P(0,0);let B=0;for(const Y in M){const Q=M[Y],le=this._touches[Y];le&&(L._add(Q),D._add(Q.sub(le)),B++,M[Y]=Q)}if(this._touches=M,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class mN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,m,b){return{}}touchstart(d,m,b){this._firstTwoTouches||b.length<2||(this._firstTwoTouches=[b[0].identifier,b[1].identifier],this._start([m[0],m[1]]))}touchmove(d,m,b){const M=this._firstTwoTouches;if(!M)return;d.preventDefault();const[L,D]=M,B=Fv(b,m,L),V=Fv(b,m,D);if(!B||!V)return;const Y=this._aroundCenter?null:B.add(V).div(2);return this._move([B,V],Y,d)}touchend(d,m,b){if(!this._firstTwoTouches)return;const[M,L]=this._firstTwoTouches,D=Fv(b,m,M),B=Fv(b,m,L);D&&B||(this._active&&H(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Fv(_,d,m){for(let b=0;b<_.length;b++)if(_[b].identifier===m)return d[b]}function UP(_,d){return Math.log2(_/d)}class fae extends mN{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,m){const b=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(UP(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:UP(this._distance,b),pinchAround:m}}}function qP(_,d){return 180*_.angleWith(d)/Math.PI}class Aa extends mN{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,m){const b=this._vector;if(this._vector=d[0].sub(d[1]),b&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:qP(this._vector,b),pinchAround:m}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const m=25/(Math.PI*this._minDiameter)*360,b=this._startVector;if(!b)return!1;const M=qP(d,b);return Math.abs(M)Math.abs(_.x)}class pae extends mN{constructor(d){super(),this._map=d}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(d){this._lastPoints=d,gN(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,m,b){const M=this._lastPoints;if(!M)return;const L=d[0].sub(M[0]),D=d[1].sub(M[1]);return this._map._cooperativeGestures&&!a.eU()&&b.touches.length<3||(this._valid=this.gestureBeginsVertically(L,D,b.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(L.y+D.y)/2*-.5})}gestureBeginsVertically(d,m,b){if(this._valid!==void 0)return this._valid;const M=d.mag()>=2,L=m.mag()>=2;if(!M&&!L)return;if(!M||!L)return this._firstMove==null&&(this._firstMove=b),b-this._firstMove<100&&void 0;const D=d.y>0==m.y>0;return gN(d)&&gN(m)&&D}}const mae={panStep:100,bearingStep:15,pitchStep:10};class gae{constructor(){const d=mae;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let m=0,b=0,M=0,L=0,D=0;switch(d.keyCode){case 61:case 107:case 171:case 187:m=1;break;case 189:case 109:case 173:m=-1;break;case 37:d.shiftKey?b=-1:(d.preventDefault(),L=-1);break;case 39:d.shiftKey?b=1:(d.preventDefault(),L=1);break;case 38:d.shiftKey?M=1:(d.preventDefault(),D=-1);break;case 40:d.shiftKey?M=-1:(d.preventDefault(),D=1);break;default:return}return this._rotationDisabled&&(b=0,M=0),{cameraAnimation:B=>{const V=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:zv,zoom:m?Math.round(V)+m*(d.shiftKey?2:1):V,bearing:B.getBearing()+b*this._bearingStep,pitch:B.getPitch()+M*this._pitchStep,offset:[-L*this._panStep,-D*this._panStep],center:B.getCenter()},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function zv(_){return _*(2-_)}const T5=4.000244140625,A5=1/450;class xN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._handler=m,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=A5,a.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(d){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(d.ctrlKey||d.metaKey||this.isZooming()||a.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let m=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const b=a.o.now(),M=b-(this._lastWheelEventTime||0);this._lastWheelEventTime=b,m!==0&&m%T5==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":M>400?(this._type=null,this._lastValue=m,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(M*m)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,m+=this._lastValue)),d.shiftKey&&m&&(m/=4),this._type&&(this._lastWheelEvent=d,this._delta-=m,this._active||this._start(d)),d.preventDefault()}_onTimeout(d){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)}_start(d){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const m=K(this._el,d);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:m,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const d=this._map.transform;this._type==="wheel"&&d.projection.wrap&&(d._center.lng>=180||d._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const m=()=>d._terrainEnabled()&&this._aroundCoord?d.computeZoomRelativeTo(this._aroundCoord):d.zoom;if(this._delta!==0){const Y=this._type==="wheel"&&Math.abs(this._delta)>T5?this._wheelZoomRate:this._defaultZoomRate;let Q=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&Q!==0&&(Q=1/Q);const le=m(),oe=Math.pow(2,le),ce=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):oe;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(ce*Q))),this._type==="wheel"&&(this._startZoom=le,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const b=typeof this._targetZoom=="number"?this._targetZoom:m(),M=this._startZoom,L=this._easing;let D,B=!1;if(this._type==="wheel"&&M&&L){const Y=Math.min((a.o.now()-this._lastWheelEventTime)/200,1),Q=L(Y);D=a.ak(M,b,Q),Y<1?this._frameId||(this._frameId=!0):B=!0}else D=b,B=!0;this._active=!0,B&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let V=D-m();return V*this._lastDelta<0&&(V=0),{noInertia:!0,needsRenderFrame:!B,zoomDelta:V,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let m=a.eV;if(this._prevEase){const b=this._prevEase,M=(a.o.now()-b.start)/b.duration,L=b.easing(M+.01)-b.easing(M),D=.27/Math.sqrt(L*L+1e-4)*.01,B=Math.sqrt(.0729-D*D);m=a.eT(D,B,.25,1)}return this._prevEase={start:a.o.now(),duration:d,easing:m},m}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=C("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Np{constructor(d,m){this._clickZoom=d,this._tapZoom=m}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class yN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,m){return d.preventDefault(),{cameraAnimation:b=>{b.easeTo({duration:300,zoom:b.getZoom()+(d.shiftKey?-1:1),around:b.unproject(m)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $o{constructor(){this._tap=new fN({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(d,m,b){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?b.length>0&&(this._swipePoint=m[0],this._swipeTouch=b[0].identifier):this._tap.touchstart(d,m,b))}touchmove(d,m,b){if(this._tapTime){if(this._swipePoint){if(b[0].identifier!==this._swipeTouch)return;const M=m[0],L=M.y-this._swipePoint.y;return this._swipePoint=M,d.preventDefault(),this._active=!0,{zoomDelta:L/128}}}else this._tap.touchmove(d,m,b)}touchend(d,m,b){this._tapTime?this._swipePoint&&b.length===0&&this.reset():this._tap.touchend(d,m,b)&&(this._tapTime=d.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _f{constructor(d,m,b){this._el=d,this._mousePan=m,this._touchPan=b}enable(d){this._inertiaOptions=d||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Bv{constructor(d,m,b){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=m,this._mousePitch=b}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class vN{constructor(d,m,b,M){this._el=d,this._touchZoom=m,this._touchRotate=b,this._tapDragZoom=M,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const $v=_=>_.zoom||_.drag||_.pitch||_.rotate;class xae extends a.z{}class Uv{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,m){const b=a.av([],m,d);this.radius=a.ag(b[2]<0?a.eX([],b,this.constants):[b[0],b[1],0])}projectRay(d){a.eX(d,d,this.constants),a.aw(d,d),a.eY(d,d,this.constants);const m=a.c5([],d,this.radius);if(m[2]>0){const b=a.c5([],[0,0,1],a.bJ(m,[0,0,1])),M=a.c5([],a.aw([],[m[0],m[1],0]),this.radius),L=a.d8([],m,a.c5([],a.av([],a.d8([],M,b),m),2));m[0]=L[0],m[1]=L[1]}return m}}function _N(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class yae{constructor(d,m){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new j5(d),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Uv,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),a.aY(["handleEvent","handleWindowEvent"],this);const b=this._el;this._listeners=[[b,"touchstart",{passive:!0}],[b,"touchmove",{passive:!1}],[b,"touchend",void 0],[b,"touchcancel",void 0],[b,"mousedown",void 0],[b,"mousemove",void 0],[b,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[b,"mouseover",void 0],[b,"mouseout",void 0],[b,"dblclick",void 0],[b,"click",void 0],[b,"keydown",{capture:!1}],[b,"keyup",void 0],[b,"wheel",{passive:!1}],[b,"contextmenu",void 0],[window,"blur",void 0]];for(const[M,L,D]of this._listeners){const B=M===document?this.handleWindowEvent:this.handleEvent;M.addEventListener(L,B,D)}}destroy(){for(const[d,m,b]of this._listeners){const M=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(m,M,b)}}_addDefaultHandlers(d){const m=this._map,b=m.getCanvasContainer();this._add("mapEvent",new dN(m,d));const M=m.boxZoom=new uN(m,d);this._add("boxZoom",M);const L=new FP,D=new yN;m.doubleClickZoom=new Np(D,L),this._add("tapZoom",L),this._add("clickZoom",D);const B=new $o;this._add("tapDragZoom",B);const V=m.touchPitch=new pae(m);this._add("touchPitch",V);const Y=new C5(d),Q=new M5(d);m.dragRotate=new Bv(d,Y,Q),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",Q,["mouseRotate"]);const le=new BP(d),oe=new $P(m,d);m.dragPan=new _f(b,le,oe),this._add("mousePan",le),this._add("touchPan",oe,["touchZoom","touchRotate"]);const ce=new Aa,je=new fae;m.touchZoomRotate=new vN(b,je,ce,B),this._add("touchRotate",ce,["touchPan","touchZoom"]),this._add("touchZoom",je,["touchPan","touchRotate"]),this._add("blockableMapEvent",new N5(m));const ve=m.scrollZoom=new xN(m,this);this._add("scrollZoom",ve,["mousePan"]);const Le=m.keyboard=new gae;this._add("keyboard",Le);for(const Pe of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Pe]&&m[Pe].enable(d[Pe])}_add(d,m,b){this._handlers.push({handlerName:d,handler:m,allowed:b}),this._handlersById[d]=m}stop(d){if(!this._updatingCamera){for(const{handler:m}of this._handlers)m.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!$v(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,m,b){for(const M in d)if(M!==b&&(!m||m.indexOf(M)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const m=[];for(const b of d)this._el.contains(b.target)&&m.push(b);return m}handleEvent(d,m){this._updatingCamera=!0;const b=d.type==="renderFrame",M=b?void 0:d,L={needsRenderFrame:!1},D={},B={},V=d.touches?this._getMapTouches(d.touches):void 0,Y=V?Z(this._el,V):b?void 0:K(this._el,d);for(const{handlerName:oe,handler:ce,allowed:je}of this._handlers){if(!ce.isEnabled())continue;let ve;this._blockedByActive(B,je,oe)?ce.reset():ce[m||d.type]&&(ve=ce[m||d.type](d,Y,V),this.mergeHandlerResult(L,D,ve,oe,M),ve&&ve.needsRenderFrame&&this._triggerRenderFrame()),(ve||ce.isActive())&&(B[oe]=ce)}const Q={};for(const oe in this._previousActiveHandlers)B[oe]||(Q[oe]=M);this._previousActiveHandlers=B,(Object.keys(Q).length||_N(L))&&(this._changes.push([L,D,Q]),this._triggerRenderFrame()),(Object.keys(B).length||_N(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:le}=L;le&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],le(this._map))}mergeHandlerResult(d,m,b,M,L){if(!b)return;Object.assign(d,b);const D={handlerName:M,originalEvent:b.originalEvent||L};b.zoomDelta!==void 0&&(m.zoom=D),b.panDelta!==void 0&&(m.drag=D),b.pitchDelta!==void 0&&(m.pitch=D),b.bearingDelta!==void 0&&(m.rotate=D)}_applyChanges(){const d={},m={},b={};for(const[M,L,D]of this._changes)M.panDelta&&(d.panDelta=(d.panDelta||new a.P(0,0))._add(M.panDelta)),M.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+M.zoomDelta),M.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+M.bearingDelta),M.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+M.pitchDelta),M.around!==void 0&&(d.around=M.around),M.aroundCoord!==void 0&&(d.aroundCoord=M.aroundCoord),M.pinchAround!==void 0&&(d.pinchAround=M.pinchAround),M.noInertia&&(d.noInertia=M.noInertia),Object.assign(m,L),Object.assign(b,D);this._updateMapTransform(d,m,b),this._changes=[]}_updateMapTransform(d,m,b){const M=this._map,L=M.transform,D=$e=>[$e.x,$e.y,$e.z];if(($e=>{const Ze=this._eventsInProgress.drag;return Ze&&!this._handlersById[Ze.handlerName].isActive()})()&&!_N(d)){const $e=L.zoom;L.cameraElevationReference="sea",this._originalZoom!=null&&L._orthographicProjectionAtLowPitch&&L.projection.name!=="globe"&&L.pitch===0?(L.cameraElevationReference="ground",L.zoom=this._originalZoom):(L.recenterOnTerrain(),L.cameraElevationReference="ground"),$e!==L.zoom&&this._map._update(!0)}if(L._isCameraConstrained&&M._stop(!0),!_N(d))return void this._fireEvents(m,b,!0);let{panDelta:B,zoomDelta:V,bearingDelta:Y,pitchDelta:Q,around:le,aroundCoord:oe,pinchAround:ce}=d;L._isCameraConstrained&&(V>0&&(V=0),L._isCameraConstrained=!1),ce!==void 0&&(le=ce),(V||($e=>m[$e]&&!this._eventsInProgress[$e])("drag"))&&le&&(this._dragOrigin=D(L.pointCoordinate3D(le)),this._originalZoom=L.zoom,this._trackingEllipsoid.setup(L._camera.position,this._dragOrigin)),L.cameraElevationReference="sea",M._stop(!0),le=le||M.transform.centerPoint,Y&&(L.bearing+=Y),Q&&(L.pitch+=Q),L._updateCameraState();const je=[0,0,0];if(B)if(L.projection.name==="mercator"){const $e=this._trackingEllipsoid.projectRay(L.screenPointToMercatorRay(le).dir),Ze=this._trackingEllipsoid.projectRay(L.screenPointToMercatorRay(le.sub(B)).dir);je[0]=Ze[0]-$e[0],je[1]=Ze[1]-$e[1]}else{const $e=L.pointCoordinate(le);if(L.projection.name==="globe"){B=B.rotate(-L.angle);const Ze=L._pixelsPerMercatorPixel/L.worldSize;je[0]=-B.x*a.eW(a.a$($e.y))*Ze,je[1]=-B.y*a.eW(L.center.lat)*Ze}else{const Ze=L.pointCoordinate(le.sub(B));$e&&Ze&&(je[0]=Ze.x-$e.x,je[1]=Ze.y-$e.y)}}const ve=L.zoom,Le=[0,0,0];if(V){const $e=D(oe||L.pointCoordinate3D(le)),Ze={dir:a.aw([],a.av([],$e,L._camera.position))};if(Ze.dir[2]<0){const qe=L.zoomDeltaToMovement($e,V);a.c5(Le,Ze.dir,qe)}}const Pe=a.d8(je,je,Le);L._translateCameraConstrained(Pe),V&&Math.abs(L.zoom-ve)>1e-4&&L.recenterOnTerrain(),L.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(m,b,!0)}_fireEvents(d,m,b){const M=$v(this._eventsInProgress),L=$v(d),D={};for(const Q in d){const{originalEvent:le}=d[Q];this._eventsInProgress[Q]||(D[`${Q}start`]=le),this._eventsInProgress[Q]=d[Q]}!M&&L&&this._fireEvent("movestart",L.originalEvent);for(const Q in D)this._fireEvent(Q,D[Q]);L&&this._fireEvent("move",L.originalEvent);for(const Q in d){const{originalEvent:le}=d[Q];this._fireEvent(Q,le)}const B={};let V;for(const Q in this._eventsInProgress){const{handlerName:le,originalEvent:oe}=this._eventsInProgress[Q];this._handlersById[le].isActive()||(delete this._eventsInProgress[Q],V=m[le]||oe,B[`${Q}end`]=V)}for(const Q in B)this._fireEvent(Q,B[Q]);const Y=$v(this._eventsInProgress);if(b&&(M||L)&&!Y){this._updatingCamera=!0;const Q=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),le=oe=>oe!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new xae("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const bN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class E5 extends a.E{constructor(d,m){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=m.bearingSnap,this._respectPrefersReducedMotion=m.respectPrefersReducedMotion!==!1,a.aY(["_renderFrameCallback"],this)}getCenter(){return new a.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,m){return this.jumpTo({center:d},m)}panBy(d,m,b){return d=a.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},m),b)}panTo(d,m,b){return this.easeTo(Object.assign({center:d},m),b)}getZoom(){return this.transform.zoom}setZoom(d,m){return this.jumpTo({zoom:d},m),this}zoomTo(d,m,b){return this.easeTo(Object.assign({zoom:d},m),b)}zoomIn(d,m){return this.zoomTo(this.getZoom()+1,d,m),this}zoomOut(d,m){return this.zoomTo(this.getZoom()-1,d,m),this}getBearing(){return this.transform.bearing}setBearing(d,m){return this.jumpTo({bearing:d},m),this}getPadding(){return this.transform.padding}setPadding(d,m){return this.jumpTo({padding:d},m),this}rotateTo(d,m,b){return this.easeTo(Object.assign({bearing:d},m),b)}resetNorth(d,m){return this.rotateTo(0,Object.assign({duration:1e3},d),m),this}resetNorthPitch(d,m){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),m),this}snapToNorth(d,m){return Math.abs(this.getBearing())d.aspect?b/(2*Math.tan(.5*d.fovX)*d.aspect):M/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,m,b,M,L,D){const B=d.clone(),V=this._extendCameraOptions(D);B.bearing=M,B.pitch=L;const Y=a.aT.convert(m),Q=a.aT.convert(b),le=.5*(Y.lat+Q.lat),oe=.5*(Y.lng+Q.lng),ce=a.eZ(le,oe),je=a.aw([],ce),ve=a.aw([],a.bI([],je,[0,1,0])),Le=a.bI([],ve,je),Pe=[ve[0],ve[1],ve[2],0,Le[0],Le[1],Le[2],0,je[0],je[1],je[2],0,0,0,0,1],$e=[ce,a.eZ(Y.lat,Y.lng),a.eZ(Q.lat,Y.lng),a.eZ(Q.lat,Q.lng),a.eZ(Y.lat,Q.lng),a.eZ(le,Y.lng),a.eZ(le,Q.lng),a.eZ(Y.lat,oe),a.eZ(Q.lat,oe)];let Ze=a.d9.fromPoints($e.map(qt=>[a.bJ(ve,qt),a.bJ(Le,qt),a.bJ(je,qt)]));const qe=a.af([],Ze.center,Pe);a.e_(qe)===0&&a.e$(qe,0,0,1),a.aw(qe,qe),a.c5(qe,qe,a.aD),B.center=a.f0(qe);const xt=B.getWorldToCameraMatrix(),lt=a.bl(new Float64Array(16),xt);Ze=a.d9.applyTransform(Ze,a.aB([],xt,Pe));const ft=this._extendAABB(Ze,B,V,M);if(!ft)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ze=ft,a.af(qe,qe,xt);const ot=.5*(Ze.max[2]-Ze.min[2]),st=this._minimumAABBFrustumDistance(B,Ze),bt=a.c5([],[0,0,1],ot),Ot=a.d8(bt,qe,bt),Pt=st+(B.pitch===0?0:a.bG(qe,Ot)),Vt=B.globeCenterInViewSpace,Ht=a.av([],qe,[Vt[0],Vt[1],Vt[2]]);a.aw(Ht,Ht),a.c5(Ht,Ht,Pt);const sr=a.d8([],qe,Ht);a.af(sr,sr,lt);const br=a.eM/a.aD,zt=a.ag(sr),Mt=a.cf(Math.max(zt*br-a.eM,Number.EPSILON),0),Yt=Math.min(B.zoomFromMercatorZAdjusted(Mt),V.maxZoom);return Yt>.5*(a.c_+a.cL)?(B.setProjection({name:"mercator"}),B.zoom=Yt,this._cameraForBounds(B,m,b,M,L,D)):{center:B.center,zoom:Yt,bearing:M,pitch:L}}_extendAABB(d,m,b,M){const L=.5*((b.padding.left||0)+(b.padding.right||0)),D=.5*((b.padding.top||0)+(b.padding.bottom||0)),B=D,V=L,Y=L,Q=D,le=m.width-(V+Y),oe=m.height-(B+Q),ce=a.av([],d.max,d.min),je=Math.min(le/ce[0],oe/ce[1]),ve=Math.min(m.scaleZoom(m.scale*je),b.maxZoom);if(isNaN(ve))return null;const Le=m.scale/m.zoomScale(ve),Pe=new a.d9([d.min[0]-V*Le,d.min[1]-Q*Le,d.min[2]],[d.max[0]+Y*Le,d.max[1]+B*Le,d.max[2]]),$e=(typeof b.offset.x=="number"&&typeof b.offset.y=="number"?new a.P(b.offset.x,b.offset.y):a.P.convert(b.offset)).rotate(-a.an(M));return Pe.center[0]-=$e.x*Le,Pe.center[1]+=$e.y*Le,Pe}queryTerrainElevation(d,m){const b=this.transform.elevation;return b?(m=Object.assign({},{exaggerated:!0},m),b.getAtPoint(a.ae.fromLngLat(d),null,m.exaggerated)):null}_cameraForBounds(d,m,b,M,L,D){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,m,b,M,L,D);const B=d.clone(),V=this._extendCameraOptions(D);B.bearing=M,B.pitch=L;const Y=a.aT.convert(m),Q=a.aT.convert(b),le=new a.aT(Y.lng,Q.lat),oe=new a.aT(Q.lng,Y.lat),ce=B.project(Y),je=B.project(Q),ve=this.queryTerrainElevation(Y),Le=this.queryTerrainElevation(Q),Pe=this.queryTerrainElevation(le),$e=this.queryTerrainElevation(oe),Ze=[[ce.x,ce.y,Math.min(ve||0,Le||0,Pe||0,$e||0)],[je.x,je.y,Math.max(ve||0,Le||0,Pe||0,$e||0)]];let qe=a.d9.fromPoints(Ze);const xt=B.getWorldToCameraMatrix(),lt=a.bl(new Float64Array(16),xt);qe=a.d9.applyTransform(qe,xt);const ft=this._extendAABB(qe,B,V,M);if(!ft)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");qe=ft;const ot=.5*a.av([],qe.max,qe.min)[2],st=this._minimumAABBFrustumDistance(B,qe),bt=[0,0,1,0];a.aC(bt,bt,xt),a.f1(bt,bt);const Ot=a.c5([],bt,st+ot),Pt=a.d8([],qe.center,Ot);a.af(qe.center,qe.center,lt),a.af(Pt,Pt,lt);const Vt=B.unproject(new a.P(qe.center[0],qe.center[1])),Ht=a.f2(B.projection,Vt),sr=Math.pow(2,Ht),br=Math.min(B._zoomFromMercatorZ(Pt[2]*B.pixelsPerMeter*sr/B.worldSize),V.maxZoom);return B.mercatorFromTransition&&br<.5*(a.c_+a.cL)?(B.setProjection({name:"globe"}),B.zoom=br,this._cameraForBounds(B,m,b,M,L,D)):{center:Vt,zoom:br,bearing:M,pitch:L}}fitBounds(d,m,b){const M=this.cameraForBounds(d,m);return this._fitInternal(M,m,b)}fitScreenCoordinates(d,m,b,M,L){const D=a.P.convert(d),B=a.P.convert(m),V=new a.P(Math.min(D.x,B.x),Math.min(D.y,B.y)),Y=new a.P(Math.max(D.x,B.x),Math.max(D.y,B.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(D,B))return this;const Q=this.transform.pointLocation3D(V),le=this.transform.pointLocation3D(Y),oe=this.transform.pointLocation3D(new a.P(V.x,Y.y)),ce=this.transform.pointLocation3D(new a.P(Y.x,V.y)),je=[Math.min(Q.lng,le.lng,oe.lng,ce.lng),Math.min(Q.lat,le.lat,oe.lat,ce.lat)],ve=[Math.max(Q.lng,le.lng,oe.lng,ce.lng),Math.max(Q.lat,le.lat,oe.lat,ce.lat)],Le=M&&M.pitch?M.pitch:this.getPitch(),Pe=this._cameraForBounds(this.transform,je,ve,b,Le,M);return this._fitInternal(Pe,M,L)}_fitInternal(d,m,b){return d?(m=Object.assign(d,m)).linear?this.easeTo(m,b):this.flyTo(m,b):this}jumpTo(d,m){this.stop();const b=d.preloadOnly?this.transform.clone():this.transform;let M=!1,L=!1,D=!1;"zoom"in d&&b.zoom!==+d.zoom&&(M=!0,b.zoom=+d.zoom),d.center!==void 0&&(b.center=a.aT.convert(d.center)),"bearing"in d&&b.bearing!==+d.bearing&&(L=!0,b.bearing=+d.bearing),"pitch"in d&&b.pitch!==+d.pitch&&(D=!0,b.pitch=+d.pitch);const B=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!b.isPaddingEqual(B))if(d.retainPadding===!1){const V=b.clone();V.padding=B,b.setLocationAtPoint(b.center,V.centerPoint)}else b.padding=B;return d.preloadOnly?(this._preloadTiles(b),this):(this.fire(new a.z("movestart",m)).fire(new a.z("move",m)),M&&this.fire(new a.z("zoomstart",m)).fire(new a.z("zoom",m)).fire(new a.z("zoomend",m)),L&&this.fire(new a.z("rotatestart",m)).fire(new a.z("rotate",m)).fire(new a.z("rotateend",m)),D&&this.fire(new a.z("pitchstart",m)).fire(new a.z("pitch",m)).fire(new a.z("pitchend",m)),this.fire(new a.z("moveend",m)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.w(bN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,m){const b=this.transform;if(!b.projection.supportsFreeCamera)return a.w(bN),this;this.stop();const M=b.zoom,L=b.pitch,D=b.bearing;b.setFreeCameraOptions(d);const B=M!==b.zoom,V=L!==b.pitch,Y=D!==b.bearing;return this.fire(new a.z("movestart",m)).fire(new a.z("move",m)),B&&this.fire(new a.z("zoomstart",m)).fire(new a.z("zoom",m)).fire(new a.z("zoomend",m)),Y&&this.fire(new a.z("rotatestart",m)).fire(new a.z("rotate",m)).fire(new a.z("rotateend",m)),V&&this.fire(new a.z("pitchstart",m)).fire(new a.z("pitch",m)).fire(new a.z("pitchend",m)),this.fire(new a.z("moveend",m)),this}easeTo(d,m){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:a.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const b=this.transform,M=this.getZoom(),L=this.getBearing(),D=this.getPitch(),B=this.getPadding(),V="zoom"in d?+d.zoom:M,Y="bearing"in d?this._normalizeBearing(d.bearing,L):L,Q="pitch"in d?+d.pitch:D,le=this._extendPadding(d.padding),oe=a.P.convert(d.offset);let ce,je,ve;if(b.projection.name==="globe"){const bt=a.ae.fromLngLat(b.center),Ot=oe.rotate(-b.angle);bt.x+=Ot.x/b.worldSize,bt.y+=Ot.y/b.worldSize;const Pt=bt.toLngLat(),Vt=a.aT.convert(d.center||Pt);this._normalizeCenter(Vt),ce=b.centerPoint.add(Ot),je=new a.P(bt.x,bt.y).mult(b.worldSize),ve=new a.P(a.aF(Vt.lng),a.aJ(Vt.lat)).mult(b.worldSize).sub(je)}else{ce=b.centerPoint.add(oe);const bt=b.pointLocation(ce),Ot=a.aT.convert(d.center||bt);this._normalizeCenter(Ot),je=b.project(bt),ve=b.project(Ot).sub(je)}const Le=b.zoomScale(V-M);let Pe,$e;d.around&&(Pe=a.aT.convert(d.around),$e=b.locationPoint(Pe));const Ze=this._zooming||V!==M,qe=this._rotating||L!==Y,xt=this._pitching||Q!==D,lt=!b.isPaddingEqual(le),ft=d.retainPadding===!1?b.clone():b,ot=bt=>Ot=>{if(Ze&&(bt.zoom=a.ak(M,V,Ot)),qe&&(bt.bearing=a.ak(L,Y,Ot)),xt&&(bt.pitch=a.ak(D,Q,Ot)),lt&&(ft.interpolatePadding(B,le,Ot),ce=ft.centerPoint.add(oe)),Pe)bt.setLocationAtPoint(Pe,$e);else{const Pt=bt.zoomScale(bt.zoom-M),Vt=V>M?Math.min(2,Le):Math.max(.5,Le),Ht=Math.pow(Vt,1-Ot),sr=bt.unproject(je.add(ve.mult(Ot*Ht)).mult(Pt));bt.setLocationAtPoint(bt.renderWorldCopies?sr.wrap():sr,ce)}return d.preloadOnly||this._fireMoveEvents(m),bt};if(d.preloadOnly){const bt=this._emulate(ot,d.duration,b);return this._preloadTiles(bt),this}const st={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Ze,this._rotating=qe,this._pitching=xt,this._padding=lt,this._easeId=d.easeId,this._prepareEase(m,d.noMoveStart,st),this._ease(ot(b),bt=>{b.cameraElevationReference==="sea"&&b.recenterOnTerrain(),this._afterEase(m,bt)},d),this}_prepareEase(d,m,b={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),m||b.moving||this.fire(new a.z("movestart",d)),this._zooming&&!b.zooming&&this.fire(new a.z("zoomstart",d)),this._rotating&&!b.rotating&&this.fire(new a.z("rotatestart",d)),this._pitching&&!b.pitching&&this.fire(new a.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new a.z("move",d)),this._zooming&&this.fire(new a.z("zoom",d)),this._rotating&&this.fire(new a.z("rotate",d)),this._pitching&&this.fire(new a.z("pitch",d))}_afterEase(d,m){if(this._easeId&&m&&this._easeId===m)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const b=this._zooming,M=this._rotating,L=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,b&&this.fire(new a.z("zoomend",d)),M&&this.fire(new a.z("rotateend",d)),L&&this.fire(new a.z("pitchend",d)),this.fire(new a.z("moveend",d))}flyTo(d,m){if(this._prefersReducedMotion(d)){const qt=a.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(qt,m)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:a.eV},d);const b=this.transform,M=this.getZoom(),L=this.getBearing(),D=this.getPitch(),B=this.getPadding(),V="zoom"in d?a.aA(+d.zoom,b.minZoom,b.maxZoom):M,Y="bearing"in d?this._normalizeBearing(d.bearing,L):L,Q="pitch"in d?+d.pitch:D,le=this._extendPadding(d.padding),oe=b.zoomScale(V-M),ce=a.P.convert(d.offset);let je=b.centerPoint.add(ce);const ve=b.pointLocation(je),Le=a.aT.convert(d.center||ve);this._normalizeCenter(Le);const Pe=b.project(ve),$e=b.project(Le).sub(Pe);let Ze=d.curve;const qe=Math.max(b.width,b.height),xt=qe/oe,lt=$e.mag();if("minZoom"in d){const qt=a.aA(Math.min(d.minZoom,M,V),b.minZoom,b.maxZoom),ur=qe/b.zoomScale(qt-M);Ze=Math.sqrt(ur/lt*2)}const ft=Ze*Ze;function ot(qt){const ur=(xt*xt-qe*qe+(qt?-1:1)*ft*ft*lt*lt)/(2*(qt?xt:qe)*ft*lt);return Math.log(Math.sqrt(ur*ur+1)-ur)}function st(qt){return(Math.exp(qt)-Math.exp(-qt))/2}function bt(qt){return(Math.exp(qt)+Math.exp(-qt))/2}const Ot=ot(0);let Pt=function(qt){return bt(Ot)/bt(Ot+Ze*qt)},Vt=function(qt){return qe*((bt(Ot)*(st(ur=Ot+Ze*qt)/bt(ur))-st(Ot))/ft)/lt;var ur},Ht=(ot(1)-Ot)/Ze;if(Math.abs(lt)<1e-6||!isFinite(Ht)){if(Math.abs(qe-xt)<1e-6)return this.easeTo(d,m);const qt=xtd.maxDuration&&(d.duration=0);const sr=L!==Y,br=Q!==D,zt=!b.isPaddingEqual(le),Mt=d.retainPadding===!1?b.clone():b,Yt=qt=>ur=>{const Er=ur*Ht,Gr=1/Pt(Er);qt.zoom=ur===1?V:M+qt.scaleZoom(Gr),sr&&(qt.bearing=a.ak(L,Y,ur)),br&&(qt.pitch=a.ak(D,Q,ur)),zt&&(Mt.interpolatePadding(B,le,ur),je=Mt.centerPoint.add(ce));const Sr=ur===1?Le:qt.unproject(Pe.add($e.mult(Vt(Er))).mult(Gr));return qt.setLocationAtPoint(qt.renderWorldCopies?Sr.wrap():Sr,je),qt._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(m),qt};if(d.preloadOnly){const qt=this._emulate(Yt,d.duration,b);return this._preloadTiles(qt),this}return this._zooming=!0,this._rotating=sr,this._pitching=br,this._padding=zt,this._prepareEase(m,!1),this._ease(Yt(b),()=>this._afterEase(m),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const b=this._onEaseEnd;this._onEaseEnd=void 0,b.call(this,m)}if(!d){const b=this.handlers;b&&b.stop(!1)}return this}_ease(d,m,b){b.animate===!1||b.duration===0?(d(1),m()):(this._easeStart=a.o.now(),this._easeOptions=b,this._onEaseFrame=d,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((a.o.now()-this._easeStart)/this._easeOptions.duration,1),m=this._onEaseFrame;m&&m(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,m){d=a.bT(d,-180,180);const b=Math.abs(d-m);return Math.abs(d-360-m)180?-360:b<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&a.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,m,b){const M=Math.ceil(15*m/1e3),L=[],D=d(b.clone());for(let B=0;B<=M;B++){const V=D(B/M);L.push(V.clone())}return L}_preloadTiles(d,m){}}class qv{constructor(d={}){this.options=d,a.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const m=this.options&&this.options.compact,b=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=C("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",b);const M=C("span","mapboxgl-ctrl-icon",this._compactButton);return M.setAttribute("aria-hidden","true"),M.setAttribute("title",b),this._innerContainer=C("div","mapboxgl-ctrl-attrib-inner",this._container),m&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),m===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let d=this._editLink;d||(d=this._editLink=this._container.querySelector(".mapbox-improve-map"));const m=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.e.ACCESS_TOKEN}];if(d){const b=m.reduce((M,L,D)=>(L.value&&(M+=`${L.key}=${L.value}${DM.length-L.length),d=d.filter((M,L)=>{for(let D=L+1;D=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const b=d.map(M=>function(L){const D=new DOMParser().parseFromString(L,"text/html");return Array.from(D.body.querySelectorAll("*")).forEach(B=>{const V=B.textContent||"";if(B.tagName!=="A")return void B.replaceWith(D.createTextNode(V));const Y=B.getAttribute("href");if(!Y||!/^(https?:|mailto:)/i.test(Y))return void B.replaceWith(D.createTextNode(V));const Q=D.createElement("a");Q.href=Y,Q.textContent=V,Q.rel="noopener nofollow";const le=B.getAttribute("class");le&&(Q.className=le),B.replaceWith(Q)}),D.body.innerHTML}(M)).join(" | ");b!==this._attribHTML&&(this._attribHTML=b,d.length?(this._innerContainer.innerHTML=b,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Vv{constructor(){a.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=C("div","mapboxgl-ctrl");const m=C("a","mapboxgl-ctrl-logo");return m.target="_blank",m.rel="noopener nofollow",m.href="https://www.mapbox.com/",m.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),m.setAttribute("rel","noopener nofollow"),this._container.appendChild(m),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(d){d&&d.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const d=this._map.style._sourceCaches;if(Object.entries(d).length===0)return!0;for(const m in d){const b=d[m].getSource();if(b.hasOwnProperty("mapbox_logo")&&!b.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<250?m.classList.add("mapboxgl-compact"):m.classList.remove("mapboxgl-compact")}}}class Uy{constructor(){a.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",m=>this._onIndoorUpdate(m)),this._container}_createButton(d,m){const b=C("button",d,this._container);return b.type="button",b.addEventListener("click",m),b}_createSeparator(){return C("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,m){this._map&&(d.setAttribute("aria-label",m),d.textContent=m)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(d){if(!d||!d.floors)return this._model=d,void(this._container.style.display="none");const m=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",m&&Array.from(this._container.children).forEach(b=>b.remove()),d.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(d.floors,d.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const d=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const m=this._map;this._model&&m&&m._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});C("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&d.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(d),this._createSeparator()}_updateBuildingsButtonState(){const d=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");d&&this._model&&(this._model.activeFloorsVisible?d.classList.remove("mapboxgl-ctrl-level-button-selected"):d.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(d,m){for(let b=0;b{this._map._selectIndoorFloor(M.id)});this._setButtonTitle(L,M.zIndex.toString()),this._model&&M.id===this._model.selectedFloorId&&m&&L.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(L),b=this._endTime)return this._end;const m=a.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-m)+this._end*m}isEasing(d){return d>=this._startTime&&d<=this._endTime}jumpTo(d){this._startTime=-1/0,this._endTime=-1/0,this._start=d,this._end=d}easeTo(d,m,b){this._start=this.getValue(m),this._end=d,this._startTime=m,this._endTime=m+b}}const Mp={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Wm extends a.z{constructor(d,m,b,M){const{point:L,lngLat:D,originalEvent:B,target:V}=d;super(d.type,{point:L,lngLat:D,originalEvent:B,target:V}),this.preventDefault=()=>{d.preventDefault()},this.id=m,this.interaction=b,this.feature=M}}class Th{constructor(d){this.map=d,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(d,m){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const b=m.filter;let M=m.type;b&&this.filters.set(d,a.b6(b)),M==="mouseover"&&(M="mouseenter"),M==="mouseout"&&(M="mouseleave");const L=this.interactionsByType.get(M)||new Map;M==="mouseenter"||M==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(d,m)):L.size===0&&this.map.on(M,this.handleType),L.size===0&&this.interactionsByType.set(M,L),L.set(d,m),this.typeById.set(d,M)}get(d){const m=this.typeById.get(d);if(!m)return;const b=this.interactionsByType.get(m);return b?b.get(d):void 0}remove(d){const m=this.typeById.get(d);if(!m)return;this.typeById.delete(d),this.filters.delete(d);const b=this.interactionsByType.get(m);b&&(b.delete(d),m==="mouseenter"||m==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):b.size===0&&this.map.off(m,this.handleType))}queryTargets(d,m){const b=[];for(const[M,L]of m)L.target&&b.push({targetId:M,target:L.target,filter:this.filters.get(M)});return this.map.style.queryRenderedTargets(d,b,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const m=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());m.length&&(d.type="mouseenter",this.handleType(d,m));const b=new Map;for(const[M,{feature:L}]of this.prevHoveredFeatures)this.hoveredFeatures.has(M)||b.set(L.id,L);b.size&&(d.type="mouseleave",this.handleType(d,Array.from(b.values())))}handleOut(d){const m=Array.from(this.hoveredFeatures.values()).map(({feature:b})=>b);m.length&&(d.type="mouseleave",this.handleType(d,m)),this.hoveredFeatures.clear()}handleType(d,m){const b=d.type==="mouseenter";if(b&&!this.interactionsByType.has(d.type))return void a.w("mouseenter interaction required for mouseleave to work.");const M=Array.from(this.interactionsByType.get(d.type)).reverse(),L=!!m;m=m||this.queryTargets(d.point,M);let D=!1;const B=new Set;for(const V of m){for(const[Y,Q]of M){if(!Q.target)continue;const le=V.variants?V.variants[Y]:null;if(le){for(const oe of le){if(Uu(oe,V,B,Y))continue;const ce=new a.dx(V,oe),je=df(oe,V,Y);L&&ce.id!==void 0&&(ce.state=this.map.getFeatureState(ce));const ve=b?this.prevHoveredFeatures.get(je):null,Le=new Wm(d,Y,Q,ce),Pe=ve?ve.stop:Q.handler(Le);if(b&&this.hoveredFeatures.set(je,{feature:V,stop:Pe}),Pe!==!1){D=!0;break}}if(D)break}}if(D)break}if(!D)for(const[V,Y]of M){const{handler:Q,target:le}=Y;if(!le&&Q(new Wm(d,V,Y,null))!==!1)break}}}function vae(_,d){if(Array.isArray(_)&&Array.isArray(d)){const m=new Set(_),b=new Set(d);return m.size===b.size&&_.every(M=>b.has(M))}return a.by(_,d)}const _ae={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},bae={showCompass:!0,showZoom:!0,visualizePitch:!1};class wae{constructor(d,m,b=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new C5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,b&&(this.mousePitch=new M5({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),a.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),m.addEventListener("mousedown",this.mousedown),m.addEventListener("touchstart",this.touchstart,{passive:!1}),m.addEventListener("touchmove",this.touchmove),m.addEventListener("touchend",this.touchend),m.addEventListener("touchcancel",this.reset)}down(d,m){this.mouseRotate.mousedown(d,m),this.mousePitch&&this.mousePitch.mousedown(d,m),z()}move(d,m){const b=this.map,M=this.mouseRotate.mousemoveWindow(d,m),L=M&&M.bearingDelta;if(L&&b.setBearing(b.getBearing()+L),this.mousePitch){const D=this.mousePitch.mousemoveWindow(d,m),B=D&&D.pitchDelta;B&&b.setPitch(b.getPitch()+B)}}off(){const d=this.element;d.removeEventListener("mousedown",this.mousedown),d.removeEventListener("touchstart",this.touchstart),d.removeEventListener("touchmove",this.touchmove),d.removeEventListener("touchend",this.touchend),d.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){F(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(d){this.down(Object.assign({},d,{ctrlKey:!0,preventDefault:()=>d.preventDefault()}),K(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,K(this.element,d))}mouseup(d){this.mouseRotate.mouseupWindow(d),this.mousePitch&&this.mousePitch.mouseupWindow(d),this.offTemp()}touchstart(d){d.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Z(this.element,d.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>d.preventDefault()},this._startPos))}touchmove(d){d.targetTouches.length!==1?this.reset():(this._lastPos=Z(this.element,d.targetTouches)[0],this.move({preventDefault:()=>d.preventDefault()},this._lastPos))}touchend(d){d.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)m.width||d.y>m.height;m.locationPoint3D(b).distSqr(d)180;){const b=m.locationPoint3D(_);if(b.x>=0&&b.y>=0&&b.x<=m.width&&b.y<=m.height)break;_.lng>m.center.lng?_.lng-=360:_.lng+=360}return _}const mc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},Xu={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class wN extends a.E{constructor(d,m){super(),(d instanceof HTMLElement||m)&&(d=Object.assign({element:d},m)),a.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:b="center",color:M="#3FB1CE",scale:L=1,draggable:D=!1,clickTolerance:B=0,rotation:V=Xu.rotation,rotationAlignment:Y=Xu.rotationAlignment,pitchAlignment:Q=Xu.pitchAlignment,occludedOpacity:le=Xu.occludedOpacity,altitude:oe=Xu.altitude}=d||{};this._anchor=b,this._color=M,this._scale=L,this._draggable=D,this._clickTolerance=B,this._rotation=V,this._rotationAlignment=Y,this._pitchAlignment=Q,this._occludedOpacity=le,this._altitude=oe,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),d&&d.element?(this._element=d.element,this._offset=a.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=a.P.convert(d&&d.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",ve=>{ve.preventDefault()}),this._element.addEventListener("mousedown",ve=>{ve.preventDefault()});const ce=this._element.classList;for(const ve in mc)ce.remove(`mapboxgl-marker-anchor-${ve}`);ce.add(`mapboxgl-marker-anchor-${this._anchor}`);const je=d&&d.className?d.className.trim().split(/\s+/):[];ce.add(...je),this._popup=null}_createDefaultMarker(){const d=C("div"),m=A("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const b=A("radialGradient",{id:"shadowGradient"},A("defs",{},m));A("stop",{offset:"10%","stop-opacity":.4},b),A("stop",{offset:"100%","stop-opacity":.05},b),A("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},m)}return A("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},m),A("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},m),A("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},m),d}addTo(d){return d===this._map||(this.remove(),this._map=d,d.getCanvasContainer().appendChild(this._element),d.on("move",this._updateMoving),d.on("moveend",this._update),d.on("remove",this._clearFadeTimer),d._addMarker(this),this.setDraggable(this._draggable),this._update(),d.on("click",this._onMapClick)),this}remove(){const d=this._map;return d&&(d.off("click",this._onMapClick),d.off("move",this._updateMoving),d.off("moveend",this._update),d.off("mousedown",this._addDragHandler),d.off("touchstart",this._addDragHandler),d.off("mouseup",this._onUp),d.off("touchend",this._onUp),d.off("mousemove",this._onMove),d.off("touchmove",this._onMove),d.off("remove",this._clearFadeTimer),d._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=a.aT.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(d){return d===this._altitude||(this._defaultMarker&&(this._altitude===0&&d!==0||this._altitude!==0&&d===0)&&(this._element=this._createDefaultMarker()),this._altitude=d||Xu.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const M=Math.sqrt(Math.pow(13.5,2)/2);d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[M,-1*(38.1-13.5+M)],"bottom-right":[-M,-1*(38.1-13.5+M)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=d,d._marker=this,d._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(d){const m=d.code,b=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&b!==32&&b!==13||this.togglePopup()}_onMapClick(d){const m=d.originalEvent.target,b=this._element;this._popup&&(m===b||b.contains(m))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const d=this._popup;return d?(d.isOpen()?(d.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(d.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const d=this._map,m=this._pos;if(!d||!m)return!1;const b=d.unproject(m,this._altitude),M=d.getFreeCameraOptions();if(!M.position)return!1;const L=M.position.toLngLat();return L.distanceTo(b)<.9*L.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const m=this._pos;if(!m||m.x<0||m.x>d.transform.width||m.y<0||m.y>d.transform.height)return void this._clearFadeTimer();const b=d.unproject(m,this._altitude);let M;d._showingGlobe()&&a.f5(d.transform,this._lngLat)?M=0:(M=1-d._queryFogOpacity(b),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(M*=this._occludedOpacity)),this._element.style.opacity=`${M}`,this._element.style.pointerEvents=M>0?"auto":"none",this._popup&&this._popup._setOpacity(M),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const d=this._pos;if(!d||!this._map)return;const m=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${mc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${m.x}px,${m.y}px) `}_calculateXYTransform(){const d=this._pos,m=this._map,b=this.getPitchAlignment();if(!m||!d||b!=="map")return"";if(!m._showingGlobe()){const V=m.getPitch();return V?`rotateX(${V}deg)`:""}const M=a.cX(a.f6(m.transform,this._lngLat)),L=d.sub(a.f7(m.transform)),D=Math.abs(L.x)+Math.abs(L.y);if(D===0)return"";const B=M/D;return`rotateX(${-L.y*B}deg) rotateY(${L.x*B}deg)`}_calculateZTransform(){const d=this._pos,m=this._map;if(!m||!d)return"";let b=0;const M=this.getRotationAlignment();if(M==="map")if(m._showingGlobe()){const L=m.project(new a.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),D=m.project(new a.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(L);b=a.cX(Math.atan2(D.y,D.x))-90}else b=-m.getBearing();else if(M==="horizon"){const L=a.ah(4,6,m.getZoom()),D=a.f7(m.transform);D.y+=L*m.transform.height;const B=d.sub(D),V=a.cX(Math.atan2(B.y,B.x));b=(V>90?V-270:V+90)*(1-L)}return b+=this._rotation,b?`rotateZ(${b}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=I5(this._lngLat,this._pos,m.transform)),this._pos=m.project(this._lngLat,this._altitude),d===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),m._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(m._showingGlobe()||m.getTerrain()||m.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=a.P.convert(d),this._update(),this}addClassName(d){return this._element.classList.add(d),this}removeClassName(d){return this._element.classList.remove(d),this}toggleClassName(d){return this._element.classList.toggle(d)}_onMove(d){const m=this._map;if(!m)return;const b=this._pointerdownPos,M=this._positionDelta;if(b&&M){if(!this._isDragging){const L=this._clickTolerance||m._clickTolerance;if(d.point.dist(b)_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(_.antialias&&a.f3(window)&&(_.antialias=!1,a.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new D3(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies,null,null),_),this._repaint=!!_.repaint,this._interactive=_.interactive,this._minTileCacheSize=_.minTileCacheSize,this._maxTileCacheSize=_.maxTileCacheSize,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=_.crossSourceCollisions,this._collectResourceTiming=_.collectResourceTiming,this._language=this._parseLanguage(_.language),this._worldview=_.worldview,this._renderTaskQueue=new Sp,this._domRenderTaskQueue=new Sp,this._controls=[],this._markers=[],this._popups=[],this._mapId=a.b2(),this._locale=Object.assign({},Mp,_.locale),this._clickTolerance=_.clickTolerance,this._cooperativeGestures=_.cooperativeGestures,this._performanceMetricsCollection=_.performanceMetricsCollection,this._tessellationStep=_.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=_.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Cp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=_.scaleFactor,this._requestManager=new ne(_.transformRequest,_.accessToken,_.testMode),this._silenceAuthErrors=!!_.testMode,this._contextCreateOptions=_.contextCreateOptions?Object.assign({},_.contextCreateOptions):{},typeof _.container=="string"){const m=document.getElementById(_.container);if(!m)throw new Error(`Container '${_.container.toString()}' not found.`);this._container=m}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(this._container.childNodes.length>0&&a.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),_.maxBounds&&this.setMaxBounds(_.maxBounds),this._spriteFormat=_.spriteFormat,a.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new yae(this,_),this._localFontFamily=_.localFontFamily,this._localIdeographFontFamily=_.localIdeographFontFamily,(_.style||!_.testMode)&&this.setStyle(_.style||a.e.DEFAULT_STYLE,{config:_.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),_.projection&&this.setProjection(_.projection),_.hash&&(this._hash=new v5(typeof _.hash=="string"&&_.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch});const m=_.bounds;m&&(this.resize(),this.fitBounds(m,Object.assign({},_.fitBoundsOptions,{duration:0})))}this.resize(),_.attributionControl&&this.addControl(new qv({customAttribution:_.customAttribution})),this._logoControl=new Vv,this.addControl(this._logoControl,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",m=>{this._update(m.dataType==="style"),this.fire(new a.z(`${m.dataType}data`,m))}),this.on("dataloading",m=>{this.fire(new a.z(`${m.dataType}dataloading`,m))}),this._interactions=new Th(this)}_getMapId(){return this._mapId}addControl(_,d){if(d===void 0&&(d=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new a.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const m=_.onAdd(this);this._controls.push(_);const b=this._controlPositions[d];return d.indexOf("bottom")!==-1?b.insertBefore(m,b.firstChild):b.appendChild(m),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new a.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(_);return d>-1&&this._controls.splice(d,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(_){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const d=!this._moving;return d&&this.fire(new a.z("movestart",_)).fire(new a.z("move",_)),this.fire(new a.z("resize",_)),d&&this.fire(new a.z("moveend",_)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(_){return this.transform.setMaxBounds(a.aI.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(_){return this._scaleFactor=_,this.painter.scaleFactor=_,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(_){return _==="auto"?navigator.language:Array.isArray(_)?_.length===0?void 0:_.map(d=>d==="auto"?navigator.language:d):_}setLanguage(_){const d=this._parseLanguage(_);if(!this.style||d===this._language)return this;this._language=d,this.style.reloadSources();for(const m of this._controls)m._setLanguage&&m._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(_){return this.style&&_!==this._worldview?(this._worldview=_,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(_){return this._lazyInitEmptyStyle(),_?typeof _=="string"&&(_={name:_}):_=null,this._useExplicitProjection=!!_,this._prioritizeAndUpdateProjection(_,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const _=this.transform,d=_.projection.name;let m;d==="globe"&&_.zoom>=a.cL?(_.setMercatorFromTransition(),m=!0):d==="mercator"&&_.zoom=a.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(_),this.style.applyProjectionUpdate();const b=this.transform.getProjection().name==="mercator"&&m!==this.transform.mercatorFromTransition;return(d||b)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(_,d){return this.transform.locationPoint3D(a.aT.convert(_),d)}unproject(_,d){return this.transform.pointLocation3D(a.P.convert(_),d)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(_,d,m){const b=M=>{let L=[];if(Array.isArray(d)){const D=d.filter(B=>this.getLayer(B));L=D.length?this.queryRenderedFeatures(M,{layers:D}):[]}else L=this.queryRenderedFeatures(M,{target:d});return L};if(_==="mouseenter"||_==="mouseover"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:D=>{const B=b(D.point);B.length?M||(M=!0,m.call(this,new wd(_,this,D.originalEvent,{features:B}))):M=!1},mouseout:()=>{M=!1}}}}if(_==="mouseleave"||_==="mouseout"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:B=>{b(B.point).length?M=!0:M&&(M=!1,m.call(this,new wd(_,this,B.originalEvent)))},mouseout:B=>{M&&(M=!1,m.call(this,new wd(_,this,B.originalEvent)))}}}}{const M=L=>{const D=b(L.point);D.length&&(L.features=D,m.call(this,L),delete L.features)};return{listener:m,targets:d,delegates:{[_]:M}}}}on(_,d,m){if(typeof d=="function"||m===void 0)return super.on(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._createDelegatedListener(_,d,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(b);for(const M in b.delegates)this.on(M,b.delegates[M]);return this}once(_,d,m){if(typeof d=="function"||m===void 0)return super.once(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._createDelegatedListener(_,d,m);for(const M in b.delegates)this.once(M,b.delegates[M]);return this}off(_,d,m){if(typeof d=="function"||m===void 0)return super.off(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._delegatedListeners?this._delegatedListeners[_]:void 0;return b&&(M=>{for(let L=0;L{if(m){const M=typeof m=="string"?m:m instanceof Error?m.message:m.error;a.w(`Unable to perform style diff: ${M}. Rebuilding the style from scratch.`),this._updateStyle(_,d)}else b&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(_,d))}_getUIString(_){const d=this._locale[_];if(d==null)throw new Error(`Missing UI string '${_}'`);return d}_updateStyle(_,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),_){const m=Object.assign({},d);d&&d.config&&(m.initialConfig=d.config,delete m.config),this.style=new Yu(this,m).load(_),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Yu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(a.w("There is no style added to the map."),!1)}_isValidId(_){return _==null?(this.fire(new a.y(new Error("IDs can't be empty."))),!1):!a.dr(_)||(this.fire(new a.y(new Error(`IDs can't contain special symbols: "${_}".`))),!1)}_isTargetValid(_){return"featuresetId"in _?this._isValidId("importId"in _?_.importId:_.featuresetId):"layerId"in _&&this._isValidId(_.layerId)}_areTargetsValid(_){if(Array.isArray(_)){for(const d of _)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(_)}addSource(_,d){return this._isValidId(_)?(this._lazyInitEmptyStyle(),this.style.addSource(_,d),this._update(!0)):this}isSourceLoaded(_){return!!this._isValidId(_)&&!!this.style&&this.style._isSourceCacheLoaded(_)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(_,d,m){this._lazyInitEmptyStyle(),this.style.addSourceType(_,d,m)}removeSource(_){return this._isValidId(_)?(this.style.removeSource(_),this._updateTerrain(),this._update(!0)):this}getSource(_){return this._isValidId(_)?this.style.getOwnSource(_):null}addImage(_,d,{pixelRatio:m=1,sdf:b=!1,stretchX:M,stretchY:L,content:D}={}){this._lazyInitEmptyStyle();const B=a.I.from(_);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:V,height:Y,data:Q}=a.o.getImageData(d);this.style.addImage(B,{data:new a.q({width:V,height:Y},Q),pixelRatio:m,stretchX:M,stretchY:L,content:D,sdf:b,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new a.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:V,height:Y}=d,Q=d;this.style.addImage(B,{data:new a.q({width:V,height:Y},new Uint8Array(Q.data)),pixelRatio:m,stretchX:M,stretchY:L,content:D,sdf:b,usvg:!1,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,_)}}updateImage(_,d){this._lazyInitEmptyStyle();const m=a.I.from(_),b=this.style.getImage(m);if(!b)return void this.fire(new a.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const M=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?a.o.getImageData(d):d,{width:L,height:D,data:B}=M;if(L===void 0||D===void 0)return void this.fire(new a.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(L!==(b.usvg?b.icon.usvg_tree.width:b.data.width)||D!==(b.usvg?b.icon.usvg_tree.height:b.data.height))return void this.fire(new a.y(new Error(`The width and height of the updated image (${L}, ${D}) must be that same as the previous version of the image (${b.data.width}, ${b.data.height})`)));const V=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;b.usvg?(b.data=new a.q({width:L,height:D},new Uint8Array(B)),b.usvg=!1,b.icon=void 0,Y=!0):b.data.replace(B,V),this.style.updateImage(m,b,Y)}hasImage(_){return _?!!this.style&&!!this.style.getImage(a.I.from(_)):(this.fire(new a.y(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(a.I.from(_))}loadImage(_,d){a.n(this._requestManager.transformRequest(_,a.R.Image),(m,b)=>{d(m,b instanceof HTMLImageElement?a.o.getImageData(b):b)})}listImages(){return this.style.listImages().map(_=>_.name)}addModel(_,d){this._lazyInitEmptyStyle(),this.style.addModel(_,d)}hasModel(_){return _?this.style.hasModel(_):(this.fire(new a.y(new Error("Missing required model id"))),!1)}removeModel(_){this.style.removeModel(_)}listModels(){return this.style.listModels()}addLayer(_,d){return this._isValidId(_.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(_,d),this._update(!0)):this}getSlot(_){const d=this.getLayer(_);return d&&d.slot||null}setSlot(_,d){return this.style.setSlot(_,d),this.style.mergeLayers(),this._update(!0)}addImport(_,d){return this.style.addImport(_,d).catch(m=>this.fire(new a.y(new Error("Failed to add import",m)))),this}updateImport(_,d){return typeof d!="string"&&d.id!==_?(this.removeImport(_),this.addImport(d)):(this.style.updateImport(_,d),this._update(!0))}removeImport(_){return this.style.removeImport(_),this}moveImport(_,d){return this.style.moveImport(_,d),this._update(!0)}moveLayer(_,d){return this._isValidId(_)?(this.style.moveLayer(_,d),this._update(!0)):this}removeLayer(_){return this._isValidId(_)?(this.style.removeLayer(_),this._update(!0)):this}getLayer(_){if(!this._isValidId(_))return null;const d=this.style.getOwnLayer(_);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(_,d,m){return this._isValidId(_)?(this.style.setLayerZoomRange(_,d,m),this._update(!0)):this}setFilter(_,d,m={}){return this._isValidId(_)?(this.style.setFilter(_,d,m),this._update(!0)):this}getFilter(_){return this._isValidId(_)?this.style.getFilter(_):null}setPaintProperty(_,d,m,b={}){return this._isValidId(_)?(this.style.setPaintProperty(_,d,m,b),this._update(!0)):this}getPaintProperty(_,d){return this._isValidId(_)?this.style.getPaintProperty(_,d):null}setLayoutProperty(_,d,m,b={}){return this._isValidId(_)?(this.style.setLayoutProperty(_,d,m,b),this._update(!0)):this}getLayoutProperty(_,d){return this._isValidId(_)?this.style.getLayoutProperty(_,d):null}setLayerProperty(_,d,m,b={}){return this._isValidId(_)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(_,d,m,b),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(_){return this.style.setGlyphsUrl(_),this._update(!0)}getSchema(_){return this.style.getSchema(_)}setSchema(_,d){return this.style.setSchema(_,d),this._update(!0)}getConfig(_){return this.style.getConfig(_)}setConfig(_,d){return this.style.setConfig(_,d),this._update(!0)}getConfigProperty(_,d){return this.style.getConfigProperty(_,d)}setConfigProperty(_,d,m){return this.style.setConfigProperty(_,d,m),this._update(!0)}getFeaturesetDescriptors(_){return this.style.getFeaturesetDescriptors(_)}setLights(_){if(this._lazyInitEmptyStyle(),_&&_.length===1&&_[0].type==="flat"){const d=_[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(_),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const _=this.style.getLights()||[];return _.length===0&&_.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),_}setLight(_,d={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:_}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(_){return this._lazyInitEmptyStyle(),!_&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(_),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(_){return this._lazyInitEmptyStyle(),this.style.setFog(_),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(_){return this._lazyInitEmptyStyle(),this.style.setSnow(_),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(_){return this._lazyInitEmptyStyle(),this.style.setRain(_),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(_){return this._lazyInitEmptyStyle(),this.style.setColorTheme(_),this._update(!0)}setImportColorTheme(_,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(_,d),this._update(!0)}setCamera(_){return this.style.setCamera(_),this._triggerCameraUpdate(_)}_triggerCameraUpdate(_){return this._update(this.transform.setOrthographicProjectionAtLowPitch(_["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(_){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.aT.convert(_),this.transform):0}setFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.setFeatureState(_,d),this._update())}removeFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.removeFeatureState(_,d),this._update())}getFeatureState(_){return _.source&&!this._isValidId(_.source)?null:this.style.getFeatureState(_)}_selectIndoorFloor(_){this.indoor.selectFloor(_)}_setIndoorActiveFloorsVisibility(_){this.indoor.setActiveFloorsVisibility(_)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Uy),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const _=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let m,b,M,L=this._container;for(;L&&(!b||!M);){const D=window.getComputedStyle(L).transform;D&&D!=="none"&&(m=D.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(b=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(M=m[3])),L=L.parentElement}this._containerWidth=b?Math.abs(_/b):_,this._containerHeight=M?Math.abs(d/M):d}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupIndoor(){this.style.isIndoorEnabled()&&(this.indoor=new XI(this.style),this.on("load",()=>{this._addIndoorControl(),this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds()),this.on("move",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())}),this.on("idle",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())})}))}_setupContainer(){const _=this._container;_.classList.add("mapboxgl-map"),(this._missingCSSCanary=C("div","mapboxgl-canary",_)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=C("div","mapboxgl-canvas-container",_);this._canvas=C("canvas","mapboxgl-canvas",d),this._interactive&&(d.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const m=this._controlContainer=C("div","mapboxgl-control-container",_),b=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(M=>{b[M]=C("div",`mapboxgl-ctrl-${M}`,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,d){const m=a.o.devicePixelRatio||1;this._canvas.width=m*Math.ceil(_),this._canvas.height=m*Math.ceil(d),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${d}px`}_addMarker(_){this._markers.push(_)}_removeMarker(_){const d=this._markers.indexOf(_);d!==-1&&this._markers.splice(d,1)}_addPopup(_){this._popups.push(_)}_removePopup(_){const d=this._popups.indexOf(_);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const _=Object.assign({},S.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",_);d?(nt(d,!0),this.painter=new lN(d,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",m=>{m.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),a.k.testSupport(d)):this.fire(new a.y(new Error("Failed to initialize WebGL")))}_contextLost(_){_.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.z("webglcontextlost",{originalEvent:_}))}_contextRestored(_){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new a.z("webglcontextrestored",{originalEvent:_}))}_onMapScroll(_){if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(_){return this.style?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_requestDomTask(_){!this.loaded()||this.loaded()&&!this.isMoving()?_():this._domRenderTaskQueue.add(_)}_render(_){let d;this.fire(new a.z("renderstart")),++this._frameId;const m=this.painter.context.extTimerQuery,b=a.o.now(),M=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=M.createQuery(),M.beginQuery(m.TIME_ELAPSED_EXT,d)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(_),this._domRenderTaskQueue.run(_),this._removed)return;this._updateProjectionTransition();const L=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const Y=this.transform.zoom,Q=this.transform.pitch,le=a.o.now(),oe=new a.ac(Y,{now:le,fadeDuration:L,pitch:Q,transition:this.style.transition,worldview:this._worldview});this.style.update(oe)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let D=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),D=this._updateAverageElevation(b),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):D=this._updateAverageElevation(b);const B=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,L,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),B&&(this._placementDirty=B.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:L,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,x.mark(p.load),this.fire(new a.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),d){const Y=a.o.now()-b;M.endQuery(m.TIME_ELAPSED_EXT),setTimeout(()=>{const Q=M.getQueryParameter(d,M.QUERY_RESULT)/1e6;M.deleteQuery(d),this.fire(new a.z("gpu-timing-frame",{cpuTime:Y,gpuTime:Q}))},50)}if(this.listens("gpu-timing-layer")){const Y=this.painter.collectGpuTimers();setTimeout(()=>{const Q=this.painter.queryGpuTimers(Y);this.fire(new a.z("gpu-timing-layer",{layerTimes:Q}))},50)}if(this.listens("gpu-timing-deferred-render")){const Y=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const Q=this.painter.queryGpuTimeDeferredRender(Y);this.fire(new a.z("gpu-timing-deferred-render",{gpuTime:Q}))},50)}const V=this._sourcesDirty||this._styleDirty||this._placementDirty||D;if(V||this._repaint)this.triggerRepaint();else{const Y=this.idle();if(Y&&(D=this._updateAverageElevation(b,!0)),D)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new a.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const Q=this._calculateSpeedIndex();this.fire(new a.z("speedindexcompleted",{speedIndex:Q})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||V||(this._fullyLoaded=!0,x.mark(p.fullLoad),this._performanceMetricsCollection&&Ye(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(_){for(const d of this._markers)_&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!_||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(_,d=!1){const m=M=>(this.transform.averageElevation=M,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);const b=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(b||(d||_-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(_)){const M=this.transform.averageElevation;let L=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(L)?L=0:this._averageElevationLastSampledAt=_;const D=Math.abs(M-L);if(D>1){if(this._isInitialLoad||b)return this._averageElevation.jumpTo(L),m(L);this._averageElevation.easeTo(L,_,300)}else if(D>1e-4)return this._averageElevation.jumpTo(L),m(L)}return!!this._averageElevation.isEasing(_)&&m(this._averageElevation.getValue(_))}_authenticate(){mt(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,_=>{if(_&&(_.message===be||_.status===401)){const d=this.painter.context.gl;nt(d,!1),this._logoControl instanceof Vv&&this._logoControl._updateLogo(),d&&d.clear(d.DEPTH_BUFFER_BIT|d.COLOR_BUFFER_BIT|d.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),Me(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ie(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Re(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Je(this._requestManager._customAccessToken)}_updateTerrain(){const _=this._isDragging();this.painter.updateTerrain(this.style,_)}_calculateSpeedIndex(){const _=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const m=this.painter.context.gl,b=m.createFramebuffer();function M(L){m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,L,0);const D=new Uint8Array(m.drawingBufferWidth*m.drawingBufferHeight*4);return m.readPixels(0,0,m.drawingBufferWidth,m.drawingBufferHeight,m.RGBA,m.UNSIGNED_BYTE,D),D}return m.bindFramebuffer(m.FRAMEBUFFER,b),this._canvasPixelComparison(M(_),d.canvasCopies.map(M),d.timeStamps)}_canvasPixelComparison(_,d,m){let b=m[1]-m[0];const M=_.length/4;for(let L=0;L{const m=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,m&&this._render(d)}))}_preloadTiles(_){const d=this.style?this.style.getSourceCaches():[];return a.bw(d,(m,b)=>m._preloadTiles(_,b),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(_){this._trackResize&&this.resize({originalEvent:_})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(_){this._showParseStatus!==_&&(this._showParseStatus=_,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(_){this._showTerrainWireframe!==_&&(this._showTerrainWireframe=_,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(_){this._showLayers2DWireframe!==_&&(this._showLayers2DWireframe=_,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(_){this._showLayers3DWireframe!==_&&(this._showLayers3DWireframe=_,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(_){this._speedIndexTiming!==_&&(this._speedIndexTiming=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,this.style&&_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(_){this._showTileAABBs!==_&&(this._showTileAABBs=_,_&&this._update())}_setCacheLimits(_,d){a.f4(_,d)}get version(){return h}},NavigationControl:class{constructor(_={}){this.options=Object.assign({},bae,_),this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(a.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",d=>{this._map&&this._map.zoomIn({},{originalEvent:d})}),C("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",d=>{this._map&&this._map.zoomOut({},{originalEvent:d})}),C("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",d=>{const m=this._map;m&&(this.options.visualizePitch?m.resetNorthPitch({},{originalEvent:d}):m.resetNorth({},{originalEvent:d}))}),this._compassIcon=C("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const _=this._map;if(!_)return;const d=_.getZoom(),m=d===_.getMaxZoom(),b=d===_.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=b,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",b.toString())}_rotateCompassArrow(){const _=this._map;if(!_)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(_.transform.pitch*(Math.PI/180)),.5)}) rotateX(${_.transform.pitch}deg) rotateZ(${_.transform.angle*(180/Math.PI)}deg)`:`rotate(${_.transform.angle*(180/Math.PI)}deg)`;_._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),_.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&_.on("pitch",this._rotateCompassArrow),_.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new wae(_,this._compass,this.options.visualizePitch)),this._container}onRemove(){const _=this._map;_&&(this._container.remove(),this.options.showZoom&&_.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&_.off("pitch",this._rotateCompassArrow),_.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(_,d){const m=C("button",_,this._container);return m.type="button",m.addEventListener("click",d),m}_setButtonTitle(_,d){if(!this._map)return;const m=this._map._getUIString(`NavigationControl.${d}`);_.setAttribute("aria-label",m),_.firstElementChild&&_.firstElementChild.setAttribute("title",m)}},GeolocateControl:class extends a.E{constructor(_={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},jae,_),a.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=cN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(_){return this._map=_,this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(_){const d=(m=!!this.options.geolocation)=>{this._supportsGeolocation=m,_(m)};this._supportsGeolocation!==void 0?_(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(m=>d(m.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(_){const d=this._map.getMaxBounds(),m=_.coords;return!!d&&(m.longituded.getEast()||m.latituded.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(_){if(this._map){if(this._isOutOfMapMaxBounds(_))return this._setErrorState(),this.fire(new a.z("outofmaxbounds",_)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=_,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(_),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(_),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("geolocate",Object.assign({coords:_.coords,timestamp:_.timestamp},_.toJSON?{toJSON:_.toJSON.bind(_)}:{}))),this._finish()}}_updateCamera(_){const d=new a.aT(_.coords.longitude,_.coords.latitude),m=_.coords.accuracy,b=this._map.getBearing(),M=Object.assign({bearing:b},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(m),M,{geolocateSource:!0})}_updateMarker(_){if(_){const d=new a.aT(_.coords.longitude,_.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=_.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const _=this._map.transform,d=a.cf(1,_._center.lat)*_.worldSize,m=Math.ceil(2*this._accuracy*d);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(_){if(this._map){if(this.options.trackUserLocation)if(_.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(_.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("error",_)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(_){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=C("button","mapboxgl-ctrl-geolocate",this._container),C("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",_===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C("div","mapboxgl-user-location"),this._dotElement.appendChild(C("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(C("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new wN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=C("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new wN({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.z("trackuserlocationend")))})}}_onDeviceOrientation(_){this._userLocationDotMarker&&(_.webkitCompassHeading?this._heading=_.webkitCompassHeading:_.absolute===!0&&(this._heading=-1*_.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(_={maximumAge:6e5,timeout:0},this._noTimeout=!0):(_=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,_),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const _=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(d=>{d==="granted"&&_()}).catch(console.error):_()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:qv,ScaleControl:class{constructor(_={}){this.options=Object.assign({},qy,_),a.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const _=this.options.maxWidth||100,d=this._map,m=d._containerHeight/2,b=d._containerWidth/2-_/2,M=d.unproject([b,m]),L=d.unproject([b+_,m]),D=M.distanceTo(L);if(this.options.unit==="imperial"){const B=3.2808*D;B>5280?this._setScale(_,B/5280,"mile"):this._setScale(_,B,"foot")}else this.options.unit==="nautical"?this._setScale(_,D/1852,"nautical-mile"):D>=1e3?this._setScale(_,D/1e3,"kilometer"):this._setScale(_,D,"meter")}_setScale(_,d,m){this._map._requestDomTask(()=>{const b=function(L){const D=Math.pow(10,`${Math.floor(L)}`.length-1);let B=L/D;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(V){const Y=Math.pow(10,Math.ceil(-Math.log(V)/Math.LN10));return Math.round(V*Y)/Y}(B),D*B}(d),M=b/d;this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:m}).format(b):`${b} ${P5[m]}`,this._container.style.width=_*M+"px"})}onAdd(_){return this._map=_,this._language=_.getLanguage(),this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-scale",_.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(_){this._language=_,this._update()}setUnit(_){this.options.unit=_,this._update()}},FullscreenControl:class{constructor(_={}){this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:a.w("Full screen control 'container' must be a DOM element.")),a.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=C("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const _=this._fullscreenButton=C("button","mapboxgl-ctrl-fullscreen",this._controlContainer);C("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",_)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Uy,Popup:class extends a.E{constructor(_){super(),this.options=Object.assign(Object.create(Qu),_),this._altitude=this.options.altitude,a.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(_&&_.className?_.className.trim().split(/\s+/):[])}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&_.on("preclick",this._onClose),this.options.closeOnMove&&_.on("move",this._onClose),_.on("remove",this.remove),this._update(),_._addPopup(this),this._focusFirstElement(),this._trackPointer?(_.on("mousemove",this._onMouseEvent),_.on("mouseup",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")):_.on("move",this._update),this.fire(new a.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const _=this._map;return _&&(_.off("move",this._update),_.off("move",this._onClose),_.off("preclick",this._onClose),_.off("click",this._onClose),_.off("remove",this.remove),_.off("mousemove",this._onMouseEvent),_.off("mouseup",this._onMouseEvent),_.off("drag",this._onMouseEvent),_._canvasContainer&&_._canvasContainer.classList.remove("mapboxgl-track-pointer"),_._removePopup(this),this._map=void 0),this.fire(new a.z("close")),this}getLngLat(){return this._lngLat}setLngLat(_){this._lngLat=a.aT.convert(_),this._pos=null,this._trackPointer=!1,this._update();const d=this._map;return d&&(d.on("move",this._update),d.off("mousemove",this._onMouseEvent),d._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(_){return this._altitude=_,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const _=this._map;return _&&(_.off("move",this._update),_.on("mousemove",this._onMouseEvent),_.on("drag",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const d=document.createDocumentFragment(),m=document.createElement("body");let b;for(m.innerHTML=_;b=m.firstChild,b;)d.appendChild(b);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=C("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(_),this.options.closeButton){const m=this._closeButton=C("button","mapboxgl-popup-close-button",d);m.type="button",m.setAttribute("aria-label","Close popup"),m.innerHTML='',m.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(_){return this._classList.add(_),this._updateClassList(),this}removeClassName(_){return this._classList.delete(_),this._updateClassList(),this}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){let d;return this._classList.delete(_)?d=!1:(this._classList.add(_),d=!0),this._updateClassList(),d}_onMouseEvent(_){this._update(_.point)}_getAnchor(_){if(this.options.anchor)return this.options.anchor;const d=this._map,m=this._container,b=this._pos;if(!d||!m||!b)return"bottom";const M=m.offsetWidth,L=m.offsetHeight,D=b.xd.transform.width-M/2;if(b.y+_d.transform.height-L){if(D)return"bottom-left";if(B)return"bottom-right"}return D?"left":B?"right":"bottom"}_updateClassList(){const _=this._container;if(!_)return;const d=[...this._classList];d.push("mapboxgl-popup"),this._anchor&&d.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&d.push("mapboxgl-popup-track-pointer"),_.className=d.join(" ")}_update(_){const d=this._map,m=this._content;if(!d||!this._lngLat&&!this._trackPointer||!m)return;let b=this._container;if(b||(b=this._container=C("div","mapboxgl-popup",d.getContainer()),this._tip=C("div","mapboxgl-popup-tip",b),b.appendChild(m)),this.options.maxWidth&&b.style.maxWidth!==this.options.maxWidth&&(b.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=I5(this._lngLat,this._pos,d.transform)),!this._trackPointer||_){const M=this._pos=this._trackPointer&&_ instanceof a.P?_:d.project(this._lngLat,this._altitude),L=ax(this.options.offset),D=this._anchor=this._getAnchor(L.y),B=ax(this.options.offset,D),V=M.add(B).round();d._requestDomTask(()=>{this._container&&D&&(this._container.style.transform=`${mc[D]} translate(${V.x}px,${V.y}px)`)})}if(!this._marker&&d._showingGlobe()){const M=a.f5(d.transform,this._lngLat)?0:1;this._setOpacity(M)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Ju);_&&_.focus()}_onClose(){this.remove()}_setOpacity(_){this._container&&(this._container.style.opacity=`${_}`),this._content&&(this._content.style.pointerEvents=_?"auto":"none")}},Marker:wN,Style:Yu,LngLat:a.aT,LngLatBounds:a.aI,Point:a.P,MercatorCoordinate:a.ae,FreeCameraOptions:Jc,Evented:a.E,config:a.e,prewarm:a.f9,clearPrewarmedResources:a.f8,get accessToken(){return a.e.ACCESS_TOKEN},set accessToken(_){a.e.ACCESS_TOKEN=_},get baseApiUrl(){return a.e.API_URL},set baseApiUrl(_){a.e.API_URL=_},get workerCount(){return a.fi.workerCount},set workerCount(_){a.fi.workerCount=_},get maxParallelImageRequests(){return a.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(_){a.e.MAX_PARALLEL_IMAGE_REQUESTS=_},clearStorage(_){a.fh(_)},get workerUrl(){return a.fg.workerUrl},set workerUrl(_){a.fg.workerUrl=_},get workerClass(){return a.fg.workerClass},set workerClass(_){a.fg.workerClass=_},get workerParams(){return a.fg.workerParams},set workerParams(_){a.fg.workerParams=_},get dracoUrl(){return a.ff()},set dracoUrl(_){a.fe(_)},get meshoptUrl(){return a.fd()},set meshoptUrl(_){a.fc(_)},setNow:a.o.setNow,restoreNow:a.o.restoreNow}});var l=i;return l})})(Oze);var fkt=Oze.exports;const FL=za(fkt);function pkt(){const e=ns(),{isAdmin:t}=zr(),n=P.useRef(null),s=P.useRef(null),i=P.useRef([]),o=Aze(),{data:l}=Mze(),a=Ize(),[h,p]=P.useState(""),[x,y]=P.useState(""),[w,j]=P.useState(!0),[S,C]=P.useState(null),[A,E]=P.useState(null),[T,O]=P.useState(!1),[z,F]=P.useState({popby_item_id:"",notes:""}),q=o.filter(re=>re.address||re.city&&re.state);P.useEffect(()=>{(async()=>{j(!0);try{const{data:ue}=await ee.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ue!=null&&ue.value&&p(ue.value)}catch(ue){console.error("Error fetching mapbox token:",ue)}j(!1)})()},[]),P.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(re=>{C([re.coords.longitude,re.coords.latitude])},re=>{console.log("Could not get location:",re)})},[]),P.useEffect(()=>{if(!(!n.current||!h||s.current))return FL.accessToken=h,s.current=new FL.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:S?12:4,center:S||[-98.5795,39.8283]}),s.current.addControl(new FL.NavigationControl,"top-right"),()=>{var re;(re=s.current)==null||re.remove(),s.current=null}},[h,S]),P.useEffect(()=>{!s.current||!h||(i.current.forEach(re=>re.remove()),i.current=[],q.forEach(async re=>{var he;const ue=[re.address,re.city,re.state,re.zip].filter(Boolean).join(", ");if(ue)try{const ne=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ue)}.json?access_token=${h}`)).json();if(ne.features&&ne.features.length>0){const[ye,ie]=ne.features[0].center,fe=document.createElement("div");fe.className="cursor-pointer",fe.innerHTML=`
${re.first_name[0]}${((he=re.last_name)==null?void 0:he[0])||""}
${re.isDue?'
':""}
`;const de=new FL.Marker(fe).setLngLat([ye,ie]).addTo(s.current);fe.addEventListener("click",()=>{E(re)}),i.current.push(de)}}catch(be){console.error("Geocoding error for",re.first_name,be)}}))},[q,h]);const H=()=>{S&&s.current?s.current.flyTo({center:S,zoom:13}):$i({title:"Location not available",description:"Please enable location services",variant:"destructive"})},K=async()=>{A&&(await a.mutateAsync({contact_id:A.id,popby_item_id:z.popby_item_id||void 0,notes:z.notes||void 0,latitude:S==null?void 0:S[1],longitude:S==null?void 0:S[0]}),O(!1),E(null),F({popby_item_id:"",notes:""}))},Z=async()=>{if(x.trim())try{await ee.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),p(x.trim()),$i({title:"Mapbox token saved!"})}catch{$i({title:"Error saving token",variant:"destructive"})}};return w?r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):h?r.jsx(Or,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(J,{variant:"ghost",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(J,{onClick:H,children:[r.jsx(PT,{className:"h-4 w-4 mr-2"}),"My Location"]})]}),r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-primary"}),r.jsx("span",{children:"Up to date"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-500"}),r.jsx("span",{children:"Due for popby"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg"}),q.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 rounded-lg",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"font-medium",children:"No contacts with addresses"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add addresses to your contacts to see them on the map."})]})})]}),A&&r.jsx(We,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold",children:[A.first_name," ",A.last_name]}),A.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[A.city,", ",A.state]})]}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>E(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[A.isDue?r.jsxs(Ft,{variant:"destructive",children:[A.daysOverdue,"+ days overdue"]}):r.jsx(Ft,{variant:"secondary",children:"Up to date"}),A.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",fn(new Date(A.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[A.phone&&r.jsx(J,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${A.phone}`,children:[r.jsx(ca,{className:"h-4 w-4 mr-1"}),"Call"]})}),A.address&&r.jsxs(J,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const re=[A.address,A.city,A.state,A.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(re)}`,"_blank")},children:[r.jsx(zT,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(J,{size:"sm",className:"flex-1",onClick:()=>O(!0),children:[r.jsx(Va,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Br,{open:T,onOpenChange:O,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Log Popby for ",A==null?void 0:A.first_name," ",A==null?void 0:A.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Popby Item (optional)"}),r.jsxs(bn,{value:z.popby_item_id,onValueChange:re=>F(ue=>({...ue,popby_item_id:re})),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select a popby item..."})}),r.jsx(_n,{children:l==null?void 0:l.map(re=>r.jsx(Kt,{value:re.id,children:re.name},re.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Notes (optional)"}),r.jsx(ms,{placeholder:"Any notes about this popby...",value:z.notes,onChange:re=>F(ue=>({...ue,notes:re.target.value}))})]}),S&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(pl,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),r.jsxs(J,{onClick:K,disabled:a.isPending,children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):t?r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(We,{children:r.jsxs(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(pl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Setup Map"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Mapbox public token to enable the map feature."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Mapbox Public Token"}),r.jsx(ct,{placeholder:"pk.eyJ1I...",value:x,onChange:re=>y(re.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),r.jsx(J,{onClick:Z,className:"w-full",children:"Save Token"}),r.jsxs(J,{variant:"outline",className:"w-full",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(We,{children:r.jsxs(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Map Not Available"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The map feature has not been configured yet. Please contact your administrator."})]}),r.jsxs(J,{variant:"outline",className:"w-full",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const mkt=d3({property_address:nc().min(1,"Property address is required"),city:nc().optional(),state:nc().optional(),zip:nc().optional(),transaction_type:I6e(["buyer","seller"]),close_date:nc().min(1,"Close date is required"),sale_price:iA().min(0,"Sale price must be positive"),commission_amount:iA().optional(),lead_source_id:nc().optional(),client_type_id:nc().optional(),contact_id:nc().optional(),notes:nc().optional(),is_win:Fat()});function Rze({open:e,onOpenChange:t,transaction:n}){const[s,i]=P.useState(!1),[o,l]=P.useState(""),[a,h]=P.useState(!1),[p,x]=P.useState(""),y=jse(),w=mpt(),{data:j}=wse(),{data:S}=Bg(),{data:C}=op(),A=_xe(),E=ppt(),{data:T}=kse(),O=(T==null?void 0:T.show_commission)??!0,z=dse({resolver:use(mkt),defaultValues:{property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1}});P.useEffect(()=>{n?z.reset({property_address:n.property_address,city:n.city||"",state:n.state||"",zip:n.zip||"",transaction_type:n.transaction_type,close_date:n.close_date,sale_price:Number(n.sale_price),commission_amount:n.commission_amount?Number(n.commission_amount):void 0,lead_source_id:n.lead_source_id||void 0,client_type_id:n.client_type_id||void 0,contact_id:n.contact_id||void 0,notes:n.notes||"",is_win:n.is_win}):z.reset({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1})},[n,z]);const F=async Z=>{const re={property_address:Z.property_address,transaction_type:Z.transaction_type,close_date:Z.close_date,sale_price:Z.sale_price,is_win:Z.is_win,commission_amount:Z.commission_amount||null,lead_source_id:Z.lead_source_id||null,client_type_id:Z.client_type_id||null,contact_id:Z.contact_id||null,city:Z.city||null,state:Z.state||null,zip:Z.zip||null,notes:Z.notes||null};n?await w.mutateAsync({id:n.id,...re}):await y.mutateAsync(re),t(!1)},q=async()=>{if(!o.trim())return;const[Z,...re]=o.trim().split(" "),ue=re.join(" ")||null,he=await A.mutateAsync({first_name:Z,last_name:ue,tagIds:[]});he&&(z.setValue("contact_id",he.id),l(""),h(!1),i(!1))},H=async()=>{if(!p.trim())return;const Z=await E.mutateAsync(p.trim());Z&&(z.setValue("lead_source_id",Z.id),x(""))},K=C==null?void 0:C.find(Z=>Z.id===z.watch("contact_id"));return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(Hr,{children:r.jsx(qr,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(Jo,{className:"max-h-[70vh] pr-4",children:r.jsx(hse,{...z,children:r.jsxs("form",{onSubmit:z.handleSubmit(F),className:"space-y-4",children:[r.jsx(Ml,{control:z.control,name:"property_address",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Property Address *"}),r.jsx(bl,{children:r.jsx(ct,{placeholder:"123 Main St",...Z})}),r.jsx(bu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Ml,{control:z.control,name:"city",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"City"}),r.jsx(bl,{children:r.jsx(ct,{placeholder:"City",...Z})})]})}),r.jsx(Ml,{control:z.control,name:"state",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"State"}),r.jsx(bl,{children:r.jsx(ct,{placeholder:"TX",...Z})})]})}),r.jsx(Ml,{control:z.control,name:"zip",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Zip"}),r.jsx(bl,{children:r.jsx(ct,{placeholder:"75001",...Z})})]})})]}),r.jsx(Ml,{control:z.control,name:"transaction_type",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Transaction Type *"}),r.jsxs(bn,{onValueChange:Z.onChange,value:Z.value,children:[r.jsx(bl,{children:r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select type"})})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"buyer",children:"Buyer"}),r.jsx(Kt,{value:"seller",children:"Seller"})]})]}),r.jsx(bu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Ml,{control:z.control,name:"close_date",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Close Date *"}),r.jsx(bl,{children:r.jsx(ct,{type:"date",...Z})}),r.jsx(bu,{})]})}),r.jsx(Ml,{control:z.control,name:"sale_price",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Sale Price *"}),r.jsx(bl,{children:r.jsx(ct,{type:"number",placeholder:"0",...Z,onChange:re=>Z.onChange(Number(re.target.value))})}),r.jsx(bu,{})]})})]}),O&&r.jsx(Ml,{control:z.control,name:"commission_amount",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Commission"}),r.jsx(bl,{children:r.jsx(ct,{type:"number",placeholder:"0",...Z,value:Z.value??"",onChange:re=>Z.onChange(re.target.value?Number(re.target.value):void 0)})})]})}),r.jsx(Ml,{control:z.control,name:"lead_source_id",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Lead Source"}),r.jsxs(bn,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(bl,{children:r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select source"})})}),r.jsx(_n,{children:j==null?void 0:j.map(re=>r.jsx(Kt,{value:re.id,children:re.name},re.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{placeholder:"Add custom source...",value:p,onChange:Z=>x(Z.target.value),className:"flex-1"}),r.jsx(J,{type:"button",variant:"outline",size:"icon",onClick:H,disabled:!p.trim(),children:r.jsx(jn,{className:"h-4 w-4"})})]}),r.jsx(Ml,{control:z.control,name:"client_type_id",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Client Type"}),r.jsxs(bn,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(bl,{children:r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select client type"})})}),r.jsx(_n,{children:S==null?void 0:S.map(re=>r.jsx(Kt,{value:re.id,children:re.name},re.id))})]})]})}),r.jsx(Ml,{control:z.control,name:"contact_id",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Client Contact"}),r.jsxs(_h,{open:s,onOpenChange:i,children:[r.jsx(bh,{asChild:!0,children:r.jsx(bl,{children:r.jsxs(J,{variant:"outline",role:"combobox",className:$t("w-full justify-between",!Z.value&&"text-muted-foreground"),children:[K?`${K.first_name} ${K.last_name||""}`.trim():"Select contact",r.jsx(a1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(Ou,{className:"w-full p-0",align:"start",children:[r.jsxs($1,{children:[r.jsx(U1,{placeholder:"Search contacts..."}),r.jsxs(q1,{children:[r.jsx(V1,{children:r.jsxs("div",{className:"p-2 space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!a&&r.jsxs(J,{variant:"outline",size:"sm",className:"w-full",onClick:()=>h(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(H1,{children:C==null?void 0:C.map(re=>r.jsxs(W1,{value:`${re.first_name} ${re.last_name||""}`,onSelect:()=>{Z.onChange(re.id),i(!1)},children:[r.jsx(Ca,{className:$t("mr-2 h-4 w-4",re.id===Z.value?"opacity-100":"opacity-0")}),re.first_name," ",re.last_name||""]},re.id))})]})]}),a&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(ct,{placeholder:"Enter contact name...",value:o,onChange:re=>l(re.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{size:"sm",onClick:q,disabled:!o.trim()||A.isPending,children:"Add Contact"}),r.jsx(J,{size:"sm",variant:"outline",onClick:()=>{h(!1),l("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(Ml,{control:z.control,name:"notes",render:({field:Z})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Notes"}),r.jsx(bl,{children:r.jsx(ms,{placeholder:"Any notes about this transaction...",...Z})})]})}),r.jsx(Ml,{control:z.control,name:"is_win",render:({field:Z})=>r.jsxs(vl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(_l,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(bl,{children:r.jsx($s,{checked:Z.value,onCheckedChange:Z.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:y.isPending||w.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function Fze({transactions:e,showCommission:t,isLoading:n}){const[s,i]=P.useState(null),[o,l]=P.useState(null),[a,h]=P.useState(""),[p,x]=P.useState("all"),[y,w]=P.useState("all"),[j,S]=P.useState("all"),[C,A]=P.useState(!1),E=gpt(),T=jse(),{data:O}=wse(),{data:z}=Bg(),F=OI(),q=Z=>{const{id:re,created_at:ue,updated_at:he,lead_source:be,client_type:ne,contact:ye,...ie}=Z;T.mutate(ie)},H=()=>{o&&(E.mutate(o),l(null))},K=e.filter(Z=>{var ye,ie,fe,de;const re=a===""||Z.property_address.toLowerCase().includes(a.toLowerCase())||((ie=(ye=Z.contact)==null?void 0:ye.first_name)==null?void 0:ie.toLowerCase().includes(a.toLowerCase()))||((de=(fe=Z.contact)==null?void 0:fe.last_name)==null?void 0:de.toLowerCase().includes(a.toLowerCase())),ue=p==="all"||Z.transaction_type===p,he=y==="all"||Z.lead_source_id===y,be=j==="all"||Z.client_type_id===j,ne=!C||Z.is_win;return re&&ue&&he&&be&&ne});return n?r.jsx(We,{children:r.jsx(Xe,{className:"p-6 space-y-4",children:[1,2,3].map(Z=>r.jsx(Pr,{className:"h-16 w-full"},Z))})}):r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs(Xt,{children:["Transactions (",K.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search...",value:a,onChange:Z=>h(Z.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(bn,{value:p,onValueChange:x,children:[r.jsx(vn,{className:"w-[100px]",children:r.jsx(wn,{placeholder:"Type"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Types"}),r.jsx(Kt,{value:"buyer",children:"Buyer"}),r.jsx(Kt,{value:"seller",children:"Seller"})]})]}),r.jsxs(bn,{value:y,onValueChange:w,children:[r.jsx(vn,{className:"w-[130px]",children:r.jsx(wn,{placeholder:"Lead Source"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Sources"}),O==null?void 0:O.map(Z=>r.jsx(Kt,{value:Z.id,children:Z.name},Z.id))]})]}),r.jsxs(J,{variant:C?"default":"outline",size:"sm",onClick:()=>A(!C),children:[r.jsx(Pl,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(Xe,{children:K.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):F?r.jsx("div",{className:"space-y-3",children:K.map(Z=>r.jsxs(We,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium truncate",children:Z.property_address}),Z.is_win&&r.jsx(Pl,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]}),r.jsx(Ft,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-3 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Close Date: "}),Qbe(Z.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),Td(Z.sale_price)]}),t&&Z.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),Td(Z.commission_amount)]}),Z.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),Z.lead_source.name]}),Z.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),Z.contact.first_name," ",Z.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>i(Z),children:r.jsx(rc,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>q(Z),children:r.jsx(jl,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>l(Z.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]},Z.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Property"}),r.jsx(Et,{children:"Type"}),r.jsx(Et,{children:"Close Date"}),r.jsx(Et,{children:"Sale Price"}),t&&r.jsx(Et,{children:"Commission"}),r.jsx(Et,{children:"Lead Source"}),r.jsx(Et,{children:"Client"}),r.jsx(Et,{className:"w-[50px]"})]})}),r.jsx(Hs,{children:K.map(Z=>{var re;return r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_win&&r.jsx(Pl,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Z.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]})]})}),r.jsx(vt,{children:r.jsx(Ft,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})}),r.jsx(vt,{children:Qbe(Z.close_date)}),r.jsx(vt,{children:Td(Z.sale_price)}),t&&r.jsx(vt,{children:Z.commission_amount?Td(Z.commission_amount):"-"}),r.jsx(vt,{children:((re=Z.lead_source)==null?void 0:re.name)||"-"}),r.jsx(vt,{children:Z.contact?`${Z.contact.first_name} ${Z.contact.last_name||""}`.trim():"-"}),r.jsx(vt,{children:r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",children:r.jsx(Sx,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",children:[r.jsxs(po,{onClick:()=>i(Z),children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(po,{onClick:()=>q(Z),children:[r.jsx(jl,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(po,{onClick:()=>l(Z.id),className:"text-destructive",children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},Z.id)})})]})})})]}),r.jsx(Rze,{open:!!s,onOpenChange:Z=>!Z&&i(null),transaction:s||void 0}),r.jsx(uh,{open:!!o,onOpenChange:Z=>!Z&&l(null),children:r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Delete Transaction?"}),r.jsx(Su,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:H,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function zze({goals:e,stats:t,year:n,showCommission:s}){const i=new Date().getMonth()+1,o=new Date().getFullYear()===n?i:12,l=12-o,a=(w,j)=>{if(!j||j===0)return null;const S=Math.min(w/j*100,100),C=Math.max(j-w,0),A=l>0?C/l:0,E=o/12*100,T=S>=E?"ahead":S>=E*.8?"on-track":"behind";return{percent:S,remaining:C,pace:A,status:T}},h=a(t.totalTransactions,e.transactions_goal),p=a(t.totalVolume,e.volume_goal),x=s?a(t.totalCommission,e.gci_goal):null,y=w=>{switch(w){case"ahead":return r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx(Kf,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Ft,{variant:"secondary",children:[r.jsx(g1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Ft,{variant:"destructive",children:[r.jsx(_1,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!e.transactions_goal&&!e.volume_goal&&!e.gci_goal?null:r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wx,{className:"h-5 w-5 text-primary"}),r.jsxs(Xt,{children:[n," Goals Progress"]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.transactions_goal&&h&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Transactions"}),y(h.status)]}),r.jsx(Hc,{value:h.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[t.totalTransactions," of ",e.transactions_goal]}),r.jsxs("span",{children:[Math.round(h.percent),"%"]})]}),h.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(h.pace),"/month to hit goal"]})]}),e.volume_goal&&p&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Volume"}),y(p.status)]}),r.jsx(Hc,{value:p.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Td(t.totalVolume,!0)," of ",Td(e.volume_goal,!0)]}),r.jsxs("span",{children:[Math.round(p.percent),"%"]})]}),p.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Td(p.pace,!0),"/month"]})]}),s&&e.gci_goal&&x&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"GCI"}),y(x.status)]}),r.jsx(Hc,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Td(t.totalCommission,!0)," of ",Td(e.gci_goal,!0)]}),r.jsxs("span",{children:[Math.round(x.percent),"%"]})]}),x.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Td(x.pace,!0),"/month"]})]})]})})]})}var gkt=Array.isArray,jh=gkt,xkt=typeof Ax=="object"&&Ax&&Ax.Object===Object&&Ax,Bze=xkt,ykt=Bze,vkt=typeof self=="object"&&self&&self.Object===Object&&self,_kt=ykt||vkt||Function("return this")(),$g=_kt,bkt=$g,wkt=bkt.Symbol,DI=wkt,m4e=DI,$ze=Object.prototype,jkt=$ze.hasOwnProperty,kkt=$ze.toString,VM=m4e?m4e.toStringTag:void 0;function Nkt(e){var t=jkt.call(e,VM),n=e[VM];try{e[VM]=void 0;var s=!0}catch{}var i=kkt.call(e);return s&&(t?e[VM]=n:delete e[VM]),i}var Skt=Nkt,Ckt=Object.prototype,Mkt=Ckt.toString;function Tkt(e){return Mkt.call(e)}var Akt=Tkt,g4e=DI,Ekt=Skt,Ikt=Akt,Pkt="[object Null]",Lkt="[object Undefined]",x4e=g4e?g4e.toStringTag:void 0;function Okt(e){return e==null?e===void 0?Lkt:Pkt:x4e&&x4e in Object(e)?Ekt(e):Ikt(e)}var my=Okt;function Dkt(e){return e!=null&&typeof e=="object"}var gy=Dkt,Rkt=my,Fkt=gy,zkt="[object Symbol]";function Bkt(e){return typeof e=="symbol"||Fkt(e)&&Rkt(e)==zkt}var m3=Bkt,$kt=jh,Ukt=m3,qkt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vkt=/^\w*$/;function Hkt(e,t){if($kt(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ukt(e)?!0:Vkt.test(e)||!qkt.test(e)||t!=null&&e in Object(t)}var Nye=Hkt;function Wkt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var lv=Wkt;const g3=za(lv);var Gkt=my,Kkt=lv,Zkt="[object AsyncFunction]",Ykt="[object Function]",Xkt="[object GeneratorFunction]",Qkt="[object Proxy]";function Jkt(e){if(!Kkt(e))return!1;var t=Gkt(e);return t==Ykt||t==Xkt||t==Zkt||t==Qkt}var Sye=Jkt;const Ri=za(Sye);var eNt=$g,tNt=eNt["__core-js_shared__"],rNt=tNt,Fce=rNt,y4e=function(){var e=/[^.]+$/.exec(Fce&&Fce.keys&&Fce.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function nNt(e){return!!y4e&&y4e in e}var sNt=nNt,iNt=Function.prototype,aNt=iNt.toString;function oNt(e){if(e!=null){try{return aNt.call(e)}catch{}try{return e+""}catch{}}return""}var Uze=oNt,lNt=Sye,cNt=sNt,dNt=lv,uNt=Uze,hNt=/[\\^$.*+?()[\]{}|]/g,fNt=/^\[object .+?Constructor\]$/,pNt=Function.prototype,mNt=Object.prototype,gNt=pNt.toString,xNt=mNt.hasOwnProperty,yNt=RegExp("^"+gNt.call(xNt).replace(hNt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vNt(e){if(!dNt(e)||cNt(e))return!1;var t=lNt(e)?yNt:fNt;return t.test(uNt(e))}var _Nt=vNt;function bNt(e,t){return e==null?void 0:e[t]}var wNt=bNt,jNt=_Nt,kNt=wNt;function NNt(e,t){var n=kNt(e,t);return jNt(n)?n:void 0}var ak=NNt,SNt=ak,CNt=SNt(Object,"create"),Kse=CNt,v4e=Kse;function MNt(){this.__data__=v4e?v4e(null):{},this.size=0}var TNt=MNt;function ANt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ENt=ANt,INt=Kse,PNt="__lodash_hash_undefined__",LNt=Object.prototype,ONt=LNt.hasOwnProperty;function DNt(e){var t=this.__data__;if(INt){var n=t[e];return n===PNt?void 0:n}return ONt.call(t,e)?t[e]:void 0}var RNt=DNt,FNt=Kse,zNt=Object.prototype,BNt=zNt.hasOwnProperty;function $Nt(e){var t=this.__data__;return FNt?t[e]!==void 0:BNt.call(t,e)}var UNt=$Nt,qNt=Kse,VNt="__lodash_hash_undefined__";function HNt(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=qNt&&t===void 0?VNt:t,this}var WNt=HNt,GNt=TNt,KNt=ENt,ZNt=RNt,YNt=UNt,XNt=WNt;function x3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var p4t=f4t,m4t=Zse;function g4t(e,t){var n=this.__data__,s=m4t(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}var x4t=g4t,y4t=e4t,v4t=l4t,_4t=u4t,b4t=p4t,w4t=x4t;function y3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},Vw=function(t){return Wj(t)&&t.indexOf("%")===t.length-1},Dn=function(t){return USt(t)&&!RI(t)},WSt=function(t){return _a(t)},Uc=function(t){return Dn(t)||Wj(t)},GSt=0,FI=function(t){var n=++GSt;return"".concat(t||"").concat(n)},Tu=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Dn(t)&&!Wj(t))return s;var o;if(Vw(t)){var l=t.indexOf("%");o=n*parseFloat(t.slice(0,l))/100}else o=+t;return RI(o)&&(o=s),i&&o>n&&(o=n),o},M0=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},KSt=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,s={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function tCt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var S4e={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Yx=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},C4e=null,Bce=null,Dye=function e(t){if(t===C4e&&Array.isArray(Bce))return Bce;var n=[];return P.Children.forEach(t,function(s){_a(s)||(RSt.isFragment(s)?n=n.concat(e(s.props.children)):n.push(s))}),Bce=n,C4e=t,n};function Qf(e,t){var n=[],s=[];return Array.isArray(t)?s=t.map(function(i){return Yx(i)}):s=[Yx(t)],Dye(e).forEach(function(i){var o=tf(i,"type.displayName")||tf(i,"type.name");s.indexOf(o)!==-1&&n.push(i)}),n}function Rh(e,t){var n=Qf(e,t);return n&&n[0]}var M4e=function(t){if(!t||!t.props)return!1;var n=t.props,s=n.width,i=n.height;return!(!Dn(s)||s<=0||!Dn(i)||i<=0)},rCt=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],nCt=function(t){return t&&t.type&&Wj(t.type)&&rCt.indexOf(t.type)>=0},sCt=function(t,n,s,i){var o,l=(o=zce==null?void 0:zce[i])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Ri(t)&&(i&&l.includes(n)||XSt.includes(n))||s&&Oye.includes(n)},Ti=function(t,n,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(P.isValidElement(t)&&(i=t.props),!g3(i))return null;var o={};return Object.keys(i).forEach(function(l){var a;sCt((a=i)===null||a===void 0?void 0:a[l],l,n,s)&&(o[l]=i[l])}),o},hfe=function e(t,n){if(t===n)return!0;var s=P.Children.count(t);if(s!==P.Children.count(n))return!1;if(s===0)return!0;if(s===1)return T4e(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function cCt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function pfe(e){var t=e.children,n=e.width,s=e.height,i=e.viewBox,o=e.className,l=e.style,a=e.title,h=e.desc,p=lCt(e,oCt),x=i||{width:n,height:s,x:0,y:0},y=ra("recharts-surface",o);return rt.createElement("svg",ffe({},Ti(p,!0,"svg"),{className:y,width:n,height:s,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),rt.createElement("title",null,a),rt.createElement("desc",null,h),t)}var dCt=["children","className"];function mfe(){return mfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function hCt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var ko=rt.forwardRef(function(e,t){var n=e.children,s=e.className,i=uCt(e,dCt),o=ra("recharts-layer",s);return rt.createElement("g",mfe({className:o},Ti(i,!0),{ref:t}),n)}),vm=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;oi?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++s=s?e:mCt(e,t,n)}var xCt=gCt,yCt="\\ud800-\\udfff",vCt="\\u0300-\\u036f",_Ct="\\ufe20-\\ufe2f",bCt="\\u20d0-\\u20ff",wCt=vCt+_Ct+bCt,jCt="\\ufe0e\\ufe0f",kCt="\\u200d",NCt=RegExp("["+kCt+yCt+wCt+jCt+"]");function SCt(e){return NCt.test(e)}var Qze=SCt;function CCt(e){return e.split("")}var MCt=CCt,Jze="\\ud800-\\udfff",TCt="\\u0300-\\u036f",ACt="\\ufe20-\\ufe2f",ECt="\\u20d0-\\u20ff",ICt=TCt+ACt+ECt,PCt="\\ufe0e\\ufe0f",LCt="["+Jze+"]",gfe="["+ICt+"]",xfe="\\ud83c[\\udffb-\\udfff]",OCt="(?:"+gfe+"|"+xfe+")",e7e="[^"+Jze+"]",t7e="(?:\\ud83c[\\udde6-\\uddff]){2}",r7e="[\\ud800-\\udbff][\\udc00-\\udfff]",DCt="\\u200d",n7e=OCt+"?",s7e="["+PCt+"]?",RCt="(?:"+DCt+"(?:"+[e7e,t7e,r7e].join("|")+")"+s7e+n7e+")*",FCt=s7e+n7e+RCt,zCt="(?:"+[e7e+gfe+"?",gfe,t7e,r7e,LCt].join("|")+")",BCt=RegExp(xfe+"(?="+xfe+")|"+zCt+FCt,"g");function $Ct(e){return e.match(BCt)||[]}var UCt=$Ct,qCt=MCt,VCt=Qze,HCt=UCt;function WCt(e){return VCt(e)?HCt(e):qCt(e)}var GCt=WCt,KCt=xCt,ZCt=Qze,YCt=GCt,XCt=Wze;function QCt(e){return function(t){t=XCt(t);var n=ZCt(t)?YCt(t):void 0,s=n?n[0]:t.charAt(0),i=n?KCt(n,1).join(""):t.slice(1);return s[e]()+i}}var JCt=QCt,e3t=JCt,t3t=e3t("toUpperCase"),r3t=t3t;const cie=za(r3t);function Go(e){return function(){return e}}const i7e=Math.cos,hre=Math.sin,Tm=Math.sqrt,fre=Math.PI,die=2*fre,yfe=Math.PI,vfe=2*yfe,Sw=1e-6,n3t=vfe-Sw;function a7e(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return a7e;const n=10**t;return function(s){this._+=s[0];for(let i=1,o=s.length;iSw)if(!(Math.abs(y*h-p*x)>Sw)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let j=s-l,S=i-a,C=h*h+p*p,A=j*j+S*S,E=Math.sqrt(C),T=Math.sqrt(w),O=o*Math.tan((yfe-Math.acos((C+w-A)/(2*E*T)))/2),z=O/T,F=O/E;Math.abs(z-1)>Sw&&this._append`L${t+z*x},${n+z*y}`,this._append`A${o},${o},0,0,${+(y*j>x*S)},${this._x1=t+F*h},${this._y1=n+F*p}`}}arc(t,n,s,i,o,l){if(t=+t,n=+n,s=+s,l=!!l,s<0)throw new Error(`negative radius: ${s}`);let a=s*Math.cos(i),h=s*Math.sin(i),p=t+a,x=n+h,y=1^l,w=l?i-o:o-i;this._x1===null?this._append`M${p},${x}`:(Math.abs(this._x1-p)>Sw||Math.abs(this._y1-x)>Sw)&&this._append`L${p},${x}`,s&&(w<0&&(w=w%vfe+vfe),w>n3t?this._append`A${s},${s},0,1,${y},${t-a},${n-h}A${s},${s},0,1,${y},${this._x1=p},${this._y1=x}`:w>Sw&&this._append`A${s},${s},0,${+(w>=yfe)},${y},${this._x1=t+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(t,n,s,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${s=+s}v${+i}h${-s}Z`}toString(){return this._}}function Rye(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);t=s}return e},()=>new i3t(t)}function Fye(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function o7e(e){this._context=e}o7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function uie(e){return new o7e(e)}function l7e(e){return e[0]}function c7e(e){return e[1]}function d7e(e,t){var n=Go(!0),s=null,i=uie,o=null,l=Rye(a);e=typeof e=="function"?e:e===void 0?l7e:Go(e),t=typeof t=="function"?t:t===void 0?c7e:Go(t);function a(h){var p,x=(h=Fye(h)).length,y,w=!1,j;for(s==null&&(o=i(j=l())),p=0;p<=x;++p)!(p=j;--S)a.point(O[S],z[S]);a.lineEnd(),a.areaEnd()}E&&(O[w]=+e(A,w,y),z[w]=+t(A,w,y),a.point(s?+s(A,w,y):O[w],n?+n(A,w,y):z[w]))}if(T)return a=null,T+""||null}function x(){return d7e().defined(i).curve(l).context(o)}return p.x=function(y){return arguments.length?(e=typeof y=="function"?y:Go(+y),s=null,p):e},p.x0=function(y){return arguments.length?(e=typeof y=="function"?y:Go(+y),p):e},p.x1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:Go(+y),p):s},p.y=function(y){return arguments.length?(t=typeof y=="function"?y:Go(+y),n=null,p):t},p.y0=function(y){return arguments.length?(t=typeof y=="function"?y:Go(+y),p):t},p.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:Go(+y),p):n},p.lineX0=p.lineY0=function(){return x().x(e).y(t)},p.lineY1=function(){return x().x(e).y(n)},p.lineX1=function(){return x().x(s).y(t)},p.defined=function(y){return arguments.length?(i=typeof y=="function"?y:Go(!!y),p):i},p.curve=function(y){return arguments.length?(l=y,o!=null&&(a=l(o)),p):l},p.context=function(y){return arguments.length?(y==null?o=a=null:a=l(o=y),p):o},p}class u7e{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function a3t(e){return new u7e(e,!0)}function o3t(e){return new u7e(e,!1)}const zye={draw(e,t){const n=Tm(t/fre);e.moveTo(n,0),e.arc(0,0,n,0,die)}},l3t={draw(e,t){const n=Tm(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},h7e=Tm(1/3),c3t=h7e*2,d3t={draw(e,t){const n=Tm(t/c3t),s=n*h7e;e.moveTo(0,-n),e.lineTo(s,0),e.lineTo(0,n),e.lineTo(-s,0),e.closePath()}},u3t={draw(e,t){const n=Tm(t),s=-n/2;e.rect(s,s,n,n)}},h3t=.8908130915292852,f7e=hre(fre/10)/hre(7*fre/10),f3t=hre(die/10)*f7e,p3t=-i7e(die/10)*f7e,m3t={draw(e,t){const n=Tm(t*h3t),s=f3t*n,i=p3t*n;e.moveTo(0,-n),e.lineTo(s,i);for(let o=1;o<5;++o){const l=die*o/5,a=i7e(l),h=hre(l);e.lineTo(h*n,-a*n),e.lineTo(a*s-h*i,h*s+a*i)}e.closePath()}},$ce=Tm(3),g3t={draw(e,t){const n=-Tm(t/($ce*3));e.moveTo(0,n*2),e.lineTo(-$ce*n,-n),e.lineTo($ce*n,-n),e.closePath()}},Nf=-.5,Sf=Tm(3)/2,_fe=1/Tm(12),x3t=(_fe/2+1)*3,y3t={draw(e,t){const n=Tm(t/x3t),s=n/2,i=n*_fe,o=s,l=n*_fe+n,a=-o,h=l;e.moveTo(s,i),e.lineTo(o,l),e.lineTo(a,h),e.lineTo(Nf*s-Sf*i,Sf*s+Nf*i),e.lineTo(Nf*o-Sf*l,Sf*o+Nf*l),e.lineTo(Nf*a-Sf*h,Sf*a+Nf*h),e.lineTo(Nf*s+Sf*i,Nf*i-Sf*s),e.lineTo(Nf*o+Sf*l,Nf*l-Sf*o),e.lineTo(Nf*a+Sf*h,Nf*h-Sf*a),e.closePath()}};function v3t(e,t){let n=null,s=Rye(i);e=typeof e=="function"?e:Go(e||zye),t=typeof t=="function"?t:Go(t===void 0?64:+t);function i(){let o;if(n||(n=o=s()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(e=typeof o=="function"?o:Go(o),i):e},i.size=function(o){return arguments.length?(t=typeof o=="function"?o:Go(+o),i):t},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function pre(){}function mre(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function p7e(e){this._context=e}p7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:mre(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:mre(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function _3t(e){return new p7e(e)}function m7e(e){this._context=e}m7e.prototype={areaStart:pre,areaEnd:pre,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:mre(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function b3t(e){return new m7e(e)}function g7e(e){this._context=e}g7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,s=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:mre(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function w3t(e){return new g7e(e)}function x7e(e){this._context=e}x7e.prototype={areaStart:pre,areaEnd:pre,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function j3t(e){return new x7e(e)}function E4e(e){return e<0?-1:1}function I4e(e,t,n){var s=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(s||i<0&&-0),l=(n-e._y1)/(i||s<0&&-0),a=(o*i+l*s)/(s+i);return(E4e(o)+E4e(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(a))||0}function P4e(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Uce(e,t,n){var s=e._x0,i=e._y0,o=e._x1,l=e._y1,a=(o-s)/3;e._context.bezierCurveTo(s+a,i+a*t,o-a,l-a*n,o,l)}function gre(e){this._context=e}gre.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Uce(this,this._t0,P4e(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Uce(this,P4e(this,n=I4e(this,e,t)),n);break;default:Uce(this,this._t0,n=I4e(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function y7e(e){this._context=new v7e(e)}(y7e.prototype=Object.create(gre.prototype)).point=function(e,t){gre.prototype.point.call(this,t,e)};function v7e(e){this._context=e}v7e.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,s,i,o){this._context.bezierCurveTo(t,e,s,n,o,i)}};function k3t(e){return new gre(e)}function N3t(e){return new y7e(e)}function _7e(e){this._context=e}_7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var s=L4e(e),i=L4e(t),o=0,l=1;l=0;--t)i[t]=(l[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function C3t(e){return new hie(e,.5)}function M3t(e){return new hie(e,0)}function T3t(e){return new hie(e,1)}function wC(e,t){if((l=e.length)>1)for(var n=1,s,i,o=e[t[0]],l,a=o.length;n=0;)n[t]=t;return n}function A3t(e,t){return e[t]}function E3t(e){const t=[];return t.key=e,t}function I3t(){var e=Go([]),t=bfe,n=wC,s=A3t;function i(o){var l=Array.from(e.apply(this,arguments),E3t),a,h=l.length,p=-1,x;for(const y of o)for(a=0,++p;a0){for(var n,s,i=0,o=e[0].length,l;i0){for(var n=0,s=e[t[0]],i,o=s.length;n0)||!((o=(i=e[t[0]]).length)>0))){for(var n=0,s=1,i,o,l;s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function $3t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var b7e={symbolCircle:zye,symbolCross:l3t,symbolDiamond:d3t,symbolSquare:u3t,symbolStar:m3t,symbolTriangle:g3t,symbolWye:y3t},U3t=Math.PI/180,q3t=function(t){var n="symbol".concat(cie(t));return b7e[n]||zye},V3t=function(t,n,s){if(n==="area")return t;switch(s){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*U3t;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},H3t=function(t,n){b7e["symbol".concat(cie(t))]=n},Bye=function(t){var n=t.type,s=n===void 0?"circle":n,i=t.size,o=i===void 0?64:i,l=t.sizeType,a=l===void 0?"area":l,h=B3t(t,D3t),p=D4e(D4e({},h),{},{type:s,size:o,sizeType:a}),x=function(){var A=q3t(s),E=v3t().type(A).size(V3t(o,a,s));return E()},y=p.className,w=p.cx,j=p.cy,S=Ti(p,!0);return w===+w&&j===+j&&o===+o?rt.createElement("path",wfe({},S,{className:ra("recharts-symbols",y),transform:"translate(".concat(w,", ").concat(j,")"),d:x()})):null};Bye.registerSymbol=H3t;function jC(e){"@babel/helpers - typeof";return jC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jC(e)}function jfe(){return jfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var T=j.inactive?p:j.color;return rt.createElement("li",jfe({className:A,style:y,key:"legend-item-".concat(S)},Gj(s.props,j,S)),rt.createElement(pfe,{width:l,height:l,viewBox:x,style:w},s.renderIcon(j)),rt.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},C?C(E,j,S):E))})}},{key:"render",value:function(){var s=this.props,i=s.payload,o=s.layout,l=s.align;if(!i||!i.length)return null;var a={padding:0,margin:0,textAlign:o==="horizontal"?l:"left"};return rt.createElement("ul",{className:"recharts-default-legend",style:a},this.renderItems())}}])}(P.PureComponent);xE($ye,"displayName","Legend");xE($ye,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var t5t=Yse;function r5t(){this.__data__=new t5t,this.size=0}var n5t=r5t;function s5t(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var i5t=s5t;function a5t(e){return this.__data__.get(e)}var o5t=a5t;function l5t(e){return this.__data__.has(e)}var c5t=l5t,d5t=Yse,u5t=Mye,h5t=Tye,f5t=200;function p5t(e,t){var n=this.__data__;if(n instanceof d5t){var s=n.__data__;if(!u5t||s.lengtha))return!1;var p=o.get(e),x=o.get(t);if(p&&x)return p==t&&x==e;var y=-1,w=!0,j=n&D5t?new I5t:void 0;for(o.set(e,t),o.set(t,e);++y-1&&e%1==0&&e-1&&e%1==0&&e<=BMt}var Hye=$Mt,UMt=my,qMt=Hye,VMt=gy,HMt="[object Arguments]",WMt="[object Array]",GMt="[object Boolean]",KMt="[object Date]",ZMt="[object Error]",YMt="[object Function]",XMt="[object Map]",QMt="[object Number]",JMt="[object Object]",eTt="[object RegExp]",tTt="[object Set]",rTt="[object String]",nTt="[object WeakMap]",sTt="[object ArrayBuffer]",iTt="[object DataView]",aTt="[object Float32Array]",oTt="[object Float64Array]",lTt="[object Int8Array]",cTt="[object Int16Array]",dTt="[object Int32Array]",uTt="[object Uint8Array]",hTt="[object Uint8ClampedArray]",fTt="[object Uint16Array]",pTt="[object Uint32Array]",dl={};dl[aTt]=dl[oTt]=dl[lTt]=dl[cTt]=dl[dTt]=dl[uTt]=dl[hTt]=dl[fTt]=dl[pTt]=!0;dl[HMt]=dl[WMt]=dl[sTt]=dl[GMt]=dl[iTt]=dl[KMt]=dl[ZMt]=dl[YMt]=dl[XMt]=dl[QMt]=dl[JMt]=dl[eTt]=dl[tTt]=dl[rTt]=dl[nTt]=!1;function mTt(e){return VMt(e)&&qMt(e.length)&&!!dl[UMt(e)]}var gTt=mTt;function xTt(e){return function(t){return e(t)}}var I7e=xTt,_re={exports:{}};_re.exports;(function(e,t){var n=Bze,s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===s,l=o&&n.process,a=function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}}();e.exports=a})(_re,_re.exports);var yTt=_re.exports,vTt=gTt,_Tt=I7e,q4e=yTt,V4e=q4e&&q4e.isTypedArray,bTt=V4e?_Tt(V4e):vTt,P7e=bTt,wTt=NMt,jTt=qye,kTt=jh,NTt=E7e,STt=Vye,CTt=P7e,MTt=Object.prototype,TTt=MTt.hasOwnProperty;function ATt(e,t){var n=kTt(e),s=!n&&jTt(e),i=!n&&!s&&NTt(e),o=!n&&!s&&!i&&CTt(e),l=n||s||i||o,a=l?wTt(e.length,String):[],h=a.length;for(var p in e)(t||TTt.call(e,p))&&!(l&&(p=="length"||i&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||STt(p,h)))&&a.push(p);return a}var ETt=ATt,ITt=Object.prototype;function PTt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ITt;return e===n}var LTt=PTt;function OTt(e,t){return function(n){return e(t(n))}}var L7e=OTt,DTt=L7e,RTt=DTt(Object.keys,Object),FTt=RTt,zTt=LTt,BTt=FTt,$Tt=Object.prototype,UTt=$Tt.hasOwnProperty;function qTt(e){if(!zTt(e))return BTt(e);var t=[];for(var n in Object(e))UTt.call(e,n)&&n!="constructor"&&t.push(n);return t}var VTt=qTt,HTt=Sye,WTt=Hye;function GTt(e){return e!=null&&WTt(e.length)&&!HTt(e)}var zI=GTt,KTt=ETt,ZTt=VTt,YTt=zI;function XTt(e){return YTt(e)?KTt(e):ZTt(e)}var fie=XTt,QTt=fMt,JTt=jMt,eAt=fie;function tAt(e){return QTt(e,eAt,JTt)}var rAt=tAt,H4e=rAt,nAt=1,sAt=Object.prototype,iAt=sAt.hasOwnProperty;function aAt(e,t,n,s,i,o){var l=n&nAt,a=H4e(e),h=a.length,p=H4e(t),x=p.length;if(h!=x&&!l)return!1;for(var y=h;y--;){var w=a[y];if(!(l?w in t:iAt.call(t,w)))return!1}var j=o.get(e),S=o.get(t);if(j&&S)return j==t&&S==e;var C=!0;o.set(e,t),o.set(t,e);for(var A=l;++y-1}var sIt=nIt;function iIt(e,t,n){for(var s=-1,i=e==null?0:e.length;++s=_It){var p=t?null:yIt(e);if(p)return vIt(p);l=!1,i=xIt,h=new pIt}else h=t?[]:a;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function DIt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function RIt(e){return e.value}function FIt(e,t){if(rt.isValidElement(e))return rt.cloneElement(e,t);if(typeof e=="function")return rt.createElement(e,t);t.ref;var n=OIt(t,CIt);return rt.createElement($ye,n)}var oSe=1,PS=function(e){function t(){var n;MIt(this,t);for(var s=arguments.length,i=new Array(s),o=0;ooSe||Math.abs(i.height-this.lastBoundingBox.height)>oSe)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,s&&s(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,s&&s(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?xx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var i=this.props,o=i.layout,l=i.align,a=i.verticalAlign,h=i.margin,p=i.chartWidth,x=i.chartHeight,y,w;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(l==="center"&&o==="vertical"){var j=this.getBBoxSnapshot();y={left:((p||0)-j.width)/2}}else y=l==="right"?{right:h&&h.right||0}:{left:h&&h.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(a==="middle"){var S=this.getBBoxSnapshot();w={top:((x||0)-S.height)/2}}else w=a==="bottom"?{bottom:h&&h.bottom||0}:{top:h&&h.top||0};return xx(xx({},y),w)}},{key:"render",value:function(){var s=this,i=this.props,o=i.content,l=i.width,a=i.height,h=i.wrapperStyle,p=i.payloadUniqBy,x=i.payload,y=xx(xx({position:"absolute",width:l||"auto",height:a||"auto"},this.getDefaultPosition(h)),h);return rt.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(j){s.wrapperNode=j}},FIt(o,xx(xx({},this.props),{},{payload:$7e(x,p,RIt)})))}}],[{key:"getWithHeight",value:function(s,i){var o=xx(xx({},this.defaultProps),s.props),l=o.layout;return l==="vertical"&&Dn(s.props.height)?{height:s.props.height}:l==="horizontal"?{width:s.props.width||i}:null}}])}(P.PureComponent);pie(PS,"displayName","Legend");pie(PS,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var lSe=DI,zIt=qye,BIt=jh,cSe=lSe?lSe.isConcatSpreadable:void 0;function $It(e){return BIt(e)||zIt(e)||!!(cSe&&e&&e[cSe])}var UIt=$It,qIt=T7e,VIt=UIt;function V7e(e,t,n,s,i){var o=-1,l=e.length;for(n||(n=VIt),i||(i=[]);++o0&&n(a)?t>1?V7e(a,t-1,n,s,i):qIt(i,a):s||(i[i.length]=a)}return i}var H7e=V7e;function HIt(e){return function(t,n,s){for(var i=-1,o=Object(t),l=s(t),a=l.length;a--;){var h=l[e?a:++i];if(n(o[h],h,o)===!1)break}return t}}var WIt=HIt,GIt=WIt,KIt=GIt(),ZIt=KIt,YIt=ZIt,XIt=fie;function QIt(e,t){return e&&YIt(e,t,XIt)}var W7e=QIt,JIt=zI;function ePt(e,t){return function(n,s){if(n==null)return n;if(!JIt(n))return e(n,s);for(var i=n.length,o=t?i:-1,l=Object(n);(t?o--:++ot||o&&l&&h&&!a&&!p||s&&l&&h||!n&&h||!i)return 1;if(!s&&!o&&!p&&e=a)return h;var p=n[s];return h*(p=="desc"?-1:1)}}return e.index-t.index}var pPt=fPt,Wce=Eye,mPt=Iye,gPt=Ug,xPt=G7e,yPt=cPt,vPt=I7e,_Pt=pPt,bPt=w3,wPt=jh;function jPt(e,t,n){t.length?t=Wce(t,function(o){return wPt(o)?function(l){return mPt(l,o.length===1?o[0]:o)}:o}):t=[bPt];var s=-1;t=Wce(t,vPt(gPt));var i=xPt(e,function(o,l,a){var h=Wce(t,function(p){return p(o)});return{criteria:h,index:++s,value:o}});return yPt(i,function(o,l){return _Pt(o,l,n)})}var kPt=jPt;function NPt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var SPt=NPt,CPt=SPt,uSe=Math.max;function MPt(e,t,n){return t=uSe(t===void 0?e.length-1:t,0),function(){for(var s=arguments,i=-1,o=uSe(s.length-t,0),l=Array(o);++i0){if(++t>=FPt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var UPt=$Pt,qPt=RPt,VPt=UPt,HPt=VPt(qPt),WPt=HPt,GPt=w3,KPt=TPt,ZPt=WPt;function YPt(e,t){return ZPt(KPt(e,t,GPt),e+"")}var XPt=YPt,QPt=Cye,JPt=zI,e6t=Vye,t6t=lv;function r6t(e,t,n){if(!t6t(n))return!1;var s=typeof t;return(s=="number"?JPt(n)&&e6t(t,n.length):s=="string"&&t in n)?QPt(n[t],e):!1}var mie=r6t,n6t=H7e,s6t=kPt,i6t=XPt,fSe=mie,a6t=i6t(function(e,t){if(e==null)return[];var n=t.length;return n>1&&fSe(e,t[0],t[1])?t=[]:n>2&&fSe(t[0],t[1],t[2])&&(t=[t[0]]),s6t(e,n6t(t,1),[])}),o6t=a6t;const Kye=za(o6t);function yE(e){"@babel/helpers - typeof";return yE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yE(e)}function Efe(){return Efe=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=t.x),"".concat(HM,"-left"),Dn(n)&&t&&Dn(t.x)&&n=t.y),"".concat(HM,"-top"),Dn(s)&&t&&Dn(t.y)&&sC?Math.max(x,h[s]):Math.max(y,h[s])}function w6t(e){var t=e.translateX,n=e.translateY,s=e.useTranslate3d;return{transform:s?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function j6t(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipBox,a=e.useTranslate3d,h=e.viewBox,p,x,y;return l.height>0&&l.width>0&&n?(x=gSe({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:l.width,viewBox:h,viewBoxDimension:h.width}),y=gSe({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:l.height,viewBox:h,viewBoxDimension:h.height}),p=w6t({translateX:x,translateY:y,useTranslate3d:a})):p=_6t,{cssProperties:p,cssClasses:b6t({translateX:x,translateY:y,coordinate:n})}}function NC(e){"@babel/helpers - typeof";return NC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},NC(e)}function xSe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function ySe(e){for(var t=1;tvSe||Math.abs(s.height-this.state.lastBoundingBox.height)>vSe)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,i=this.props,o=i.active,l=i.allowEscapeViewBox,a=i.animationDuration,h=i.animationEasing,p=i.children,x=i.coordinate,y=i.hasPayload,w=i.isAnimationActive,j=i.offset,S=i.position,C=i.reverseDirection,A=i.useTranslate3d,E=i.viewBox,T=i.wrapperStyle,O=j6t({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:j,position:S,reverseDirection:C,tooltipBox:this.state.lastBoundingBox,useTranslate3d:A,viewBox:E}),z=O.cssClasses,F=O.cssProperties,q=ySe(ySe({transition:w&&o?"transform ".concat(a,"ms ").concat(h):void 0},F),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},T);return rt.createElement("div",{tabIndex:-1,className:z,style:q,ref:function(K){s.wrapperNode=K}},p)}}])}(P.PureComponent),P6t=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},j3={isSsr:P6t()};function SC(e){"@babel/helpers - typeof";return SC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},SC(e)}function _Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function bSe(e){for(var t=1;t0;return rt.createElement(I6t,{allowEscapeViewBox:l,animationDuration:a,animationEasing:h,isAnimationActive:w,active:o,coordinate:x,hasPayload:q,offset:j,position:A,reverseDirection:E,useTranslate3d:T,viewBox:O,wrapperStyle:z},q6t(p,bSe(bSe({},this.props),{},{payload:F})))}}])}(P.PureComponent);Zye(Qp,"displayName","Tooltip");Zye(Qp,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!j3.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var V6t=$g,H6t=function(){return V6t.Date.now()},W6t=H6t,G6t=/\s/;function K6t(e){for(var t=e.length;t--&&G6t.test(e.charAt(t)););return t}var Z6t=K6t,Y6t=Z6t,X6t=/^\s+/;function Q6t(e){return e&&e.slice(0,Y6t(e)+1).replace(X6t,"")}var J6t=Q6t,eLt=J6t,wSe=lv,tLt=m3,jSe=NaN,rLt=/^[-+]0x[0-9a-f]+$/i,nLt=/^0b[01]+$/i,sLt=/^0o[0-7]+$/i,iLt=parseInt;function aLt(e){if(typeof e=="number")return e;if(tLt(e))return jSe;if(wSe(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=wSe(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=eLt(e);var n=nLt.test(e);return n||sLt.test(e)?iLt(e.slice(2),n?2:8):rLt.test(e)?jSe:+e}var J7e=aLt,oLt=lv,Kce=W6t,kSe=J7e,lLt="Expected a function",cLt=Math.max,dLt=Math.min;function uLt(e,t,n){var s,i,o,l,a,h,p=0,x=!1,y=!1,w=!0;if(typeof e!="function")throw new TypeError(lLt);t=kSe(t)||0,oLt(n)&&(x=!!n.leading,y="maxWait"in n,o=y?cLt(kSe(n.maxWait)||0,t):o,w="trailing"in n?!!n.trailing:w);function j(q){var H=s,K=i;return s=i=void 0,p=q,l=e.apply(K,H),l}function S(q){return p=q,a=setTimeout(E,t),x?j(q):l}function C(q){var H=q-h,K=q-p,Z=t-H;return y?dLt(Z,o-K):Z}function A(q){var H=q-h,K=q-p;return h===void 0||H>=t||H<0||y&&K>=o}function E(){var q=Kce();if(A(q))return T(q);a=setTimeout(E,C(q))}function T(q){return a=void 0,w&&s?j(q):(s=i=void 0,l)}function O(){a!==void 0&&clearTimeout(a),p=0,s=h=i=a=void 0}function z(){return a===void 0?l:T(Kce())}function F(){var q=Kce(),H=A(q);if(s=arguments,i=this,h=q,H){if(a===void 0)return S(h);if(y)return clearTimeout(a),a=setTimeout(E,t),j(h)}return a===void 0&&(a=setTimeout(E,t)),l}return F.cancel=O,F.flush=z,F}var hLt=uLt,fLt=hLt,pLt=lv,mLt="Expected a function";function gLt(e,t,n){var s=!0,i=!0;if(typeof e!="function")throw new TypeError(mLt);return pLt(n)&&(s="leading"in n?!!n.leading:s,i="trailing"in n?!!n.trailing:i),fLt(e,t,{leading:s,maxWait:t,trailing:i})}var xLt=gLt;const e9e=za(xLt);function _E(e){"@babel/helpers - typeof";return _E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_E(e)}function NSe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function UL(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&(be=e9e(be,C,{trailing:!0,leading:!1}));var ne=new ResizeObserver(be),ye=F.current.getBoundingClientRect(),ie=ye.width,fe=ye.height;return ue(ie,fe),ne.observe(F.current),function(){ne.disconnect()}},[ue,C]);var he=P.useMemo(function(){var be=Z.containerWidth,ne=Z.containerHeight;if(be<0||ne<0)return null;vm(Vw(l)||Vw(h),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,h),vm(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ye=Vw(l)?be:l,ie=Vw(h)?ne:h;n&&n>0&&(ye?ie=ye/n:ie&&(ye=ie*n),w&&ie>w&&(ie=w)),vm(ye>0||ie>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,ye,ie,l,h,x,y,n);var fe=!Array.isArray(j)&&Yx(j.type).endsWith("Chart");return rt.Children.map(j,function(de){return rt.isValidElement(de)?P.cloneElement(de,UL({width:ye,height:ie},fe?{style:UL({height:"100%",width:"100%",maxHeight:ie,maxWidth:ye},de.props.style)}:{})):de})},[n,j,h,w,y,x,Z,l]);return rt.createElement("div",{id:A?"".concat(A):void 0,className:ra("recharts-responsive-container",E),style:UL(UL({},z),{},{width:l,height:h,minWidth:x,minHeight:y,maxHeight:w}),ref:F},he)}),gie=function(t){return null};gie.displayName="Cell";function bE(e){"@babel/helpers - typeof";return bE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bE(e)}function CSe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Dfe(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||j3.isSsr)return{width:0,height:0};var s=ELt(n),i=JSON.stringify({text:t,copyStyle:s});if(c4.widthCache[i])return c4.widthCache[i];try{var o=document.getElementById(MSe);o||(o=document.createElement("span"),o.setAttribute("id",MSe),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Dfe(Dfe({},ALt),s);Object.assign(o.style,l),o.textContent="".concat(t);var a=o.getBoundingClientRect(),h={width:a.width,height:a.height};return c4.widthCache[i]=h,++c4.cacheCount>TLt&&(c4.cacheCount=0,c4.widthCache={}),h}catch{return{width:0,height:0}}},ILt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function wE(e){"@babel/helpers - typeof";return wE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wE(e)}function kre(e,t){return DLt(e)||OLt(e,t)||LLt(e,t)||PLt()}function PLt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LLt(e,t){if(e){if(typeof e=="string")return TSe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return TSe(e,t)}}function TSe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function YLt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function OSe(e,t){return e8t(e)||JLt(e,t)||QLt(e,t)||XLt()}function XLt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QLt(e,t){if(e){if(typeof e=="string")return DSe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return DSe(e,t)}}function DSe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return ye.reduce(function(ie,fe){var de=fe.word,_e=fe.width,Ee=ie[ie.length-1];if(Ee&&(i==null||o||Ee.width+_e+sfe.width?ie:fe})};if(!x)return j;for(var C="…",A=function(ye){var ie=y.slice(0,ye),fe=s9e({breakAll:p,style:h,children:ie+C}).wordsWithComputedWidth,de=w(fe),_e=de.length>l||S(de).width>Number(i);return[_e,de]},E=0,T=y.length-1,O=0,z;E<=T&&O<=y.length-1;){var F=Math.floor((E+T)/2),q=F-1,H=A(q),K=OSe(H,2),Z=K[0],re=K[1],ue=A(F),he=OSe(ue,1),be=he[0];if(!Z&&!be&&(E=F+1),Z&&be&&(T=F-1),!Z&&be){z=re;break}O++}return z||j},RSe=function(t){var n=_a(t)?[]:t.toString().split(n9e);return[{words:n}]},r8t=function(t){var n=t.width,s=t.scaleToFit,i=t.children,o=t.style,l=t.breakAll,a=t.maxLines;if((n||s)&&!j3.isSsr){var h,p,x=s9e({breakAll:l,children:i,style:o});if(x){var y=x.wordsWithComputedWidth,w=x.spaceWidth;h=y,p=w}else return RSe(i);return t8t({breakAll:l,children:i,maxLines:a,style:o},h,p,n,s)}return RSe(i)},FSe="#808080",Kj=function(t){var n=t.x,s=n===void 0?0:n,i=t.y,o=i===void 0?0:i,l=t.lineHeight,a=l===void 0?"1em":l,h=t.capHeight,p=h===void 0?"0.71em":h,x=t.scaleToFit,y=x===void 0?!1:x,w=t.textAnchor,j=w===void 0?"start":w,S=t.verticalAnchor,C=S===void 0?"end":S,A=t.fill,E=A===void 0?FSe:A,T=LSe(t,KLt),O=P.useMemo(function(){return r8t({breakAll:T.breakAll,children:T.children,maxLines:T.maxLines,scaleToFit:y,style:T.style,width:T.width})},[T.breakAll,T.children,T.maxLines,y,T.style,T.width]),z=T.dx,F=T.dy,q=T.angle,H=T.className,K=T.breakAll,Z=LSe(T,ZLt);if(!Uc(s)||!Uc(o))return null;var re=s+(Dn(z)?z:0),ue=o+(Dn(F)?F:0),he;switch(C){case"start":he=Zce("calc(".concat(p,")"));break;case"middle":he=Zce("calc(".concat((O.length-1)/2," * -").concat(a," + (").concat(p," / 2))"));break;default:he=Zce("calc(".concat(O.length-1," * -").concat(a,")"));break}var be=[];if(y){var ne=O[0].width,ye=T.width;be.push("scale(".concat((Dn(ye)?ye/ne:1)/ne,")"))}return q&&be.push("rotate(".concat(q,", ").concat(re,", ").concat(ue,")")),be.length&&(Z.transform=be.join(" ")),rt.createElement("text",Rfe({},Ti(Z,!0),{x:re,y:ue,className:ra("recharts-text",H),textAnchor:j,fill:E.includes("url")?FSe:E}),O.map(function(ie,fe){var de=ie.words.join(K?"":" ");return rt.createElement("tspan",{x:re,dy:fe===0?he:a,key:"".concat(de,"-").concat(fe)},de)}))};function T1(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function n8t(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Yye(e){let t,n,s;e.length!==2?(t=T1,n=(a,h)=>T1(e(a),h),s=(a,h)=>e(a)-h):(t=e===T1||e===n8t?e:s8t,n=e,s=e);function i(a,h,p=0,x=a.length){if(p>>1;n(a[y],h)<0?p=y+1:x=y}while(p>>1;n(a[y],h)<=0?p=y+1:x=y}while(pp&&s(a[y-1],h)>-s(a[y],h)?y-1:y}return{left:i,center:l,right:o}}function s8t(){return 0}function i9e(e){return e===null?NaN:+e}function*i8t(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const a8t=Yye(T1),BI=a8t.right;Yye(i9e).center;class zSe extends Map{constructor(t,n=c8t){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[s,i]of t)this.set(s,i)}get(t){return super.get(BSe(this,t))}has(t){return super.has(BSe(this,t))}set(t,n){return super.set(o8t(this,t),n)}delete(t){return super.delete(l8t(this,t))}}function BSe({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function o8t({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function l8t({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function c8t(e){return e!==null&&typeof e=="object"?e.valueOf():e}function d8t(e=T1){if(e===T1)return a9e;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const s=e(t,n);return s||s===0?s:(e(n,n)===0)-(e(t,t)===0)}}function a9e(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const u8t=Math.sqrt(50),h8t=Math.sqrt(10),f8t=Math.sqrt(2);function Nre(e,t,n){const s=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(s)),o=s/Math.pow(10,i),l=o>=u8t?10:o>=h8t?5:o>=f8t?2:1;let a,h,p;return i<0?(p=Math.pow(10,-i)/l,a=Math.round(e*p),h=Math.round(t*p),a/pt&&--h,p=-p):(p=Math.pow(10,i)*l,a=Math.round(e/p),h=Math.round(t/p),a*pt&&--h),h0))return[];if(e===t)return[e];const s=t=i))return[];const a=o-i+1,h=new Array(a);if(s)if(l<0)for(let p=0;p=s)&&(n=s);return n}function USe(e,t){let n;for(const s of e)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function o9e(e,t,n=0,s=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),s=Math.floor(Math.min(e.length-1,s)),!(n<=t&&t<=s))return e;for(i=i===void 0?a9e:d8t(i);s>n;){if(s-n>600){const h=s-n+1,p=t-n+1,x=Math.log(h),y=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*y*(h-y)/h)*(p-h/2<0?-1:1),j=Math.max(n,Math.floor(t-p*y/h+w)),S=Math.min(s,Math.floor(t+(h-p)*y/h+w));o9e(e,t,j,S,i)}const o=e[t];let l=n,a=s;for(WM(e,n,t),i(e[s],o)>0&&WM(e,n,s);l0;)--a}i(e[n],o)===0?WM(e,n,a):(++a,WM(e,a,s)),a<=t&&(n=a+1),t<=a&&(s=a-1)}return e}function WM(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function p8t(e,t,n){if(e=Float64Array.from(i8t(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return USe(e);if(t>=1)return $Se(e);var s,i=(s-1)*t,o=Math.floor(i),l=$Se(o9e(e,o).subarray(0,o+1)),a=USe(e.subarray(o+1));return l+(a-l)*(i-o)}}function m8t(e,t,n=i9e){if(!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return+n(e[0],0,e);if(t>=1)return+n(e[s-1],s-1,e);var s,i=(s-1)*t,o=Math.floor(i),l=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return l+(a-l)*(i-o)}}function g8t(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var s=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?VL(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?VL(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=y8t.exec(e))?new hh(t[1],t[2],t[3],1):(t=v8t.exec(e))?new hh(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=_8t.exec(e))?VL(t[1],t[2],t[3],t[4]):(t=b8t.exec(e))?VL(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=w8t.exec(e))?ZSe(t[1],t[2]/100,t[3]/100,1):(t=j8t.exec(e))?ZSe(t[1],t[2]/100,t[3]/100,t[4]):qSe.hasOwnProperty(e)?WSe(qSe[e]):e==="transparent"?new hh(NaN,NaN,NaN,0):null}function WSe(e){return new hh(e>>16&255,e>>8&255,e&255,1)}function VL(e,t,n,s){return s<=0&&(e=t=n=NaN),new hh(e,t,n,s)}function S8t(e){return e instanceof $I||(e=SE(e)),e?(e=e.rgb(),new hh(e.r,e.g,e.b,e.opacity)):new hh}function Ufe(e,t,n,s){return arguments.length===1?S8t(e):new hh(e,t,n,s??1)}function hh(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Qye(hh,Ufe,c9e($I,{brighter(e){return e=e==null?Sre:Math.pow(Sre,e),new hh(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kE:Math.pow(kE,e),new hh(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hh(Nj(this.r),Nj(this.g),Nj(this.b),Cre(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:GSe,formatHex:GSe,formatHex8:C8t,formatRgb:KSe,toString:KSe}));function GSe(){return`#${Hw(this.r)}${Hw(this.g)}${Hw(this.b)}`}function C8t(){return`#${Hw(this.r)}${Hw(this.g)}${Hw(this.b)}${Hw((isNaN(this.opacity)?1:this.opacity)*255)}`}function KSe(){const e=Cre(this.opacity);return`${e===1?"rgb(":"rgba("}${Nj(this.r)}, ${Nj(this.g)}, ${Nj(this.b)}${e===1?")":`, ${e})`}`}function Cre(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Nj(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hw(e){return e=Nj(e),(e<16?"0":"")+e.toString(16)}function ZSe(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sm(e,t,n,s)}function d9e(e){if(e instanceof sm)return new sm(e.h,e.s,e.l,e.opacity);if(e instanceof $I||(e=SE(e)),!e)return new sm;if(e instanceof sm)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),o=Math.max(t,n,s),l=NaN,a=o-i,h=(o+i)/2;return a?(t===o?l=(n-s)/a+(n0&&h<1?0:l,new sm(l,a,h,e.opacity)}function M8t(e,t,n,s){return arguments.length===1?d9e(e):new sm(e,t,n,s??1)}function sm(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Qye(sm,M8t,c9e($I,{brighter(e){return e=e==null?Sre:Math.pow(Sre,e),new sm(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kE:Math.pow(kE,e),new sm(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new hh(Yce(e>=240?e-240:e+120,i,s),Yce(e,i,s),Yce(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new sm(YSe(this.h),HL(this.s),HL(this.l),Cre(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Cre(this.opacity);return`${e===1?"hsl(":"hsla("}${YSe(this.h)}, ${HL(this.s)*100}%, ${HL(this.l)*100}%${e===1?")":`, ${e})`}`}}));function YSe(e){return e=(e||0)%360,e<0?e+360:e}function HL(e){return Math.max(0,Math.min(1,e||0))}function Yce(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Jye=e=>()=>e;function T8t(e,t){return function(n){return e+n*t}}function A8t(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function E8t(e){return(e=+e)==1?u9e:function(t,n){return n-t?A8t(t,n,e):Jye(isNaN(t)?n:t)}}function u9e(e,t){var n=t-e;return n?T8t(e,n):Jye(isNaN(e)?t:e)}const XSe=function e(t){var n=E8t(t);function s(i,o){var l=n((i=Ufe(i)).r,(o=Ufe(o)).r),a=n(i.g,o.g),h=n(i.b,o.b),p=u9e(i.opacity,o.opacity);return function(x){return i.r=l(x),i.g=a(x),i.b=h(x),i.opacity=p(x),i+""}}return s.gamma=e,s}(1);function I8t(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),a[l]?a[l]+=o:a[++l]=o),(s=s[0])===(i=i[0])?a[l]?a[l]+=i:a[++l]=i:(a[++l]=null,h.push({i:l,x:Mre(s,i)})),n=Xce.lastIndex;return nt&&(n=e,e=t,t=n),function(s){return Math.max(e,Math.min(t,s))}}function q8t(e,t,n){var s=e[0],i=e[1],o=t[0],l=t[1];return i2?V8t:q8t,h=p=null,y}function y(w){return w==null||isNaN(w=+w)?o:(h||(h=a(e.map(s),t,n)))(s(l(w)))}return y.invert=function(w){return l(i((p||(p=a(t,e.map(s),Mre)))(w)))},y.domain=function(w){return arguments.length?(e=Array.from(w,Tre),x()):e.slice()},y.range=function(w){return arguments.length?(t=Array.from(w),x()):t.slice()},y.rangeRound=function(w){return t=Array.from(w),n=e0e,x()},y.clamp=function(w){return arguments.length?(l=w?!0:Au,x()):l!==Au},y.interpolate=function(w){return arguments.length?(n=w,x()):n},y.unknown=function(w){return arguments.length?(o=w,y):o},function(w,j){return s=w,i=j,x()}}function t0e(){return xie()(Au,Au)}function H8t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Are(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,s=e.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+e.slice(n+1)]}function CC(e){return e=Are(Math.abs(e)),e?e[1]:NaN}function W8t(e,t){return function(n,s){for(var i=n.length,o=[],l=0,a=e[0],h=0;i>0&&a>0&&(h+a+1>s&&(a=Math.max(1,s-h)),o.push(n.substring(i-=a,i+a)),!((h+=a+1)>s));)a=e[l=(l+1)%e.length];return o.reverse().join(t)}}function G8t(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var K8t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function CE(e){if(!(t=K8t.exec(e)))throw new Error("invalid format: "+e);var t;return new r0e({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}CE.prototype=r0e.prototype;function r0e(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}r0e.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Z8t(e){e:for(var t=e.length,n=1,s=-1,i;n0&&(s=0);break}return s>0?e.slice(0,s)+e.slice(i+1):e}var h9e;function Y8t(e,t){var n=Are(e,t);if(!n)return e+"";var s=n[0],i=n[1],o=i-(h9e=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=s.length;return o===l?s:o>l?s+new Array(o-l+1).join("0"):o>0?s.slice(0,o)+"."+s.slice(o):"0."+new Array(1-o).join("0")+Are(e,Math.max(0,t+o-1))[0]}function JSe(e,t){var n=Are(e,t);if(!n)return e+"";var s=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+s:s.length>i+1?s.slice(0,i+1)+"."+s.slice(i+1):s+new Array(i-s.length+2).join("0")}const eCe={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:H8t,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>JSe(e*100,t),r:JSe,s:Y8t,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function tCe(e){return e}var rCe=Array.prototype.map,nCe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function X8t(e){var t=e.grouping===void 0||e.thousands===void 0?tCe:W8t(rCe.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",s=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?tCe:G8t(rCe.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",h=e.nan===void 0?"NaN":e.nan+"";function p(y){y=CE(y);var w=y.fill,j=y.align,S=y.sign,C=y.symbol,A=y.zero,E=y.width,T=y.comma,O=y.precision,z=y.trim,F=y.type;F==="n"?(T=!0,F="g"):eCe[F]||(O===void 0&&(O=12),z=!0,F="g"),(A||w==="0"&&j==="=")&&(A=!0,w="0",j="=");var q=C==="$"?n:C==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",H=C==="$"?s:/[%p]/.test(F)?l:"",K=eCe[F],Z=/[defgprs%]/.test(F);O=O===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,O)):Math.max(0,Math.min(20,O));function re(ue){var he=q,be=H,ne,ye,ie;if(F==="c")be=K(ue)+be,ue="";else{ue=+ue;var fe=ue<0||1/ue<0;if(ue=isNaN(ue)?h:K(Math.abs(ue),O),z&&(ue=Z8t(ue)),fe&&+ue==0&&S!=="+"&&(fe=!1),he=(fe?S==="("?S:a:S==="-"||S==="("?"":S)+he,be=(F==="s"?nCe[8+h9e/3]:"")+be+(fe&&S==="("?")":""),Z){for(ne=-1,ye=ue.length;++neie||ie>57){be=(ie===46?i+ue.slice(ne+1):ue.slice(ne))+be,ue=ue.slice(0,ne);break}}}T&&!A&&(ue=t(ue,1/0));var de=he.length+ue.length+be.length,_e=de>1)+he+ue+be+_e.slice(de);break;default:ue=_e+he+ue+be;break}return o(ue)}return re.toString=function(){return y+""},re}function x(y,w){var j=p((y=CE(y),y.type="f",y)),S=Math.max(-8,Math.min(8,Math.floor(CC(w)/3)))*3,C=Math.pow(10,-S),A=nCe[8+S/3];return function(E){return j(C*E)+A}}return{format:p,formatPrefix:x}}var WL,n0e,f9e;Q8t({thousands:",",grouping:[3],currency:["$",""]});function Q8t(e){return WL=X8t(e),n0e=WL.format,f9e=WL.formatPrefix,WL}function J8t(e){return Math.max(0,-CC(Math.abs(e)))}function eOt(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(CC(t)/3)))*3-CC(Math.abs(e)))}function tOt(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,CC(t)-CC(e))+1}function p9e(e,t,n,s){var i=Bfe(e,t,n),o;switch(s=CE(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(o=eOt(i,l))&&(s.precision=o),f9e(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=tOt(i,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=J8t(i))&&(s.precision=o-(s.type==="%")*2);break}}return n0e(s)}function cv(e){var t=e.domain;return e.ticks=function(n){var s=t();return Ffe(s[0],s[s.length-1],n??10)},e.tickFormat=function(n,s){var i=t();return p9e(i[0],i[i.length-1],n??10,s)},e.nice=function(n){n==null&&(n=10);var s=t(),i=0,o=s.length-1,l=s[i],a=s[o],h,p,x=10;for(a0;){if(p=zfe(l,a,n),p===h)return s[i]=l,s[o]=a,t(s);if(p>0)l=Math.floor(l/p)*p,a=Math.ceil(a/p)*p;else if(p<0)l=Math.ceil(l*p)/p,a=Math.floor(a*p)/p;else break;h=p}return e},e}function Ere(){var e=t0e();return e.copy=function(){return UI(e,Ere())},cp.apply(e,arguments),cv(e)}function m9e(e){var t;function n(s){return s==null||isNaN(s=+s)?t:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(e=Array.from(s,Tre),n):e.slice()},n.unknown=function(s){return arguments.length?(t=s,n):t},n.copy=function(){return m9e(e).unknown(t)},e=arguments.length?Array.from(e,Tre):[0,1],cv(n)}function g9e(e,t){e=e.slice();var n=0,s=e.length-1,i=e[n],o=e[s],l;return oMath.pow(e,t)}function aOt(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function aCe(e){return(t,n)=>-e(-t,n)}function s0e(e){const t=e(sCe,iCe),n=t.domain;let s=10,i,o;function l(){return i=aOt(s),o=iOt(s),n()[0]<0?(i=aCe(i),o=aCe(o),e(rOt,nOt)):e(sCe,iCe),t}return t.base=function(a){return arguments.length?(s=+a,l()):s},t.domain=function(a){return arguments.length?(n(a),l()):n()},t.ticks=a=>{const h=n();let p=h[0],x=h[h.length-1];const y=x0){for(;w<=j;++w)for(S=1;Sx)break;E.push(C)}}else for(;w<=j;++w)for(S=s-1;S>=1;--S)if(C=w>0?S/o(-w):S*o(w),!(Cx)break;E.push(C)}E.length*2{if(a==null&&(a=10),h==null&&(h=s===10?"s":","),typeof h!="function"&&(!(s%1)&&(h=CE(h)).precision==null&&(h.trim=!0),h=n0e(h)),a===1/0)return h;const p=Math.max(1,s*a/t.ticks().length);return x=>{let y=x/o(Math.round(i(x)));return y*sn(g9e(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function x9e(){const e=s0e(xie()).domain([1,10]);return e.copy=()=>UI(e,x9e()).base(e.base()),cp.apply(e,arguments),e}function oCe(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function lCe(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function i0e(e){var t=1,n=e(oCe(t),lCe(t));return n.constant=function(s){return arguments.length?e(oCe(t=+s),lCe(t)):t},cv(n)}function y9e(){var e=i0e(xie());return e.copy=function(){return UI(e,y9e()).constant(e.constant())},cp.apply(e,arguments)}function cCe(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function oOt(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function lOt(e){return e<0?-e*e:e*e}function a0e(e){var t=e(Au,Au),n=1;function s(){return n===1?e(Au,Au):n===.5?e(oOt,lOt):e(cCe(n),cCe(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,s()):n},cv(t)}function o0e(){var e=a0e(xie());return e.copy=function(){return UI(e,o0e()).exponent(e.exponent())},cp.apply(e,arguments),e}function cOt(){return o0e.apply(null,arguments).exponent(.5)}function dCe(e){return Math.sign(e)*e*e}function dOt(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function v9e(){var e=t0e(),t=[0,1],n=!1,s;function i(o){var l=dOt(e(o));return isNaN(l)?s:n?Math.round(l):l}return i.invert=function(o){return e.invert(dCe(o))},i.domain=function(o){return arguments.length?(e.domain(o),i):e.domain()},i.range=function(o){return arguments.length?(e.range((t=Array.from(o,Tre)).map(dCe)),i):t.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(e.clamp(o),i):e.clamp()},i.unknown=function(o){return arguments.length?(s=o,i):s},i.copy=function(){return v9e(e.domain(),t).round(n).clamp(e.clamp()).unknown(s)},cp.apply(i,arguments),cv(i)}function _9e(){var e=[],t=[],n=[],s;function i(){var l=0,a=Math.max(1,t.length);for(n=new Array(a-1);++l0?n[a-1]:e[0],a=n?[s[n-1],t]:[s[p-1],s[p]]},l.unknown=function(h){return arguments.length&&(o=h),l},l.thresholds=function(){return s.slice()},l.copy=function(){return b9e().domain([e,t]).range(i).unknown(o)},cp.apply(cv(l),arguments)}function w9e(){var e=[.5],t=[0,1],n,s=1;function i(o){return o!=null&&o<=o?t[BI(e,o,0,s)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),s=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),s=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var l=t.indexOf(o);return[e[l-1],e[l]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return w9e().domain(e).range(t).unknown(n)},cp.apply(i,arguments)}const Qce=new Date,Jce=new Date;function Gc(e,t,n,s){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const l=i(o),a=i.ceil(o);return o-l(t(o=new Date(+o),l==null?1:Math.floor(l)),o),i.range=(o,l,a)=>{const h=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o0))return h;let p;do h.push(p=new Date(+o)),t(o,a),e(o);while(pGc(l=>{if(l>=l)for(;e(l),!o(l);)l.setTime(l-1)},(l,a)=>{if(l>=l)if(a<0)for(;++a<=0;)for(;t(l,-1),!o(l););else for(;--a>=0;)for(;t(l,1),!o(l););}),n&&(i.count=(o,l)=>(Qce.setTime(+o),Jce.setTime(+l),e(Qce),e(Jce),Math.floor(n(Qce,Jce))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(s?l=>s(l)%o===0:l=>i.count(0,l)%o===0):i)),i}const Ire=Gc(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ire.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Gc(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ire);Ire.range;const Ox=1e3,$f=Ox*60,Dx=$f*60,oy=Dx*24,l0e=oy*7,uCe=oy*30,ede=oy*365,Ww=Gc(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ox)},(e,t)=>(t-e)/Ox,e=>e.getUTCSeconds());Ww.range;const c0e=Gc(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ox)},(e,t)=>{e.setTime(+e+t*$f)},(e,t)=>(t-e)/$f,e=>e.getMinutes());c0e.range;const d0e=Gc(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*$f)},(e,t)=>(t-e)/$f,e=>e.getUTCMinutes());d0e.range;const u0e=Gc(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ox-e.getMinutes()*$f)},(e,t)=>{e.setTime(+e+t*Dx)},(e,t)=>(t-e)/Dx,e=>e.getHours());u0e.range;const h0e=Gc(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Dx)},(e,t)=>(t-e)/Dx,e=>e.getUTCHours());h0e.range;const qI=Gc(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*$f)/oy,e=>e.getDate()-1);qI.range;const yie=Gc(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/oy,e=>e.getUTCDate()-1);yie.range;const j9e=Gc(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/oy,e=>Math.floor(e/oy));j9e.range;function ok(e){return Gc(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*$f)/l0e)}const vie=ok(0),Pre=ok(1),uOt=ok(2),hOt=ok(3),MC=ok(4),fOt=ok(5),pOt=ok(6);vie.range;Pre.range;uOt.range;hOt.range;MC.range;fOt.range;pOt.range;function lk(e){return Gc(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/l0e)}const _ie=lk(0),Lre=lk(1),mOt=lk(2),gOt=lk(3),TC=lk(4),xOt=lk(5),yOt=lk(6);_ie.range;Lre.range;mOt.range;gOt.range;TC.range;xOt.range;yOt.range;const f0e=Gc(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());f0e.range;const p0e=Gc(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());p0e.range;const ly=Gc(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());ly.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gc(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});ly.range;const cy=Gc(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());cy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gc(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});cy.range;function k9e(e,t,n,s,i,o){const l=[[Ww,1,Ox],[Ww,5,5*Ox],[Ww,15,15*Ox],[Ww,30,30*Ox],[o,1,$f],[o,5,5*$f],[o,15,15*$f],[o,30,30*$f],[i,1,Dx],[i,3,3*Dx],[i,6,6*Dx],[i,12,12*Dx],[s,1,oy],[s,2,2*oy],[n,1,l0e],[t,1,uCe],[t,3,3*uCe],[e,1,ede]];function a(p,x,y){const w=xA).right(l,w);if(j===l.length)return e.every(Bfe(p/ede,x/ede,y));if(j===0)return Ire.every(Math.max(Bfe(p,x,y),1));const[S,C]=l[w/l[j-1][2]53)return null;"w"in Te||(Te.w=1),"Z"in Te?(xe=rde(GM(Te.y,0,1)),mt=xe.getUTCDay(),xe=mt>4||mt===0?Lre.ceil(xe):Lre(xe),xe=yie.offset(xe,(Te.V-1)*7),Te.y=xe.getUTCFullYear(),Te.m=xe.getUTCMonth(),Te.d=xe.getUTCDate()+(Te.w+6)%7):(xe=tde(GM(Te.y,0,1)),mt=xe.getDay(),xe=mt>4||mt===0?Pre.ceil(xe):Pre(xe),xe=qI.offset(xe,(Te.V-1)*7),Te.y=xe.getFullYear(),Te.m=xe.getMonth(),Te.d=xe.getDate()+(Te.w+6)%7)}else("W"in Te||"U"in Te)&&("w"in Te||(Te.w="u"in Te?Te.u%7:"W"in Te?1:0),mt="Z"in Te?rde(GM(Te.y,0,1)).getUTCDay():tde(GM(Te.y,0,1)).getDay(),Te.m=0,Te.d="W"in Te?(Te.w+6)%7+Te.W*7-(mt+5)%7:Te.w+Te.U*7-(mt+6)%7);return"Z"in Te?(Te.H+=Te.Z/100|0,Te.M+=Te.Z%100,rde(Te)):tde(Te)}}function K(Re,Ce,Je,Te){for(var Ye=0,xe=Ce.length,mt=Je.length,et,nt;Ye=mt)return-1;if(et=Ce.charCodeAt(Ye++),et===37){if(et=Ce.charAt(Ye++),nt=F[et in hCe?Ce.charAt(Ye++):et],!nt||(Te=nt(Re,Je,Te))<0)return-1}else if(et!=Je.charCodeAt(Te++))return-1}return Te}function Z(Re,Ce,Je){var Te=p.exec(Ce.slice(Je));return Te?(Re.p=x.get(Te[0].toLowerCase()),Je+Te[0].length):-1}function re(Re,Ce,Je){var Te=j.exec(Ce.slice(Je));return Te?(Re.w=S.get(Te[0].toLowerCase()),Je+Te[0].length):-1}function ue(Re,Ce,Je){var Te=y.exec(Ce.slice(Je));return Te?(Re.w=w.get(Te[0].toLowerCase()),Je+Te[0].length):-1}function he(Re,Ce,Je){var Te=E.exec(Ce.slice(Je));return Te?(Re.m=T.get(Te[0].toLowerCase()),Je+Te[0].length):-1}function be(Re,Ce,Je){var Te=C.exec(Ce.slice(Je));return Te?(Re.m=A.get(Te[0].toLowerCase()),Je+Te[0].length):-1}function ne(Re,Ce,Je){return K(Re,t,Ce,Je)}function ye(Re,Ce,Je){return K(Re,n,Ce,Je)}function ie(Re,Ce,Je){return K(Re,s,Ce,Je)}function fe(Re){return l[Re.getDay()]}function de(Re){return o[Re.getDay()]}function _e(Re){return h[Re.getMonth()]}function Ee(Re){return a[Re.getMonth()]}function ke(Re){return i[+(Re.getHours()>=12)]}function pe(Re){return 1+~~(Re.getMonth()/3)}function ae(Re){return l[Re.getUTCDay()]}function ge(Re){return o[Re.getUTCDay()]}function Me(Re){return h[Re.getUTCMonth()]}function Ue(Re){return a[Re.getUTCMonth()]}function Ie(Re){return i[+(Re.getUTCHours()>=12)]}function Ke(Re){return 1+~~(Re.getUTCMonth()/3)}return{format:function(Re){var Ce=q(Re+="",O);return Ce.toString=function(){return Re},Ce},parse:function(Re){var Ce=H(Re+="",!1);return Ce.toString=function(){return Re},Ce},utcFormat:function(Re){var Ce=q(Re+="",z);return Ce.toString=function(){return Re},Ce},utcParse:function(Re){var Ce=H(Re+="",!0);return Ce.toString=function(){return Re},Ce}}}var hCe={"-":"",_:" ",0:"0"},xd=/^\s*\d+/,kOt=/^%/,NOt=/[\\^$*+?|[\]().{}]/g;function no(e,t,n){var s=e<0?"-":"",i=(s?-e:e)+"",o=i.length;return s+(o[t.toLowerCase(),n]))}function COt(e,t,n){var s=xd.exec(t.slice(n,n+1));return s?(e.w=+s[0],n+s[0].length):-1}function MOt(e,t,n){var s=xd.exec(t.slice(n,n+1));return s?(e.u=+s[0],n+s[0].length):-1}function TOt(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.U=+s[0],n+s[0].length):-1}function AOt(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.V=+s[0],n+s[0].length):-1}function EOt(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.W=+s[0],n+s[0].length):-1}function fCe(e,t,n){var s=xd.exec(t.slice(n,n+4));return s?(e.y=+s[0],n+s[0].length):-1}function pCe(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function IOt(e,t,n){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return s?(e.Z=s[1]?0:-(s[2]+(s[3]||"00")),n+s[0].length):-1}function POt(e,t,n){var s=xd.exec(t.slice(n,n+1));return s?(e.q=s[0]*3-3,n+s[0].length):-1}function LOt(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.m=s[0]-1,n+s[0].length):-1}function mCe(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.d=+s[0],n+s[0].length):-1}function OOt(e,t,n){var s=xd.exec(t.slice(n,n+3));return s?(e.m=0,e.d=+s[0],n+s[0].length):-1}function gCe(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.H=+s[0],n+s[0].length):-1}function DOt(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.M=+s[0],n+s[0].length):-1}function ROt(e,t,n){var s=xd.exec(t.slice(n,n+2));return s?(e.S=+s[0],n+s[0].length):-1}function FOt(e,t,n){var s=xd.exec(t.slice(n,n+3));return s?(e.L=+s[0],n+s[0].length):-1}function zOt(e,t,n){var s=xd.exec(t.slice(n,n+6));return s?(e.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function BOt(e,t,n){var s=kOt.exec(t.slice(n,n+1));return s?n+s[0].length:-1}function $Ot(e,t,n){var s=xd.exec(t.slice(n));return s?(e.Q=+s[0],n+s[0].length):-1}function UOt(e,t,n){var s=xd.exec(t.slice(n));return s?(e.s=+s[0],n+s[0].length):-1}function xCe(e,t){return no(e.getDate(),t,2)}function qOt(e,t){return no(e.getHours(),t,2)}function VOt(e,t){return no(e.getHours()%12||12,t,2)}function HOt(e,t){return no(1+qI.count(ly(e),e),t,3)}function N9e(e,t){return no(e.getMilliseconds(),t,3)}function WOt(e,t){return N9e(e,t)+"000"}function GOt(e,t){return no(e.getMonth()+1,t,2)}function KOt(e,t){return no(e.getMinutes(),t,2)}function ZOt(e,t){return no(e.getSeconds(),t,2)}function YOt(e){var t=e.getDay();return t===0?7:t}function XOt(e,t){return no(vie.count(ly(e)-1,e),t,2)}function S9e(e){var t=e.getDay();return t>=4||t===0?MC(e):MC.ceil(e)}function QOt(e,t){return e=S9e(e),no(MC.count(ly(e),e)+(ly(e).getDay()===4),t,2)}function JOt(e){return e.getDay()}function eDt(e,t){return no(Pre.count(ly(e)-1,e),t,2)}function tDt(e,t){return no(e.getFullYear()%100,t,2)}function rDt(e,t){return e=S9e(e),no(e.getFullYear()%100,t,2)}function nDt(e,t){return no(e.getFullYear()%1e4,t,4)}function sDt(e,t){var n=e.getDay();return e=n>=4||n===0?MC(e):MC.ceil(e),no(e.getFullYear()%1e4,t,4)}function iDt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+no(t/60|0,"0",2)+no(t%60,"0",2)}function yCe(e,t){return no(e.getUTCDate(),t,2)}function aDt(e,t){return no(e.getUTCHours(),t,2)}function oDt(e,t){return no(e.getUTCHours()%12||12,t,2)}function lDt(e,t){return no(1+yie.count(cy(e),e),t,3)}function C9e(e,t){return no(e.getUTCMilliseconds(),t,3)}function cDt(e,t){return C9e(e,t)+"000"}function dDt(e,t){return no(e.getUTCMonth()+1,t,2)}function uDt(e,t){return no(e.getUTCMinutes(),t,2)}function hDt(e,t){return no(e.getUTCSeconds(),t,2)}function fDt(e){var t=e.getUTCDay();return t===0?7:t}function pDt(e,t){return no(_ie.count(cy(e)-1,e),t,2)}function M9e(e){var t=e.getUTCDay();return t>=4||t===0?TC(e):TC.ceil(e)}function mDt(e,t){return e=M9e(e),no(TC.count(cy(e),e)+(cy(e).getUTCDay()===4),t,2)}function gDt(e){return e.getUTCDay()}function xDt(e,t){return no(Lre.count(cy(e)-1,e),t,2)}function yDt(e,t){return no(e.getUTCFullYear()%100,t,2)}function vDt(e,t){return e=M9e(e),no(e.getUTCFullYear()%100,t,2)}function _Dt(e,t){return no(e.getUTCFullYear()%1e4,t,4)}function bDt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?TC(e):TC.ceil(e),no(e.getUTCFullYear()%1e4,t,4)}function wDt(){return"+0000"}function vCe(){return"%"}function _Ce(e){return+e}function bCe(e){return Math.floor(+e/1e3)}var d4,T9e,A9e;jDt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function jDt(e){return d4=jOt(e),T9e=d4.format,d4.parse,A9e=d4.utcFormat,d4.utcParse,d4}function kDt(e){return new Date(e)}function NDt(e){return e instanceof Date?+e:+new Date(+e)}function m0e(e,t,n,s,i,o,l,a,h,p){var x=t0e(),y=x.invert,w=x.domain,j=p(".%L"),S=p(":%S"),C=p("%I:%M"),A=p("%I %p"),E=p("%a %d"),T=p("%b %d"),O=p("%B"),z=p("%Y");function F(q){return(h(q)t(i/(e.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(i,o)=>p8t(e,o/s))},n.copy=function(){return L9e(t).domain(e)},xy.apply(n,arguments)}function wie(){var e=0,t=.5,n=1,s=1,i,o,l,a,h,p=Au,x,y=!1,w;function j(C){return isNaN(C=+C)?w:(C=.5+((C=+x(C))-o)*(s*Ct}var F9e=IDt,PDt=jie,LDt=F9e,ODt=w3;function DDt(e){return e&&e.length?PDt(e,ODt,LDt):void 0}var RDt=DDt;const kie=za(RDt);function FDt(e,t){return ee.e^o.s<0?1:-1;for(s=o.d.length,i=e.d.length,t=0,n=se.d[t]^o.s<0?1:-1;return s===i?0:s>i^o.s<0?1:-1};_s.decimalPlaces=_s.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*hl;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};_s.dividedBy=_s.div=function(e){return Xx(this,new this.constructor(e))};_s.dividedToIntegerBy=_s.idiv=function(e){var t=this,n=t.constructor;return Ro(Xx(t,new n(e),0,1),n.precision)};_s.equals=_s.eq=function(e){return!this.cmp(e)};_s.exponent=function(){return Mc(this)};_s.greaterThan=_s.gt=function(e){return this.cmp(e)>0};_s.greaterThanOrEqualTo=_s.gte=function(e){return this.cmp(e)>=0};_s.isInteger=_s.isint=function(){return this.e>this.d.length-2};_s.isNegative=_s.isneg=function(){return this.s<0};_s.isPositive=_s.ispos=function(){return this.s>0};_s.isZero=function(){return this.s===0};_s.lessThan=_s.lt=function(e){return this.cmp(e)<0};_s.lessThanOrEqualTo=_s.lte=function(e){return this.cmp(e)<1};_s.logarithm=_s.log=function(e){var t,n=this,s=n.constructor,i=s.precision,o=i+5;if(e===void 0)e=new s(10);else if(e=new s(e),e.s<1||e.eq(Vh))throw Error(rp+"NaN");if(n.s<1)throw Error(rp+(n.s?"NaN":"-Infinity"));return n.eq(Vh)?new s(0):(kl=!1,t=Xx(ME(n,o),ME(e,o),o),kl=!0,Ro(t,i))};_s.minus=_s.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?q9e(t,e):$9e(t,(e.s=-e.s,e))};_s.modulo=_s.mod=function(e){var t,n=this,s=n.constructor,i=s.precision;if(e=new s(e),!e.s)throw Error(rp+"NaN");return n.s?(kl=!1,t=Xx(n,e,0,1).times(e),kl=!0,n.minus(t)):Ro(new s(n),i)};_s.naturalExponential=_s.exp=function(){return U9e(this)};_s.naturalLogarithm=_s.ln=function(){return ME(this)};_s.negated=_s.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};_s.plus=_s.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?$9e(t,e):q9e(t,(e.s=-e.s,e))};_s.precision=_s.sd=function(e){var t,n,s,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Sj+e);if(t=Mc(i)+1,s=i.d.length-1,n=s*hl+1,s=i.d[s],s){for(;s%10==0;s/=10)n--;for(s=i.d[0];s>=10;s/=10)n++}return e&&t>n?t:n};_s.squareRoot=_s.sqrt=function(){var e,t,n,s,i,o,l,a=this,h=a.constructor;if(a.s<1){if(!a.s)return new h(0);throw Error(rp+"NaN")}for(e=Mc(a),kl=!1,i=Math.sqrt(+a),i==0||i==1/0?(t=pg(a.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=S3((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),s=new h(t)):s=new h(i.toString()),n=h.precision,i=l=n+3;;)if(o=s,s=o.plus(Xx(a,o,l+2)).times(.5),pg(o.d).slice(0,l)===(t=pg(s.d)).slice(0,l)){if(t=t.slice(l-3,l+1),i==l&&t=="4999"){if(Ro(o,n+1,0),o.times(o).eq(a)){s=o;break}}else if(t!="9999")break;l+=4}return kl=!0,Ro(s,n)};_s.times=_s.mul=function(e){var t,n,s,i,o,l,a,h,p,x=this,y=x.constructor,w=x.d,j=(e=new y(e)).d;if(!x.s||!e.s)return new y(0);for(e.s*=x.s,n=x.e+e.e,h=w.length,p=j.length,h=0;){for(t=0,i=h+s;i>s;)a=o[i]+j[s]*w[i-s-1]+t,o[i--]=a%id|0,t=a/id|0;o[i]=(o[i]+t)%id|0}for(;!o[--l];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,kl?Ro(e,y.precision):e};_s.toDecimalPlaces=_s.todp=function(e,t){var n=this,s=n.constructor;return n=new s(n),e===void 0?n:(Og(e,0,N3),t===void 0?t=s.rounding:Og(t,0,8),Ro(n,e+Mc(n)+1,t))};_s.toExponential=function(e,t){var n,s=this,i=s.constructor;return e===void 0?n=Zj(s,!0):(Og(e,0,N3),t===void 0?t=i.rounding:Og(t,0,8),s=Ro(new i(s),e+1,t),n=Zj(s,!0,e+1)),n};_s.toFixed=function(e,t){var n,s,i=this,o=i.constructor;return e===void 0?Zj(i):(Og(e,0,N3),t===void 0?t=o.rounding:Og(t,0,8),s=Ro(new o(i),e+Mc(i)+1,t),n=Zj(s.abs(),!1,e+Mc(s)+1),i.isneg()&&!i.isZero()?"-"+n:n)};_s.toInteger=_s.toint=function(){var e=this,t=e.constructor;return Ro(new t(e),Mc(e)+1,t.rounding)};_s.toNumber=function(){return+this};_s.toPower=_s.pow=function(e){var t,n,s,i,o,l,a=this,h=a.constructor,p=12,x=+(e=new h(e));if(!e.s)return new h(Vh);if(a=new h(a),!a.s){if(e.s<1)throw Error(rp+"Infinity");return a}if(a.eq(Vh))return a;if(s=h.precision,e.eq(Vh))return Ro(a,s);if(t=e.e,n=e.d.length-1,l=t>=n,o=a.s,l){if((n=x<0?-x:x)<=B9e){for(i=new h(Vh),t=Math.ceil(s/hl+4),kl=!1;n%2&&(i=i.times(a),kCe(i.d,t)),n=S3(n/2),n!==0;)a=a.times(a),kCe(a.d,t);return kl=!0,e.s<0?new h(Vh).div(i):Ro(i,s)}}else if(o<0)throw Error(rp+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,a.s=1,kl=!1,i=e.times(ME(a,s+p)),kl=!0,i=U9e(i),i.s=o,i};_s.toPrecision=function(e,t){var n,s,i=this,o=i.constructor;return e===void 0?(n=Mc(i),s=Zj(i,n<=o.toExpNeg||n>=o.toExpPos)):(Og(e,1,N3),t===void 0?t=o.rounding:Og(t,0,8),i=Ro(new o(i),e,t),n=Mc(i),s=Zj(i,e<=n||n<=o.toExpNeg,e)),s};_s.toSignificantDigits=_s.tosd=function(e,t){var n=this,s=n.constructor;return e===void 0?(e=s.precision,t=s.rounding):(Og(e,1,N3),t===void 0?t=s.rounding:Og(t,0,8)),Ro(new s(n),e,t)};_s.toString=_s.valueOf=_s.val=_s.toJSON=_s[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Mc(e),n=e.constructor;return Zj(e,t<=n.toExpNeg||t>=n.toExpPos)};function $9e(e,t){var n,s,i,o,l,a,h,p,x=e.constructor,y=x.precision;if(!e.s||!t.s)return t.s||(t=new x(e)),kl?Ro(t,y):t;if(h=e.d,p=t.d,l=e.e,i=t.e,h=h.slice(),o=l-i,o){for(o<0?(s=h,o=-o,a=p.length):(s=p,i=l,a=h.length),l=Math.ceil(y/hl),a=l>a?l+1:a+1,o>a&&(o=a,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(a=h.length,o=p.length,a-o<0&&(o=a,s=p,p=h,h=s),n=0;o;)n=(h[--o]=h[o]+p[o]+n)/id|0,h[o]%=id;for(n&&(h.unshift(n),++i),a=h.length;h[--a]==0;)h.pop();return t.d=h,t.e=i,kl?Ro(t,y):t}function Og(e,t,n){if(e!==~~e||en)throw Error(Sj+e)}function pg(e){var t,n,s,i=e.length-1,o="",l=e[0];if(i>0){for(o+=l,t=1;tl?1:-1;else for(a=h=0;ai[a]?1:-1;break}return h}function n(s,i,o){for(var l=0;o--;)s[o]-=l,l=s[o]1;)s.shift()}return function(s,i,o,l){var a,h,p,x,y,w,j,S,C,A,E,T,O,z,F,q,H,K,Z=s.constructor,re=s.s==i.s?1:-1,ue=s.d,he=i.d;if(!s.s)return new Z(s);if(!i.s)throw Error(rp+"Division by zero");for(h=s.e-i.e,H=he.length,F=ue.length,j=new Z(re),S=j.d=[],p=0;he[p]==(ue[p]||0);)++p;if(he[p]>(ue[p]||0)&&--h,o==null?T=o=Z.precision:l?T=o+(Mc(s)-Mc(i))+1:T=o,T<0)return new Z(0);if(T=T/hl+2|0,p=0,H==1)for(x=0,he=he[0],T++;(p1&&(he=e(he,x),ue=e(ue,x),H=he.length,F=ue.length),z=H,C=ue.slice(0,H),A=C.length;A=id/2&&++q;do x=0,a=t(he,C,H,A),a<0?(E=C[0],H!=A&&(E=E*id+(C[1]||0)),x=E/q|0,x>1?(x>=id&&(x=id-1),y=e(he,x),w=y.length,A=C.length,a=t(y,C,w,A),a==1&&(x--,n(y,H16)throw Error(y0e+Mc(e));if(!e.s)return new x(Vh);for(kl=!1,a=y,l=new x(.03125);e.abs().gte(.1);)e=e.times(l),p+=5;for(s=Math.log(Mw(2,p))/Math.LN10*2+5|0,a+=s,n=i=o=new x(Vh),x.precision=a;;){if(i=Ro(i.times(e),a),n=n.times(++h),l=o.plus(Xx(i,n,a)),pg(l.d).slice(0,a)===pg(o.d).slice(0,a)){for(;p--;)o=Ro(o.times(o),a);return x.precision=y,t==null?(kl=!0,Ro(o,y)):o}o=l}}function Mc(e){for(var t=e.e*hl,n=e.d[0];n>=10;n/=10)t++;return t}function nde(e,t,n){if(t>e.LN10.sd())throw kl=!0,n&&(e.precision=n),Error(rp+"LN10 precision limit exceeded");return Ro(new e(e.LN10),t)}function w0(e){for(var t="";e--;)t+="0";return t}function ME(e,t){var n,s,i,o,l,a,h,p,x,y=1,w=10,j=e,S=j.d,C=j.constructor,A=C.precision;if(j.s<1)throw Error(rp+(j.s?"NaN":"-Infinity"));if(j.eq(Vh))return new C(0);if(t==null?(kl=!1,p=A):p=t,j.eq(10))return t==null&&(kl=!0),nde(C,p);if(p+=w,C.precision=p,n=pg(S),s=n.charAt(0),o=Mc(j),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)j=j.times(e),n=pg(j.d),s=n.charAt(0),y++;o=Mc(j),s>1?(j=new C("0."+n),o++):j=new C(s+"."+n.slice(1))}else return h=nde(C,p+2,A).times(o+""),j=ME(new C(s+"."+n.slice(1)),p-w).plus(h),C.precision=A,t==null?(kl=!0,Ro(j,A)):j;for(a=l=j=Xx(j.minus(Vh),j.plus(Vh),p),x=Ro(j.times(j),p),i=3;;){if(l=Ro(l.times(x),p),h=a.plus(Xx(l,new C(i),p)),pg(h.d).slice(0,p)===pg(a.d).slice(0,p))return a=a.times(2),o!==0&&(a=a.plus(nde(C,p+2,A).times(o+""))),a=Xx(a,new C(y),p),C.precision=A,t==null?(kl=!0,Ro(a,A)):a;a=h,i+=2}}function jCe(e,t){var n,s,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(n<0&&(n=s),n+=+t.slice(s+1),t=t.substring(0,s)):n<0&&(n=t.length),s=0;t.charCodeAt(s)===48;)++s;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(s,i),t){if(i-=s,n=n-s-1,e.e=S3(n/hl),e.d=[],s=(n+1)%hl,n<0&&(s+=hl),sOre||e.e<-Ore))throw Error(y0e+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ro(e,t,n){var s,i,o,l,a,h,p,x,y=e.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(s=t-l,s<0)s+=hl,i=t,p=y[x=0];else{if(x=Math.ceil((s+1)/hl),o=y.length,x>=o)return e;for(p=o=y[x],l=1;o>=10;o/=10)l++;s%=hl,i=s-hl+l}if(n!==void 0&&(o=Mw(10,l-i-1),a=p/o%10|0,h=t<0||y[x+1]!==void 0||p%o,h=n<4?(a||h)&&(n==0||n==(e.s<0?3:2)):a>5||a==5&&(n==4||h||n==6&&(s>0?i>0?p/Mw(10,l-i):0:y[x-1])%10&1||n==(e.s<0?8:7))),t<1||!y[0])return h?(o=Mc(e),y.length=1,t=t-o-1,y[0]=Mw(10,(hl-t%hl)%hl),e.e=S3(-t/hl)||0):(y.length=1,y[0]=e.e=e.s=0),e;if(s==0?(y.length=x,o=1,x--):(y.length=x+1,o=Mw(10,hl-s),y[x]=i>0?(p/Mw(10,l-i)%Mw(10,i)|0)*o:0),h)for(;;)if(x==0){(y[0]+=o)==id&&(y[0]=1,++e.e);break}else{if(y[x]+=o,y[x]!=id)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(kl&&(e.e>Ore||e.e<-Ore))throw Error(y0e+Mc(e));return e}function q9e(e,t){var n,s,i,o,l,a,h,p,x,y,w=e.constructor,j=w.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new w(e),kl?Ro(t,j):t;if(h=e.d,y=t.d,s=t.e,p=e.e,h=h.slice(),l=p-s,l){for(x=l<0,x?(n=h,l=-l,a=y.length):(n=y,s=p,a=h.length),i=Math.max(Math.ceil(j/hl),a)+2,l>i&&(l=i,n.length=1),n.reverse(),i=l;i--;)n.push(0);n.reverse()}else{for(i=h.length,a=y.length,x=i0;--i)h[a++]=0;for(i=y.length;i>l;){if(h[--i]0?o=o.charAt(0)+"."+o.slice(1)+w0(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+w0(-i-1)+o,n&&(s=n-l)>0&&(o+=w0(s))):i>=l?(o+=w0(i+1-l),n&&(s=n-i-1)>0&&(o=o+"."+w0(s))):((s=i+1)0&&(i+1===l&&(o+="."),o+=w0(s))),e.s<0?"-"+o:o}function kCe(e,t){if(e.length>t)return e.length=t,!0}function V9e(e){var t,n,s;function i(o){var l=this;if(!(l instanceof i))return new i(o);if(l.constructor=i,o instanceof i){l.s=o.s,l.e=o.e,l.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Sj+o);if(o>0)l.s=1;else if(o<0)o=-o,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(o===~~o&&o<1e7){l.e=0,l.d=[o];return}return jCe(l,o.toString())}else if(typeof o!="string")throw Error(Sj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,iRt.test(o))jCe(l,o);else throw Error(Sj+o)}if(i.prototype=_s,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=V9e,i.config=i.set=aRt,e===void 0&&(e={}),e)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&s<=i[t+2])this[n]=s;else throw Error(Sj+n+": "+s);if((s=e[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(Sj+n+": "+s);return this}var v0e=V9e(sRt);Vh=new v0e(1);const Io=v0e;function oRt(e){return uRt(e)||dRt(e)||cRt(e)||lRt()}function lRt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cRt(e,t){if(e){if(typeof e=="string")return Hfe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hfe(e,t)}}function dRt(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function uRt(e){if(Array.isArray(e))return Hfe(e)}function Hfe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=t?n.apply(void 0,i):e(t-l,NCe(function(){for(var a=arguments.length,h=new Array(a),p=0;pe.length)&&(t=e.length);for(var n=0,s=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,i=!1,o=void 0;try{for(var l=e[Symbol.iterator](),a;!(s=(a=l.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(h){i=!0,o=h}finally{try{!s&&l.return!=null&&l.return()}finally{if(i)throw o}}return n}}function SRt(e){if(Array.isArray(e))return e}function Z9e(e){var t=TE(e,2),n=t[0],s=t[1],i=n,o=s;return n>s&&(i=s,o=n),[i,o]}function Y9e(e,t,n){if(e.lte(0))return new Io(0);var s=Mie.getDigitCount(e.toNumber()),i=new Io(10).pow(s),o=e.div(i),l=s!==1?.05:.1,a=new Io(Math.ceil(o.div(l).toNumber())).add(n).mul(l),h=a.mul(i);return t?h:new Io(Math.ceil(h))}function CRt(e,t,n){var s=1,i=new Io(e);if(!i.isint()&&n){var o=Math.abs(e);o<1?(s=new Io(10).pow(Mie.getDigitCount(e)-1),i=new Io(Math.floor(i.div(s).toNumber())).mul(s)):o>1&&(i=new Io(Math.floor(e)))}else e===0?i=new Io(Math.floor((t-1)/2)):n||(i=new Io(Math.floor(e)));var l=Math.floor((t-1)/2),a=mRt(pRt(function(h){return i.add(new Io(h-l).mul(s)).toNumber()}),Wfe);return a(0,t)}function X9e(e,t,n,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Io(0),tickMin:new Io(0),tickMax:new Io(0)};var o=Y9e(new Io(t).sub(e).div(n-1),s,i),l;e<=0&&t>=0?l=new Io(0):(l=new Io(e).add(t).div(2),l=l.sub(new Io(l).mod(o)));var a=Math.ceil(l.sub(e).div(o).toNumber()),h=Math.ceil(new Io(t).sub(l).div(o).toNumber()),p=a+h+1;return p>n?X9e(e,t,n,s,i+1):(p0?h+(n-p):h,a=t>0?a:a+(n-p)),{step:o,tickMin:l.sub(new Io(a).mul(o)),tickMax:l.add(new Io(h).mul(o))})}function MRt(e){var t=TE(e,2),n=t[0],s=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Math.max(i,2),a=Z9e([n,s]),h=TE(a,2),p=h[0],x=h[1];if(p===-1/0||x===1/0){var y=x===1/0?[p].concat(Kfe(Wfe(0,i-1).map(function(){return 1/0}))):[].concat(Kfe(Wfe(0,i-1).map(function(){return-1/0})),[x]);return n>s?Gfe(y):y}if(p===x)return CRt(p,i,o);var w=X9e(p,x,l,o),j=w.step,S=w.tickMin,C=w.tickMax,A=Mie.rangeStep(S,C.add(new Io(.1).mul(j)),j);return n>s?Gfe(A):A}function TRt(e,t){var n=TE(e,2),s=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Z9e([s,i]),a=TE(l,2),h=a[0],p=a[1];if(h===-1/0||p===1/0)return[s,i];if(h===p)return[h];var x=Math.max(t,2),y=Y9e(new Io(p).sub(h).div(x-1),o,0),w=[].concat(Kfe(Mie.rangeStep(new Io(h),new Io(p).sub(new Io(.99).mul(y)),y)),[p]);return s>i?Gfe(w):w}var ARt=G9e(MRt),ERt=G9e(TRt),IRt="Invariant failed";function Yj(e,t){throw new Error(IRt)}var PRt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function AC(e){"@babel/helpers - typeof";return AC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},AC(e)}function Dre(){return Dre=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function BRt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function $Rt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function URt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=-1,a=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(a<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var h=o.range,p=0;p0?i[p-1].coordinate:i[a-1].coordinate,y=i[p].coordinate,w=p>=a-1?i[0].coordinate:i[p+1].coordinate,j=void 0;if(Mu(y-x)!==Mu(w-y)){var S=[];if(Mu(w-y)===Mu(h[1]-h[0])){j=w;var C=y+h[1]-h[0];S[0]=Math.min(C,(C+x)/2),S[1]=Math.max(C,(C+x)/2)}else{j=x;var A=w+h[1]-h[0];S[0]=Math.min(y,(A+y)/2),S[1]=Math.max(y,(A+y)/2)}var E=[Math.min(y,(j+y)/2),Math.max(y,(j+y)/2)];if(t>E[0]&&t<=E[1]||t>=S[0]&&t<=S[1]){l=i[p].index;break}}else{var T=Math.min(x,w),O=Math.max(x,w);if(t>(T+y)/2&&t<=(O+y)/2){l=i[p].index;break}}}else for(var z=0;z0&&z(s[z].coordinate+s[z-1].coordinate)/2&&t<=(s[z].coordinate+s[z+1].coordinate)/2||z===a-1&&t>(s[z].coordinate+s[z-1].coordinate)/2){l=s[z].index;break}return l},_0e=function(t){var n,s=t,i=s.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Hl(Hl({},t.type.defaultProps),t.props):t.props,l=o.stroke,a=o.fill,h;switch(i){case"Line":h=l;break;case"Area":case"Radar":h=l&&l!=="none"?l:a;break;default:h=a;break}return h},iFt=function(t){var n=t.barSize,s=t.totalSize,i=t.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var l={},a=Object.keys(o),h=0,p=a.length;h=0});if(E&&E.length){var T=E[0].type.defaultProps,O=T!==void 0?Hl(Hl({},T),E[0].props):E[0].props,z=O.barSize,F=O[A];l[F]||(l[F]=[]);var q=_a(z)?n:z;l[F].push({item:E[0],stackList:E.slice(1),barSize:_a(q)?void 0:Tu(q,s,0)})}}return l},aFt=function(t){var n=t.barGap,s=t.barCategoryGap,i=t.bandSize,o=t.sizeList,l=o===void 0?[]:o,a=t.maxBarSize,h=l.length;if(h<1)return null;var p=Tu(n,i,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var w=!1,j=i/h,S=l.reduce(function(z,F){return z+F.barSize||0},0);S+=(h-1)*p,S>=i&&(S-=(h-1)*p,p=0),S>=i&&j>0&&(w=!0,j*=.9,S=h*j);var C=(i-S)/2>>0,A={offset:C-p,size:0};x=l.reduce(function(z,F){var q={item:F.item,position:{offset:A.offset+A.size+p,size:w?j:F.barSize}},H=[].concat(MCe(z),[q]);return A=H[H.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){H.push({item:K,position:A})}),H},y)}else{var E=Tu(s,i,0,!0);i-2*E-(h-1)*p<=0&&(p=0);var T=(i-2*E-(h-1)*p)/h;T>1&&(T>>=0);var O=a===+a?Math.min(T,a):T;x=l.reduce(function(z,F,q){var H=[].concat(MCe(z),[{item:F.item,position:{offset:E+(T+p)*q+(T-O)/2,size:O}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){H.push({item:K,position:H[H.length-1].position})}),H},y)}return x},oFt=function(t,n,s,i){var o=s.children,l=s.width,a=s.margin,h=l-(a.left||0)-(a.right||0),p=tBe({children:o,legendWidth:h});if(p){var x=i||{},y=x.width,w=x.height,j=p.align,S=p.verticalAlign,C=p.layout;if((C==="vertical"||C==="horizontal"&&S==="middle")&&j!=="center"&&Dn(t[j]))return Hl(Hl({},t),{},OS({},j,t[j]+(y||0)));if((C==="horizontal"||C==="vertical"&&j==="center")&&S!=="middle"&&Dn(t[S]))return Hl(Hl({},t),{},OS({},S,t[S]+(w||0)))}return t},lFt=function(t,n,s){return _a(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},rBe=function(t,n,s,i,o){var l=n.props.children,a=Qf(l,Tie).filter(function(p){return lFt(i,o,p.props.direction)});if(a&&a.length){var h=a.map(function(p){return p.props.dataKey});return t.reduce(function(p,x){var y=Xd(x,s);if(_a(y))return p;var w=Array.isArray(y)?[Nie(y),kie(y)]:[y,y],j=h.reduce(function(S,C){var A=Xd(x,C,0),E=w[0]-Math.abs(Array.isArray(A)?A[0]:A),T=w[1]+Math.abs(Array.isArray(A)?A[1]:A);return[Math.min(E,S[0]),Math.max(T,S[1])]},[1/0,-1/0]);return[Math.min(j[0],p[0]),Math.max(j[1],p[1])]},[1/0,-1/0])}return null},cFt=function(t,n,s,i,o){var l=n.map(function(a){return rBe(t,a,s,o,i)}).filter(function(a){return!_a(a)});return l&&l.length?l.reduce(function(a,h){return[Math.min(a[0],h[0]),Math.max(a[1],h[1])]},[1/0,-1/0]):null},nBe=function(t,n,s,i,o){var l=n.map(function(h){var p=h.props.dataKey;return s==="number"&&p&&rBe(t,h,p,i)||bA(t,p,s,o)});if(s==="number")return l.reduce(function(h,p){return[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);var a={};return l.reduce(function(h,p){for(var x=0,y=p.length;x=2?Mu(a[0]-a[1])*2*p:p,n&&(t.ticks||t.niceTicks)){var x=(t.ticks||t.niceTicks).map(function(y){var w=o?o.indexOf(y):y;return{coordinate:i(w)+p,value:y,offset:p}});return x.filter(function(y){return!RI(y.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(y,w){return{coordinate:i(y)+p,value:y,index:w,offset:p}}):i.ticks&&!s?i.ticks(t.tickCount).map(function(y){return{coordinate:i(y)+p,value:y,offset:p}}):i.domain().map(function(y,w){return{coordinate:i(y)+p,value:o?o[y]:y,index:w,offset:p}})},sde=new WeakMap,GL=function(t,n){if(typeof n!="function")return t;sde.has(t)||sde.set(t,new WeakMap);var s=sde.get(t);if(s.has(n))return s.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,i),i},aBe=function(t,n,s){var i=t.scale,o=t.type,l=t.layout,a=t.axisType;if(i==="auto")return l==="radial"&&a==="radiusAxis"?{scale:jE(),realScaleType:"band"}:l==="radial"&&a==="angleAxis"?{scale:Ere(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:_A(),realScaleType:"point"}:o==="category"?{scale:jE(),realScaleType:"band"}:{scale:Ere(),realScaleType:"linear"};if(Wj(i)){var h="scale".concat(cie(i));return{scale:(wCe[h]||_A)(),realScaleType:wCe[h]?h:"point"}}return Ri(i)?{scale:i}:{scale:_A(),realScaleType:"point"}},ACe=1e-4,oBe=function(t){var n=t.domain();if(!(!n||n.length<=2)){var s=n.length,i=t.range(),o=Math.min(i[0],i[1])-ACe,l=Math.max(i[0],i[1])+ACe,a=t(n[0]),h=t(n[s-1]);(al||hl)&&t.domain([n[0],n[s-1]])}},dFt=function(t,n){if(!t)return null;for(var s=0,i=t.length;si)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(t[a][s][0]=o,t[a][s][1]=o+h,o=t[a][s][1]):(t[a][s][0]=l,t[a][s][1]=l+h,l=t[a][s][1])}},fFt=function(t){var n=t.length;if(!(n<=0))for(var s=0,i=t[0].length;s=0?(t[l][s][0]=o,t[l][s][1]=o+a,o=t[l][s][1]):(t[l][s][0]=0,t[l][s][1]=0)}},pFt={sign:hFt,expand:P3t,none:wC,silhouette:L3t,wiggle:O3t,positive:fFt},mFt=function(t,n,s){var i=n.map(function(a){return a.props.dataKey}),o=pFt[s],l=I3t().keys(i).value(function(a,h){return+Xd(a,h,0)}).order(bfe).offset(o);return l(t)},gFt=function(t,n,s,i,o,l){if(!t)return null;var a=l?n.reverse():n,h={},p=a.reduce(function(y,w){var j,S=(j=w.type)!==null&&j!==void 0&&j.defaultProps?Hl(Hl({},w.type.defaultProps),w.props):w.props,C=S.stackId,A=S.hide;if(A)return y;var E=S[s],T=y[E]||{hasStack:!1,stackGroups:{}};if(Uc(C)){var O=T.stackGroups[C]||{numericAxisId:s,cateAxisId:i,items:[]};O.items.push(w),T.hasStack=!0,T.stackGroups[C]=O}else T.stackGroups[FI("_stackId_")]={numericAxisId:s,cateAxisId:i,items:[w]};return Hl(Hl({},y),{},OS({},E,T))},h),x={};return Object.keys(p).reduce(function(y,w){var j=p[w];if(j.hasStack){var S={};j.stackGroups=Object.keys(j.stackGroups).reduce(function(C,A){var E=j.stackGroups[A];return Hl(Hl({},C),{},OS({},A,{numericAxisId:s,cateAxisId:i,items:E.items,stackedData:mFt(t,E.items,o)}))},S)}return Hl(Hl({},y),{},OS({},w,j))},x)},lBe=function(t,n){var s=n.realScaleType,i=n.type,o=n.tickCount,l=n.originalDomain,a=n.allowDecimals,h=s||n.scale;if(h!=="auto"&&h!=="linear")return null;if(o&&i==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var p=t.domain();if(!p.length)return null;var x=ARt(p,o,a);return t.domain([Nie(x),kie(x)]),{niceTicks:x}}if(o&&i==="number"){var y=t.domain(),w=ERt(y,o,a);return{niceTicks:w}}return null},ECe=function(t){var n=t.axis,s=t.ticks,i=t.offset,o=t.bandSize,l=t.entry,a=t.index;if(n.type==="category")return s[a]?s[a].coordinate+i:null;var h=Xd(l,n.dataKey,n.domain[a]);return _a(h)?null:n.scale(h)-o/2+i},xFt=function(t){var n=t.numericAxis,s=n.scale.domain();if(n.type==="number"){var i=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return i<=0&&o>=0?0:o<0?o:i}return s[0]},yFt=function(t,n){var s,i=(s=t.type)!==null&&s!==void 0&&s.defaultProps?Hl(Hl({},t.type.defaultProps),t.props):t.props,o=i.stackId;if(Uc(o)){var l=n[o];if(l){var a=l.items.indexOf(t);return a>=0?l.stackedData[a]:null}}return null},vFt=function(t){return t.reduce(function(n,s){return[Nie(s.concat([n[0]]).filter(Dn)),kie(s.concat([n[1]]).filter(Dn))]},[1/0,-1/0])},cBe=function(t,n,s){return Object.keys(t).reduce(function(i,o){var l=t[o],a=l.stackedData,h=a.reduce(function(p,x){var y=vFt(x.slice(n,s+1));return[Math.min(p[0],y[0]),Math.max(p[1],y[1])]},[1/0,-1/0]);return[Math.min(h[0],i[0]),Math.max(h[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},ICe=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,PCe=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Qfe=function(t,n,s){if(Ri(t))return t(n,s);if(!Array.isArray(t))return n;var i=[];if(Dn(t[0]))i[0]=s?t[0]:Math.min(t[0],n[0]);else if(ICe.test(t[0])){var o=+ICe.exec(t[0])[1];i[0]=n[0]-o}else Ri(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(Dn(t[1]))i[1]=s?t[1]:Math.max(t[1],n[1]);else if(PCe.test(t[1])){var l=+PCe.exec(t[1])[1];i[1]=n[1]+l}else Ri(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},Fre=function(t,n,s){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!s||i>0)return i}if(t&&n&&n.length>=2){for(var o=Kye(n,function(y){return y.coordinate}),l=1/0,a=1,h=o.length;ae.length)&&(t=e.length);for(var n=0,s=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(s.left||0)-(s.right||0)),Math.abs(n-(s.top||0)-(s.bottom||0)))/2},MFt=function(t,n,s,i,o){var l=t.width,a=t.height,h=t.startAngle,p=t.endAngle,x=Tu(t.cx,l,l/2),y=Tu(t.cy,a,a/2),w=hBe(l,a,s),j=Tu(t.innerRadius,w,0),S=Tu(t.outerRadius,w,w*.8),C=Object.keys(n);return C.reduce(function(A,E){var T=n[E],O=T.domain,z=T.reversed,F;if(_a(T.range))i==="angleAxis"?F=[h,p]:i==="radiusAxis"&&(F=[j,S]),z&&(F=[F[1],F[0]]);else{F=T.range;var q=F,H=wFt(q,2);h=H[0],p=H[1]}var K=aBe(T,o),Z=K.realScaleType,re=K.scale;re.domain(O).range(F),oBe(re);var ue=lBe(re,jx(jx({},T),{},{realScaleType:Z})),he=jx(jx(jx({},T),ue),{},{range:F,radius:S,realScaleType:Z,scale:re,cx:x,cy:y,innerRadius:j,outerRadius:S,startAngle:h,endAngle:p});return jx(jx({},A),{},uBe({},E,he))},{})},TFt=function(t,n){var s=t.x,i=t.y,o=n.x,l=n.y;return Math.sqrt(Math.pow(s-o,2)+Math.pow(i-l,2))},AFt=function(t,n){var s=t.x,i=t.y,o=n.cx,l=n.cy,a=TFt({x:s,y:i},{x:o,y:l});if(a<=0)return{radius:a};var h=(s-o)/a,p=Math.acos(h);return i>l&&(p=2*Math.PI-p),{radius:a,angle:CFt(p),angleInRadian:p}},EFt=function(t){var n=t.startAngle,s=t.endAngle,i=Math.floor(n/360),o=Math.floor(s/360),l=Math.min(i,o);return{startAngle:n-l*360,endAngle:s-l*360}},IFt=function(t,n){var s=n.startAngle,i=n.endAngle,o=Math.floor(s/360),l=Math.floor(i/360),a=Math.min(o,l);return t+a*360},RCe=function(t,n){var s=t.x,i=t.y,o=AFt({x:s,y:i},n),l=o.radius,a=o.angle,h=n.innerRadius,p=n.outerRadius;if(lp)return!1;if(l===0)return!0;var x=EFt(n),y=x.startAngle,w=x.endAngle,j=a,S;if(y<=w){for(;j>w;)j-=360;for(;j=y&&j<=w}else{for(;j>y;)j-=360;for(;j=w&&j<=y}return S?jx(jx({},n),{},{radius:l,angle:IFt(j,n)}):null},fBe=function(t){return!P.isValidElement(t)&&!Ri(t)&&typeof t!="boolean"?t.className:""};function PE(e){"@babel/helpers - typeof";return PE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},PE(e)}var PFt=["offset"];function LFt(e){return FFt(e)||RFt(e)||DFt(e)||OFt()}function OFt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DFt(e,t){if(e){if(typeof e=="string")return Jfe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jfe(e,t)}}function RFt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function FFt(e){if(Array.isArray(e))return Jfe(e)}function Jfe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function BFt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function FCe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Lc(e){for(var t=1;t=0?1:-1,O,z;i==="insideStart"?(O=j+T*l,z=C):i==="insideEnd"?(O=S-T*l,z=!C):i==="end"&&(O=S+T*l,z=C),z=E<=0?z:!z;var F=Xo(p,x,A,O),q=Xo(p,x,A,O+(z?1:-1)*359),H="M".concat(F.x,",").concat(F.y,` A`).concat(A,",").concat(A,",0,1,").concat(z?0:1,`, `).concat(q.x,",").concat(q.y),K=_a(t.id)?FI("recharts-radial-line-"):t.id;return rt.createElement("text",LE({},s,{dominantBaseline:"central",className:ra("recharts-radial-bar-label",a)}),rt.createElement("defs",null,rt.createElement("path",{id:K,d:H})),rt.createElement("textPath",{xlinkHref:"#".concat(K)},n))},GFt=function(t){var n=t.viewBox,s=t.offset,i=t.position,o=n,l=o.cx,a=o.cy,h=o.innerRadius,p=o.outerRadius,x=o.startAngle,y=o.endAngle,w=(x+y)/2;if(i==="outside"){var j=Xo(l,a,p+s,w),S=j.x,C=j.y;return{x:S,y:C,textAnchor:S>=l?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:l,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:l,y:a,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:l,y:a,textAnchor:"middle",verticalAnchor:"end"};var A=(h+p)/2,E=Xo(l,a,A,w),T=E.x,O=E.y;return{x:T,y:O,textAnchor:"middle",verticalAnchor:"middle"}},KFt=function(t){var n=t.viewBox,s=t.parentViewBox,i=t.offset,o=t.position,l=n,a=l.x,h=l.y,p=l.width,x=l.height,y=x>=0?1:-1,w=y*i,j=y>0?"end":"start",S=y>0?"start":"end",C=p>=0?1:-1,A=C*i,E=C>0?"end":"start",T=C>0?"start":"end";if(o==="top"){var O={x:a+p/2,y:h-y*i,textAnchor:"middle",verticalAnchor:j};return Lc(Lc({},O),s?{height:Math.max(h-s.y,0),width:p}:{})}if(o==="bottom"){var z={x:a+p/2,y:h+x+w,textAnchor:"middle",verticalAnchor:S};return Lc(Lc({},z),s?{height:Math.max(s.y+s.height-(h+x),0),width:p}:{})}if(o==="left"){var F={x:a-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"};return Lc(Lc({},F),s?{width:Math.max(F.x-s.x,0),height:x}:{})}if(o==="right"){var q={x:a+p+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"};return Lc(Lc({},q),s?{width:Math.max(s.x+s.width-q.x,0),height:x}:{})}var H=s?{width:p,height:x}:{};return o==="insideLeft"?Lc({x:a+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"},H):o==="insideRight"?Lc({x:a+p-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"},H):o==="insideTop"?Lc({x:a+p/2,y:h+w,textAnchor:"middle",verticalAnchor:S},H):o==="insideBottom"?Lc({x:a+p/2,y:h+x-w,textAnchor:"middle",verticalAnchor:j},H):o==="insideTopLeft"?Lc({x:a+A,y:h+w,textAnchor:T,verticalAnchor:S},H):o==="insideTopRight"?Lc({x:a+p-A,y:h+w,textAnchor:E,verticalAnchor:S},H):o==="insideBottomLeft"?Lc({x:a+A,y:h+x-w,textAnchor:T,verticalAnchor:j},H):o==="insideBottomRight"?Lc({x:a+p-A,y:h+x-w,textAnchor:E,verticalAnchor:j},H):g3(o)&&(Dn(o.x)||Vw(o.x))&&(Dn(o.y)||Vw(o.y))?Lc({x:a+Tu(o.x,p),y:h+Tu(o.y,x),textAnchor:"end",verticalAnchor:"end"},H):Lc({x:a+p/2,y:h+x/2,textAnchor:"middle",verticalAnchor:"middle"},H)},ZFt=function(t){return"cx"in t&&Dn(t.cx)};function ld(e){var t=e.offset,n=t===void 0?5:t,s=zFt(e,PFt),i=Lc({offset:n},s),o=i.viewBox,l=i.position,a=i.value,h=i.children,p=i.content,x=i.className,y=x===void 0?"":x,w=i.textBreakAll;if(!o||_a(a)&&_a(h)&&!P.isValidElement(p)&&!Ri(p))return null;if(P.isValidElement(p))return P.cloneElement(p,i);var j;if(Ri(p)){if(j=P.createElement(p,i),P.isValidElement(j))return j}else j=VFt(i);var S=ZFt(o),C=Ti(i,!0);if(S&&(l==="insideStart"||l==="insideEnd"||l==="end"))return WFt(i,j,C);var A=S?GFt(i):KFt(i);return rt.createElement(Kj,LE({className:ra("recharts-label",y)},C,A,{breakAll:w}),j)}ld.displayName="Label";var pBe=function(t){var n=t.cx,s=t.cy,i=t.angle,o=t.startAngle,l=t.endAngle,a=t.r,h=t.radius,p=t.innerRadius,x=t.outerRadius,y=t.x,w=t.y,j=t.top,S=t.left,C=t.width,A=t.height,E=t.clockWise,T=t.labelViewBox;if(T)return T;if(Dn(C)&&Dn(A)){if(Dn(y)&&Dn(w))return{x:y,y:w,width:C,height:A};if(Dn(j)&&Dn(S))return{x:j,y:S,width:C,height:A}}return Dn(y)&&Dn(w)?{x:y,y:w,width:0,height:0}:Dn(n)&&Dn(s)?{cx:n,cy:s,startAngle:o||i||0,endAngle:l||i||0,innerRadius:p||0,outerRadius:x||h||a||0,clockWise:E}:t.viewBox?t.viewBox:{}},YFt=function(t,n){return t?t===!0?rt.createElement(ld,{key:"label-implicit",viewBox:n}):Uc(t)?rt.createElement(ld,{key:"label-implicit",viewBox:n,value:t}):P.isValidElement(t)?t.type===ld?P.cloneElement(t,{key:"label-implicit",viewBox:n}):rt.createElement(ld,{key:"label-implicit",content:t,viewBox:n}):Ri(t)?rt.createElement(ld,{key:"label-implicit",content:t,viewBox:n}):g3(t)?rt.createElement(ld,LE({viewBox:n},t,{key:"label-implicit"})):null:null},XFt=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&s&&!t.label)return null;var i=t.children,o=pBe(t),l=Qf(i,ld).map(function(h,p){return P.cloneElement(h,{viewBox:n||o,key:"label-".concat(p)})});if(!s)return l;var a=YFt(t.label,n||o);return[a].concat(LFt(l))};ld.parseViewBox=pBe;ld.renderCallByParent=XFt;function QFt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var JFt=QFt;const ezt=za(JFt);function OE(e){"@babel/helpers - typeof";return OE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},OE(e)}var tzt=["valueAccessor"],rzt=["data","dataKey","clockWise","id","textBreakAll"];function nzt(e){return ozt(e)||azt(e)||izt(e)||szt()}function szt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function izt(e,t){if(e){if(typeof e=="string")return epe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return epe(e,t)}}function azt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ozt(e){if(Array.isArray(e))return epe(e)}function epe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function uzt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var hzt=function(t){return Array.isArray(t.value)?ezt(t.value):t.value};function A1(e){var t=e.valueAccessor,n=t===void 0?hzt:t,s=$Ce(e,tzt),i=s.data,o=s.dataKey,l=s.clockWise,a=s.id,h=s.textBreakAll,p=$Ce(s,rzt);return!i||!i.length?null:rt.createElement(ko,{className:"recharts-label-list"},i.map(function(x,y){var w=_a(o)?n(x,y):Xd(x&&x.payload,o),j=_a(a)?{}:{id:"".concat(a,"-").concat(y)};return rt.createElement(ld,Bre({},Ti(x,!0),p,j,{parentViewBox:x.parentViewBox,value:w,textBreakAll:h,viewBox:ld.parseViewBox(_a(l)?x:BCe(BCe({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}A1.displayName="LabelList";function fzt(e,t){return e?e===!0?rt.createElement(A1,{key:"labelList-implicit",data:t}):rt.isValidElement(e)||Ri(e)?rt.createElement(A1,{key:"labelList-implicit",data:t,content:e}):g3(e)?rt.createElement(A1,Bre({data:t},e,{key:"labelList-implicit"})):null:null}function pzt(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var s=e.children,i=Qf(s,A1).map(function(l,a){return P.cloneElement(l,{data:t,key:"labelList-".concat(a)})});if(!n)return i;var o=fzt(e.label,t);return[o].concat(nzt(i))}A1.renderCallByParent=pzt;function DE(e){"@babel/helpers - typeof";return DE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},DE(e)}function tpe(){return tpe=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(l>p),`, `).concat(y.x,",").concat(y.y,` `);if(i>0){var j=Xo(n,s,i,l),S=Xo(n,s,i,p);w+="L ".concat(S.x,",").concat(S.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(h)>180),",").concat(+(l<=p),`, `).concat(j.x,",").concat(j.y," Z")}else w+="L ".concat(n,",").concat(s," Z");return w},vzt=function(t){var n=t.cx,s=t.cy,i=t.innerRadius,o=t.outerRadius,l=t.cornerRadius,a=t.forceCornerRadius,h=t.cornerIsExternal,p=t.startAngle,x=t.endAngle,y=Mu(x-p),w=KL({cx:n,cy:s,radius:o,angle:p,sign:y,cornerRadius:l,cornerIsExternal:h}),j=w.circleTangency,S=w.lineTangency,C=w.theta,A=KL({cx:n,cy:s,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:h}),E=A.circleTangency,T=A.lineTangency,O=A.theta,z=h?Math.abs(p-x):Math.abs(p-x)-C-O;if(z<0)return a?"M ".concat(S.x,",").concat(S.y,` a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0 a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0 `):mBe({cx:n,cy:s,innerRadius:i,outerRadius:o,startAngle:p,endAngle:x});var F="M ".concat(S.x,",").concat(S.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(j.x,",").concat(j.y,` A`).concat(o,",").concat(o,",0,").concat(+(z>180),",").concat(+(y<0),",").concat(E.x,",").concat(E.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(T.x,",").concat(T.y,` `);if(i>0){var q=KL({cx:n,cy:s,radius:i,angle:p,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),H=q.circleTangency,K=q.lineTangency,Z=q.theta,re=KL({cx:n,cy:s,radius:i,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),ue=re.circleTangency,he=re.lineTangency,be=re.theta,ne=h?Math.abs(p-x):Math.abs(p-x)-Z-be;if(ne<0&&l===0)return"".concat(F,"L").concat(n,",").concat(s,"Z");F+="L".concat(he.x,",").concat(he.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ue.x,",").concat(ue.y,` A`).concat(i,",").concat(i,",0,").concat(+(ne>180),",").concat(+(y>0),",").concat(H.x,",").concat(H.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(K.x,",").concat(K.y,"Z")}else F+="L".concat(n,",").concat(s,"Z");return F},_zt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},gBe=function(t){var n=qCe(qCe({},_zt),t),s=n.cx,i=n.cy,o=n.innerRadius,l=n.outerRadius,a=n.cornerRadius,h=n.forceCornerRadius,p=n.cornerIsExternal,x=n.startAngle,y=n.endAngle,w=n.className;if(l0&&Math.abs(x-y)<360?A=vzt({cx:s,cy:i,innerRadius:o,outerRadius:l,cornerRadius:Math.min(C,S/2),forceCornerRadius:h,cornerIsExternal:p,startAngle:x,endAngle:y}):A=mBe({cx:s,cy:i,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),rt.createElement("path",tpe({},Ti(n,!0),{className:j,d:A,role:"img"}))};function RE(e){"@babel/helpers - typeof";return RE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},RE(e)}function rpe(){return rpe=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[s],t[s],s,s,e,t,n))return!1;return!0}function zzt(e,t){return ck(e.getTime(),t.getTime())}function Bzt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function $zt(e,t){return e===t}function XCe(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var i=new Array(s),o=e.entries(),l,a,h=0;(l=o.next())&&!l.done;){for(var p=t.entries(),x=!1,y=0;(a=p.next())&&!a.done;){if(i[y]){y++;continue}var w=l.value,j=a.value;if(n.equals(w[0],j[0],h,y,e,t,n)&&n.equals(w[1],j[1],w[0],j[0],e,t,n)){x=i[y]=!0;break}y++}if(!x)return!1;h++}return!0}var Uzt=ck;function qzt(e,t,n){var s=YCe(e),i=s.length;if(YCe(t).length!==i)return!1;for(;i-- >0;)if(!_Be(e,t,n,s[i]))return!1;return!0}function QM(e,t,n){var s=KCe(e),i=s.length;if(KCe(t).length!==i)return!1;for(var o,l,a;i-- >0;)if(o=s[i],!_Be(e,t,n,o)||(l=ZCe(e,o),a=ZCe(t,o),(l||a)&&(!l||!a||l.configurable!==a.configurable||l.enumerable!==a.enumerable||l.writable!==a.writable)))return!1;return!0}function Vzt(e,t){return ck(e.valueOf(),t.valueOf())}function Hzt(e,t){return e.source===t.source&&e.flags===t.flags}function QCe(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var i=new Array(s),o=e.values(),l,a;(l=o.next())&&!l.done;){for(var h=t.values(),p=!1,x=0;(a=h.next())&&!a.done;){if(!i[x]&&n.equals(l.value,a.value,l.value,a.value,e,t,n)){p=i[x]=!0;break}x++}if(!p)return!1}return!0}function Wzt(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Gzt(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function _Be(e,t,n,s){return(s===Rzt||s===Dzt||s===Ozt)&&(e.$$typeof||t.$$typeof)?!0:Lzt(t,s)&&n.equals(e[s],t[s],s,s,e,t,n)}var Kzt="[object Arguments]",Zzt="[object Boolean]",Yzt="[object Date]",Xzt="[object Error]",Qzt="[object Map]",Jzt="[object Number]",e7t="[object Object]",t7t="[object RegExp]",r7t="[object Set]",n7t="[object String]",s7t="[object URL]",i7t=Array.isArray,JCe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,e3e=Object.assign,a7t=Object.prototype.toString.call.bind(Object.prototype.toString);function o7t(e){var t=e.areArraysEqual,n=e.areDatesEqual,s=e.areErrorsEqual,i=e.areFunctionsEqual,o=e.areMapsEqual,l=e.areNumbersEqual,a=e.areObjectsEqual,h=e.arePrimitiveWrappersEqual,p=e.areRegExpsEqual,x=e.areSetsEqual,y=e.areTypedArraysEqual,w=e.areUrlsEqual;return function(S,C,A){if(S===C)return!0;if(S==null||C==null)return!1;var E=typeof S;if(E!==typeof C)return!1;if(E!=="object")return E==="number"?l(S,C,A):E==="function"?i(S,C,A):!1;var T=S.constructor;if(T!==C.constructor)return!1;if(T===Object)return a(S,C,A);if(i7t(S))return t(S,C,A);if(JCe!=null&&JCe(S))return y(S,C,A);if(T===Date)return n(S,C,A);if(T===RegExp)return p(S,C,A);if(T===Map)return o(S,C,A);if(T===Set)return x(S,C,A);var O=a7t(S);return O===Yzt?n(S,C,A):O===t7t?p(S,C,A):O===Qzt?o(S,C,A):O===r7t?x(S,C,A):O===e7t?typeof S.then!="function"&&typeof C.then!="function"&&a(S,C,A):O===s7t?w(S,C,A):O===Xzt?s(S,C,A):O===Kzt?a(S,C,A):O===Zzt||O===Jzt||O===n7t?h(S,C,A):!1}}function l7t(e){var t=e.circular,n=e.createCustomConfig,s=e.strict,i={areArraysEqual:s?QM:Fzt,areDatesEqual:zzt,areErrorsEqual:Bzt,areFunctionsEqual:$zt,areMapsEqual:s?GCe(XCe,QM):XCe,areNumbersEqual:Uzt,areObjectsEqual:s?QM:qzt,arePrimitiveWrappersEqual:Vzt,areRegExpsEqual:Hzt,areSetsEqual:s?GCe(QCe,QM):QCe,areTypedArraysEqual:s?QM:Wzt,areUrlsEqual:Gzt};if(n&&(i=e3e({},i,n(i))),t){var o=YL(i.areArraysEqual),l=YL(i.areMapsEqual),a=YL(i.areObjectsEqual),h=YL(i.areSetsEqual);i=e3e({},i,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:a,areSetsEqual:h})}return i}function c7t(e){return function(t,n,s,i,o,l,a){return e(t,n,a)}}function d7t(e){var t=e.circular,n=e.comparator,s=e.createState,i=e.equals,o=e.strict;if(s)return function(h,p){var x=s(),y=x.cache,w=y===void 0?t?new WeakMap:void 0:y,j=x.meta;return n(h,p,{cache:w,equals:i,meta:j,strict:o})};if(t)return function(h,p){return n(h,p,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var l={cache:void 0,equals:i,meta:void 0,strict:o};return function(h,p){return n(h,p,l)}}var u7t=uv();uv({strict:!0});uv({circular:!0});uv({circular:!0,strict:!0});uv({createInternalComparator:function(){return ck}});uv({strict:!0,createInternalComparator:function(){return ck}});uv({circular:!0,createInternalComparator:function(){return ck}});uv({circular:!0,createInternalComparator:function(){return ck},strict:!0});function uv(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,s=e.createInternalComparator,i=e.createState,o=e.strict,l=o===void 0?!1:o,a=l7t(e),h=o7t(a),p=s?s(h):c7t(h);return d7t({circular:n,comparator:h,createState:i,equals:p,strict:l})}function h7t(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function t3e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function i(o){n<0&&(n=o),o-n>t?(e(o),n=-1):h7t(i)};requestAnimationFrame(s)}function spe(e){"@babel/helpers - typeof";return spe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},spe(e)}function f7t(e){return x7t(e)||g7t(e)||m7t(e)||p7t()}function p7t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m7t(e,t){if(e){if(typeof e=="string")return r3e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r3e(e,t)}}function r3e(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n1?1:E<0?0:E},C=function(E){for(var T=E>1?1:E,O=T,z=0;z<8;++z){var F=y(O)-T,q=j(O);if(Math.abs(F-T)<$re||q<$re)return w(O);O=S(O-F/q)}return w(O)};return C.isStepper=!1,C},P7t=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,s=n===void 0?100:n,i=t.damping,o=i===void 0?8:i,l=t.dt,a=l===void 0?17:l,h=function(x,y,w){var j=-(x-y)*s,S=w*o,C=w+(j-S)*a/1e3,A=w*a/1e3+x;return Math.abs(A-y)<$re&&Math.abs(C)<$re?[y,0]:[A,C]};return h.isStepper=!0,h.dt=a,h},L7t=function(){for(var t=arguments.length,n=new Array(t),s=0;se.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function K7t(e,t){if(e==null)return{};var n={},s=Object.keys(e),i,o;for(o=0;o=0)&&(n[i]=e[i]);return n}function ide(e){return Q7t(e)||X7t(e)||Y7t(e)||Z7t()}function Z7t(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y7t(e,t){if(e){if(typeof e=="string")return cpe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cpe(e,t)}}function X7t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Q7t(e){if(Array.isArray(e))return cpe(e)}function cpe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function qre(e){return qre=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},qre(e)}var dy=function(e){n9t(n,e);var t=s9t(n);function n(s,i){var o;J7t(this,n),o=t.call(this,s,i);var l=o.props,a=l.isActive,h=l.attributeName,p=l.from,x=l.to,y=l.steps,w=l.children,j=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(hpe(o)),o.changeStyle=o.changeStyle.bind(hpe(o)),!a||j<=0)return o.state={style:{}},typeof w=="function"&&(o.state={style:x}),upe(o);if(y&&y.length)o.state={style:y[0].style};else if(p){if(typeof w=="function")return o.state={style:p},upe(o);o.state={style:h?mT({},h,p):p}}else o.state={style:{}};return o}return t9t(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,l=i.canBegin;this.mounted=!0,!(!o||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,l=o.isActive,a=o.canBegin,h=o.attributeName,p=o.shouldReAnimate,x=o.to,y=o.from,w=this.state.style;if(a){if(!l){var j={style:h?mT({},h,x):x};this.state&&w&&(h&&w[h]!==x||!h&&w!==x)&&this.setState(j);return}if(!(u7t(i.to,x)&&i.canBegin&&i.isActive)){var S=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var C=S||p?y:i.to;if(this.state&&w){var A={style:h?mT({},h,C):C};(h&&w[h]!==C||!h&&w!==C)&&this.setState(A)}this.runAnimation($p($p({},this.props),{},{from:C,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,l=i.from,a=i.to,h=i.duration,p=i.easing,x=i.begin,y=i.onAnimationEnd,w=i.onAnimationStart,j=H7t(l,a,L7t(p),h,this.changeStyle),S=function(){o.stopJSAnimation=j()};this.manager.start([w,x,S,h,y])}},{key:"runStepAnimation",value:function(i){var o=this,l=i.steps,a=i.begin,h=i.onAnimationStart,p=l[0],x=p.style,y=p.duration,w=y===void 0?0:y,j=function(C,A,E){if(E===0)return C;var T=A.duration,O=A.easing,z=O===void 0?"ease":O,F=A.style,q=A.properties,H=A.onAnimationEnd,K=E>0?l[E-1]:A,Z=q||Object.keys(F);if(typeof z=="function"||z==="spring")return[].concat(ide(C),[o.runJSAnimation.bind(o,{from:K.style,to:F,duration:T,easing:z}),T]);var re=i3e(Z,T,z),ue=$p($p($p({},K.style),F),{},{transition:re});return[].concat(ide(C),[ue,T,H]).filter(w7t)};return this.manager.start([h].concat(ide(l.reduce(j,[x,Math.max(w,a)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=y7t());var o=i.begin,l=i.duration,a=i.attributeName,h=i.to,p=i.easing,x=i.onAnimationStart,y=i.onAnimationEnd,w=i.steps,j=i.children,S=this.manager;if(this.unSubscribe=S.subscribe(this.handleStyleChange),typeof p=="function"||typeof j=="function"||p==="spring"){this.runJSAnimation(i);return}if(w.length>1){this.runStepAnimation(i);return}var C=a?mT({},a,h):h,A=i3e(Object.keys(C),l,p);S.start([x,o,$p($p({},C),{},{transition:A}),l,y])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var l=i.duration;i.attributeName,i.easing;var a=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var h=G7t(i,W7t),p=P.Children.count(o),x=this.state.style;if(typeof o=="function")return o(x);if(!a||p===0||l<=0)return o;var y=function(j){var S=j.props,C=S.style,A=C===void 0?{}:C,E=S.className,T=P.cloneElement(j,$p($p({},h),{},{style:$p($p({},A),x),className:E}));return T};return p===1?y(P.Children.only(o)):rt.createElement("div",null,P.Children.map(o,function(w){return y(w)}))}}]),n}(P.PureComponent);dy.displayName="Animate";dy.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};dy.propTypes={from:fo.oneOfType([fo.object,fo.string]),to:fo.oneOfType([fo.object,fo.string]),attributeName:fo.string,duration:fo.number,begin:fo.number,easing:fo.oneOfType([fo.string,fo.func]),steps:fo.arrayOf(fo.shape({duration:fo.number.isRequired,style:fo.object.isRequired,easing:fo.oneOfType([fo.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),fo.func]),properties:fo.arrayOf("string"),onAnimationEnd:fo.func})),children:fo.oneOfType([fo.node,fo.func]),isActive:fo.bool,canBegin:fo.bool,onAnimationEnd:fo.func,shouldReAnimate:fo.bool,onAnimationStart:fo.func,onAnimationReStart:fo.func};function BE(e){"@babel/helpers - typeof";return BE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},BE(e)}function Vre(){return Vre=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0?1:-1,h=s>=0?1:-1,p=i>=0&&s>=0||i<0&&s<0?1:0,x;if(l>0&&o instanceof Array){for(var y=[0,0,0,0],w=0,j=4;wl?l:o[w];x="M".concat(t,",").concat(n+a*y[0]),y[0]>0&&(x+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(p,",").concat(t+h*y[0],",").concat(n)),x+="L ".concat(t+s-h*y[1],",").concat(n),y[1]>0&&(x+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(p,`, `).concat(t+s,",").concat(n+a*y[1])),x+="L ".concat(t+s,",").concat(n+i-a*y[2]),y[2]>0&&(x+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(p,`, `).concat(t+s-h*y[2],",").concat(n+i)),x+="L ".concat(t+h*y[3],",").concat(n+i),y[3]>0&&(x+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(p,`, `).concat(t,",").concat(n+i-a*y[3])),x+="Z"}else if(l>0&&o===+o&&o>0){var S=Math.min(l,o);x="M ".concat(t,",").concat(n+a*S,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+h*S,",").concat(n,` L `).concat(t+s-h*S,",").concat(n,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+s,",").concat(n+a*S,` L `).concat(t+s,",").concat(n+i-a*S,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+s-h*S,",").concat(n+i,` L `).concat(t+h*S,",").concat(n+i,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t,",").concat(n+i-a*S," Z")}else x="M ".concat(t,",").concat(n," h ").concat(s," v ").concat(i," h ").concat(-s," Z");return x},p9t=function(t,n){if(!t||!n)return!1;var s=t.x,i=t.y,o=n.x,l=n.y,a=n.width,h=n.height;if(Math.abs(a)>0&&Math.abs(h)>0){var p=Math.min(o,o+a),x=Math.max(o,o+a),y=Math.min(l,l+h),w=Math.max(l,l+h);return s>=p&&s<=x&&i>=y&&i<=w}return!1},m9t={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},b0e=function(t){var n=f3e(f3e({},m9t),t),s=P.useRef(),i=P.useState(-1),o=a9t(i,2),l=o[0],a=o[1];P.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var z=s.current.getTotalLength();z&&a(z)}catch{}},[]);var h=n.x,p=n.y,x=n.width,y=n.height,w=n.radius,j=n.className,S=n.animationEasing,C=n.animationDuration,A=n.animationBegin,E=n.isAnimationActive,T=n.isUpdateAnimationActive;if(h!==+h||p!==+p||x!==+x||y!==+y||x===0||y===0)return null;var O=ra("recharts-rectangle",j);return T?rt.createElement(dy,{canBegin:l>0,from:{width:x,height:y,x:h,y:p},to:{width:x,height:y,x:h,y:p},duration:C,animationEasing:S,isActive:T},function(z){var F=z.width,q=z.height,H=z.x,K=z.y;return rt.createElement(dy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:C,isActive:E,easing:S},rt.createElement("path",Vre({},Ti(n,!0),{className:O,d:p3e(H,K,F,q,w),ref:s})))}):rt.createElement("path",Vre({},Ti(n,!0),{className:O,d:p3e(h,p,x,y,w)}))},g9t=["points","className","baseLinePoints","connectNulls"];function R4(){return R4=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function y9t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function m3e(e){return w9t(e)||b9t(e)||_9t(e)||v9t()}function v9t(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _9t(e,t){if(e){if(typeof e=="string")return fpe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fpe(e,t)}}function b9t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function w9t(e){if(Array.isArray(e))return fpe(e)}function fpe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(s){g3e(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),g3e(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},jA=function(t,n){var s=j9t(t);n&&(s=[s.reduce(function(o,l){return[].concat(m3e(o),m3e(l))},[])]);var i=s.map(function(o){return o.reduce(function(l,a,h){return"".concat(l).concat(h===0?"M":"L").concat(a.x,",").concat(a.y)},"")}).join("");return s.length===1?"".concat(i,"Z"):i},k9t=function(t,n,s){var i=jA(t,s);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(jA(n.reverse(),s).slice(1))},N9t=function(t){var n=t.points,s=t.className,i=t.baseLinePoints,o=t.connectNulls,l=x9t(t,g9t);if(!n||!n.length)return null;var a=ra("recharts-polygon",s);if(i&&i.length){var h=l.stroke&&l.stroke!=="none",p=k9t(n,i,o);return rt.createElement("g",{className:a},rt.createElement("path",R4({},Ti(l,!0),{fill:p.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:p})),h?rt.createElement("path",R4({},Ti(l,!0),{fill:"none",d:jA(n,o)})):null,h?rt.createElement("path",R4({},Ti(l,!0),{fill:"none",d:jA(i,o)})):null)}var x=jA(n,o);return rt.createElement("path",R4({},Ti(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:a,d:x}))};function ppe(){return ppe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function I9t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var P9t=function(t,n,s,i,o,l){return"M".concat(t,",").concat(o,"v").concat(i,"M").concat(l,",").concat(n,"h").concat(s)},L9t=function(t){var n=t.x,s=n===void 0?0:n,i=t.y,o=i===void 0?0:i,l=t.top,a=l===void 0?0:l,h=t.left,p=h===void 0?0:h,x=t.width,y=x===void 0?0:x,w=t.height,j=w===void 0?0:w,S=t.className,C=E9t(t,S9t),A=C9t({x:s,y:o,top:a,left:p,width:y,height:j},C);return!Dn(s)||!Dn(o)||!Dn(y)||!Dn(j)||!Dn(a)||!Dn(p)?null:rt.createElement("path",mpe({},Ti(A,!0),{className:ra("recharts-cross",S),d:P9t(s,o,y,j,a,p)}))},O9t=jie,D9t=F9e,R9t=Ug;function F9t(e,t){return e&&e.length?O9t(e,R9t(t),D9t):void 0}var z9t=F9t;const B9t=za(z9t);var $9t=jie,U9t=Ug,q9t=z9e;function V9t(e,t){return e&&e.length?$9t(e,U9t(t),q9t):void 0}var H9t=V9t;const W9t=za(H9t);var G9t=["cx","cy","angle","ticks","axisLine"],K9t=["ticks","tick","angle","tickFormatter","stroke"];function IC(e){"@babel/helpers - typeof";return IC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},IC(e)}function kA(){return kA=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Z9t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Y9t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _3e(e,t){for(var n=0;nj3e?l=i==="outer"?"start":"end":o<-j3e?l=i==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var s=this.props,i=s.cx,o=s.cy,l=s.radius,a=s.axisLine,h=s.axisLineType,p=l_(l_({},Ti(this.props,!1)),{},{fill:"none"},Ti(a,!1));if(h==="circle")return rt.createElement(w0e,Pw({className:"recharts-polar-angle-axis-line"},p,{cx:i,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(w){return Xo(i,o,l,w.coordinate)});return rt.createElement(N9t,Pw({className:"recharts-polar-angle-axis-line"},p,{points:y}))}},{key:"renderTicks",value:function(){var s=this,i=this.props,o=i.ticks,l=i.tick,a=i.tickLine,h=i.tickFormatter,p=i.stroke,x=Ti(this.props,!1),y=Ti(l,!1),w=l_(l_({},x),{},{fill:"none"},Ti(a,!1)),j=o.map(function(S,C){var A=s.getTickLineCoord(S),E=s.getTickTextAnchor(S),T=l_(l_(l_({textAnchor:E},x),{},{stroke:"none",fill:p},y),{},{index:C,payload:S,x:A.x2,y:A.y2});return rt.createElement(ko,Pw({className:ra("recharts-polar-angle-axis-tick",fBe(l)),key:"tick-".concat(S.coordinate)},Gj(s.props,S,C)),a&&rt.createElement("line",Pw({className:"recharts-polar-angle-axis-tick-line"},w,A)),l&&t.renderTickItem(l,T,h?h(S.value,C):S.value))});return rt.createElement(ko,{className:"recharts-polar-angle-axis-ticks"},j)}},{key:"render",value:function(){var s=this.props,i=s.ticks,o=s.radius,l=s.axisLine;return o<=0||!i||!i.length?null:rt.createElement(ko,{className:ra("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,i,o){var l;return rt.isValidElement(s)?l=rt.cloneElement(s,i):Ri(s)?l=s(i):l=rt.createElement(Kj,Pw({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(P.PureComponent);Iie(Pie,"displayName","PolarAngleAxis");Iie(Pie,"axisType","angleAxis");Iie(Pie,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var uBt=L7e,hBt=uBt(Object.getPrototypeOf,Object),fBt=hBt,pBt=my,mBt=fBt,gBt=gy,xBt="[object Object]",yBt=Function.prototype,vBt=Object.prototype,EBe=yBt.toString,_Bt=vBt.hasOwnProperty,bBt=EBe.call(Object);function wBt(e){if(!gBt(e)||pBt(e)!=xBt)return!1;var t=mBt(e);if(t===null)return!0;var n=_Bt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&EBe.call(n)==bBt}var jBt=wBt;const kBt=za(jBt);var NBt=my,SBt=gy,CBt="[object Boolean]";function MBt(e){return e===!0||e===!1||SBt(e)&&NBt(e)==CBt}var TBt=MBt;const ABt=za(TBt);function UE(e){"@babel/helpers - typeof";return UE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},UE(e)}function Gre(){return Gre=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:w,x:h,y:p},to:{upperWidth:x,lowerWidth:y,height:w,x:h,y:p},duration:C,animationEasing:S,isActive:E},function(O){var z=O.upperWidth,F=O.lowerWidth,q=O.height,H=O.x,K=O.y;return rt.createElement(dy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:C,easing:S},rt.createElement("path",Gre({},Ti(n,!0),{className:T,d:C3e(H,K,z,F,q),ref:s})))}):rt.createElement("g",null,rt.createElement("path",Gre({},Ti(n,!0),{className:T,d:C3e(h,p,x,y,w)})))},$Bt=["option","shapeType","propTransformer","activeClassName","isActive"];function qE(e){"@babel/helpers - typeof";return qE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qE(e)}function UBt(e,t){if(e==null)return{};var n=qBt(e,t),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function qBt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function M3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Kre(e){for(var t=1;t0?tf(O,"paddingAngle",0):0;if(F){var H=b0(F.endAngle-F.startAngle,O.endAngle-O.startAngle),K=Wo(Wo({},O),{},{startAngle:T+q,endAngle:T+H(C)+q});A.push(K),T=K.endAngle}else{var Z=O.endAngle,re=O.startAngle,ue=b0(0,Z-re),he=ue(C),be=Wo(Wo({},O),{},{startAngle:T+q,endAngle:T+he+q});A.push(be),T=be.endAngle}}),rt.createElement(ko,null,s.renderSectorsStatically(A))})}},{key:"attachKeyboardHandlers",value:function(s){var i=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var l=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[l].focus(),i.setState({sectorToFocus:l});break}case"ArrowRight":{var a=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[a].focus(),i.setState({sectorToFocus:a});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,i=s.sectors,o=s.isAnimationActive,l=this.state.prevSectors;return o&&i&&i.length&&(!l||!Sie(l,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,i=this.props,o=i.hide,l=i.sectors,a=i.className,h=i.label,p=i.cx,x=i.cy,y=i.innerRadius,w=i.outerRadius,j=i.isAnimationActive,S=this.state.isAnimationFinished;if(o||!l||!l.length||!Dn(p)||!Dn(x)||!Dn(y)||!Dn(w))return null;var C=ra("recharts-pie",a);return rt.createElement(ko,{tabIndex:this.props.rootTabIndex,className:C,ref:function(E){s.pieRef=E}},this.renderSectors(),h&&this.renderLabels(l),ld.renderCallByParent(this.props,null,!1),(!j||S)&&A1.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,i){return i.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==i.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:s.sectors!==i.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,i){return s>i?"start":s=360?T:T-1)*h,z=A-T*j-O,F=i.reduce(function(K,Z){var re=Xd(Z,E,0);return K+(Dn(re)?re:0)},0),q;if(F>0){var H;q=i.map(function(K,Z){var re=Xd(K,E,0),ue=Xd(K,x,Z),he=(Dn(re)?re:0)/F,be;Z?be=H.endAngle+Mu(C)*h*(re!==0?1:0):be=l;var ne=be+Mu(C)*((re!==0?j:0)+he*z),ye=(be+ne)/2,ie=(S.innerRadius+S.outerRadius)/2,fe=[{name:ue,value:re,payload:K,dataKey:E,type:w}],de=Xo(S.cx,S.cy,ie,ye);return H=Wo(Wo(Wo({percent:he,cornerRadius:o,name:ue,tooltipPayload:fe,midAngle:ye,middleRadius:ie,tooltipPosition:de},K),S),{},{value:Xd(K,E),startAngle:be,endAngle:ne,payload:K,paddingAngle:Mu(C)*h}),H})}return Wo(Wo({},S),{},{sectors:q,data:i})});var d$t=Math.ceil,u$t=Math.max;function h$t(e,t,n,s){for(var i=-1,o=u$t(d$t((t-e)/(n||1)),0),l=Array(o);o--;)l[s?o:++i]=e,e+=n;return l}var f$t=h$t,p$t=J7e,I3e=1/0,m$t=17976931348623157e292;function g$t(e){if(!e)return e===0?e:0;if(e=p$t(e),e===I3e||e===-I3e){var t=e<0?-1:1;return t*m$t}return e===e?e:0}var OBe=g$t,x$t=f$t,y$t=mie,ade=OBe;function v$t(e){return function(t,n,s){return s&&typeof s!="number"&&y$t(t,n,s)&&(n=s=void 0),t=ade(t),n===void 0?(n=t,t=0):n=ade(n),s=s===void 0?t0&&s.handleDrag(i.changedTouches[0])}),Lh(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=s.props,o=i.endIndex,l=i.onDragEnd,a=i.startIndex;l==null||l({endIndex:o,startIndex:a})}),s.detachDragEndListener()}),Lh(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Lh(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Lh(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Lh(s,"handleSlideDragStart",function(i){var o=R3e(i)?i.changedTouches[0]:i;s.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),s.attachDragEndListener()}),s.travellerDragStartHandlers={startX:s.handleTravellerDragStart.bind(s,"startX"),endX:s.handleTravellerDragStart.bind(s,"endX")},s.state={},s}return P$t(t,e),T$t(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var i=s.startX,o=s.endX,l=this.state.scaleValues,a=this.props,h=a.gap,p=a.data,x=p.length-1,y=Math.min(i,o),w=Math.max(i,o),j=t.getIndexInRange(l,y),S=t.getIndexInRange(l,w);return{startIndex:j-j%h,endIndex:S===x?x:S-S%h}}},{key:"getTextOfTick",value:function(s){var i=this.props,o=i.data,l=i.tickFormatter,a=i.dataKey,h=Xd(o[s],a,s);return Ri(l)?l(h,s):h}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var i=this.state,o=i.slideMoveStartX,l=i.startX,a=i.endX,h=this.props,p=h.x,x=h.width,y=h.travellerWidth,w=h.startIndex,j=h.endIndex,S=h.onChange,C=s.pageX-o;C>0?C=Math.min(C,p+x-y-a,p+x-y-l):C<0&&(C=Math.max(C,p-l,p-a));var A=this.getIndex({startX:l+C,endX:a+C});(A.startIndex!==w||A.endIndex!==j)&&S&&S(A),this.setState({startX:l+C,endX:a+C,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,i){var o=R3e(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var i=this.state,o=i.brushMoveStartX,l=i.movingTravellerId,a=i.endX,h=i.startX,p=this.state[l],x=this.props,y=x.x,w=x.width,j=x.travellerWidth,S=x.onChange,C=x.gap,A=x.data,E={startX:this.state.startX,endX:this.state.endX},T=s.pageX-o;T>0?T=Math.min(T,y+w-j-p):T<0&&(T=Math.max(T,y-p)),E[l]=p+T;var O=this.getIndex(E),z=O.startIndex,F=O.endIndex,q=function(){var K=A.length-1;return l==="startX"&&(a>h?z%C===0:F%C===0)||ah?F%C===0:z%C===0)||a>h&&F===K};this.setState(Lh(Lh({},l,p+T),"brushMoveStartX",s.pageX),function(){S&&q()&&S(O)})}},{key:"handleTravellerMoveKeyboard",value:function(s,i){var o=this,l=this.state,a=l.scaleValues,h=l.startX,p=l.endX,x=this.state[i],y=a.indexOf(x);if(y!==-1){var w=y+s;if(!(w===-1||w>=a.length)){var j=a[w];i==="startX"&&j>=p||i==="endX"&&j<=h||this.setState(Lh({},i,j),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,i=s.x,o=s.y,l=s.width,a=s.height,h=s.fill,p=s.stroke;return rt.createElement("rect",{stroke:p,fill:h,x:i,y:o,width:l,height:a})}},{key:"renderPanorama",value:function(){var s=this.props,i=s.x,o=s.y,l=s.width,a=s.height,h=s.data,p=s.children,x=s.padding,y=P.Children.only(p);return y?rt.cloneElement(y,{x:i,y:o,width:l,height:a,margin:x,compact:!0,data:h}):null}},{key:"renderTravellerLayer",value:function(s,i){var o,l,a=this,h=this.props,p=h.y,x=h.travellerWidth,y=h.height,w=h.traveller,j=h.ariaLabel,S=h.data,C=h.startIndex,A=h.endIndex,E=Math.max(s,this.props.x),T=ode(ode({},Ti(this.props,!1)),{},{x:E,y:p,width:x,height:y}),O=j||"Min value: ".concat((o=S[C])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=S[A])===null||l===void 0?void 0:l.name);return rt.createElement(ko,{tabIndex:0,role:"slider","aria-label":O,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(F){["ArrowLeft","ArrowRight"].includes(F.key)&&(F.preventDefault(),F.stopPropagation(),a.handleTravellerMoveKeyboard(F.key==="ArrowRight"?1:-1,i))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(w,T))}},{key:"renderSlide",value:function(s,i){var o=this.props,l=o.y,a=o.height,h=o.stroke,p=o.travellerWidth,x=Math.min(s,i)+p,y=Math.max(Math.abs(i-s)-p,0);return rt.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:h,fillOpacity:.2,x,y:l,width:y,height:a})}},{key:"renderText",value:function(){var s=this.props,i=s.startIndex,o=s.endIndex,l=s.y,a=s.height,h=s.travellerWidth,p=s.stroke,x=this.state,y=x.startX,w=x.endX,j=5,S={pointerEvents:"none",fill:p};return rt.createElement(ko,{className:"recharts-brush-texts"},rt.createElement(Kj,Xre({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,w)-j,y:l+a/2},S),this.getTextOfTick(i)),rt.createElement(Kj,Xre({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,w)+h+j,y:l+a/2},S),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,i=s.data,o=s.className,l=s.children,a=s.x,h=s.y,p=s.width,x=s.height,y=s.alwaysShowText,w=this.state,j=w.startX,S=w.endX,C=w.isTextActive,A=w.isSlideMoving,E=w.isTravellerMoving,T=w.isTravellerFocused;if(!i||!i.length||!Dn(a)||!Dn(h)||!Dn(p)||!Dn(x)||p<=0||x<=0)return null;var O=ra("recharts-brush",o),z=rt.Children.count(l)===1,F=C$t("userSelect","none");return rt.createElement(ko,{className:O,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),z&&this.renderPanorama(),this.renderSlide(j,S),this.renderTravellerLayer(j,"startX"),this.renderTravellerLayer(S,"endX"),(C||A||E||T||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var i=s.x,o=s.y,l=s.width,a=s.height,h=s.stroke,p=Math.floor(o+a/2)-1;return rt.createElement(rt.Fragment,null,rt.createElement("rect",{x:i,y:o,width:l,height:a,fill:h,stroke:"none"}),rt.createElement("line",{x1:i+1,y1:p,x2:i+l-1,y2:p,fill:"none",stroke:"#fff"}),rt.createElement("line",{x1:i+1,y1:p+2,x2:i+l-1,y2:p+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,i){var o;return rt.isValidElement(s)?o=rt.cloneElement(s,i):Ri(s)?o=s(i):o=t.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(s,i){var o=s.data,l=s.width,a=s.x,h=s.travellerWidth,p=s.updateId,x=s.startIndex,y=s.endIndex;if(o!==i.prevData||p!==i.prevUpdateId)return ode({prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:a,prevWidth:l},o&&o.length?O$t({data:o,width:l,x:a,travellerWidth:h,startIndex:x,endIndex:y}):{scale:null,scaleValues:null});if(i.scale&&(l!==i.prevWidth||a!==i.prevX||h!==i.prevTravellerWidth)){i.scale.range([a,a+l-h]);var w=i.scale.domain().map(function(j){return i.scale(j)});return{prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:a,prevWidth:l,startX:i.scale(s.startIndex),endX:i.scale(s.endIndex),scaleValues:w}}return null}},{key:"getIndexInRange",value:function(s,i){for(var o=s.length,l=0,a=o-1;a-l>1;){var h=Math.floor((l+a)/2);s[h]>i?a=h:l=h}return i>=s[a]?a:l}}])}(P.PureComponent);Lh(DC,"displayName","Brush");Lh(DC,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var D$t=Gye;function R$t(e,t){var n;return D$t(e,function(s,i,o){return n=t(s,i,o),!n}),!!n}var F$t=R$t,z$t=S7e,B$t=Ug,$$t=F$t,U$t=jh,q$t=mie;function V$t(e,t,n){var s=U$t(e)?z$t:$$t;return n&&q$t(e,t,n)&&(t=void 0),s(e,B$t(t))}var H$t=V$t;const W$t=za(H$t);var Tg=function(t,n){var s=t.alwaysShow,i=t.ifOverflow;return s&&(i="extendDomain"),i===n},F3e=K7e;function G$t(e,t,n){t=="__proto__"&&F3e?F3e(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var K$t=G$t,Z$t=K$t,Y$t=W7e,X$t=Ug;function Q$t(e,t){var n={};return t=X$t(t),Y$t(e,function(s,i,o){Z$t(n,i,t(s,i,o))}),n}var J$t=Q$t;const eUt=za(J$t);function tUt(e,t){for(var n=-1,s=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function yUt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function vUt(e,t){var n=e.x,s=e.y,i=xUt(e,fUt),o="".concat(n),l=parseInt(o,10),a="".concat(s),h=parseInt(a,10),p="".concat(t.height||i.height),x=parseInt(p,10),y="".concat(t.width||i.width),w=parseInt(y,10);return JM(JM(JM(JM(JM({},t),i),l?{x:l}:{}),h?{y:h}:{}),{},{height:x,width:w,name:t.name,radius:t.radius})}function B3e(e){return rt.createElement(IBe,_pe({shapeType:"rectangle",propTransformer:vUt,activeClassName:"recharts-active-bar"},e))}var _Ut=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,i){if(typeof t=="number")return t;var o=Dn(s)||WSt(s);return o?t(s,i):(o||Yj(),n)}},bUt=["value","background"],BBe;function RC(e){"@babel/helpers - typeof";return RC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},RC(e)}function wUt(e,t){if(e==null)return{};var n=jUt(e,t),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function jUt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Jre(){return Jre=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(ye)0&&Math.abs(ne)0&&(be=Math.min((ge||0)-(ne[Me-1]||0),be))}),Number.isFinite(be)){var ye=be/he,ie=C.layout==="vertical"?s.height:s.width;if(C.padding==="gap"&&(H=ye*ie/2),C.padding==="no-gap"){var fe=Tu(t.barCategoryGap,ye*ie),de=ye*ie/2;H=de-fe-(de-fe)/ie*fe}}}i==="xAxis"?K=[s.left+(O.left||0)+(H||0),s.left+s.width-(O.right||0)-(H||0)]:i==="yAxis"?K=h==="horizontal"?[s.top+s.height-(O.bottom||0),s.top+(O.top||0)]:[s.top+(O.top||0)+(H||0),s.top+s.height-(O.bottom||0)-(H||0)]:K=C.range,F&&(K=[K[1],K[0]]);var _e=aBe(C,o,w),Ee=_e.scale,ke=_e.realScaleType;Ee.domain(E).range(K),oBe(Ee);var pe=lBe(Ee,Jp(Jp({},C),{},{realScaleType:ke}));i==="xAxis"?(ue=A==="top"&&!z||A==="bottom"&&z,Z=s.left,re=y[q]-ue*C.height):i==="yAxis"&&(ue=A==="left"&&!z||A==="right"&&z,Z=y[q]-ue*C.width,re=s.top);var ae=Jp(Jp(Jp({},C),pe),{},{realScaleType:ke,x:Z,y:re,scale:Ee,width:i==="xAxis"?s.width:C.width,height:i==="yAxis"?s.height:C.height});return ae.bandSize=Fre(ae,pe),!C.hide&&i==="xAxis"?y[q]+=(ue?-1:1)*ae.height:C.hide||(y[q]+=(ue?-1:1)*ae.width),Jp(Jp({},j),{},Die({},S,ae))},{})},VBe=function(t,n){var s=t.x,i=t.y,o=n.x,l=n.y;return{x:Math.min(s,o),y:Math.min(i,l),width:Math.abs(o-s),height:Math.abs(l-i)}},OUt=function(t){var n=t.x1,s=t.y1,i=t.x2,o=t.y2;return VBe({x:n,y:s},{x:i,y:o})},HBe=function(){function e(t){EUt(this,e),this.scale=t}return IUt(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=s.bandAware,o=s.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(n)+a}default:return this.scale(n)}if(i){var h=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+h}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),i=s[0],o=s[s.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new e(n)}}])}();Die(HBe,"EPS",1e-4);var j0e=function(t){var n=Object.keys(t).reduce(function(s,i){return Jp(Jp({},s),{},Die({},i,HBe.create(t[i])))},{});return Jp(Jp({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,a=o.position;return eUt(i,function(h,p){return n[p].apply(h,{bandAware:l,position:a})})},isInRange:function(i){return zBe(i,function(o,l){return n[l].isInRange(o)})}})};function DUt(e){return(e%180+180)%180}var RUt=function(t){var n=t.width,s=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=DUt(i),l=o*Math.PI/180,a=Math.atan(s/n),h=l>a&&l-1?i[o?t[l]:l]:void 0}}var UUt=$Ut,qUt=OBe;function VUt(e){var t=qUt(e),n=t%1;return t===t?n?t-n:t:0}var HUt=VUt,WUt=B7e,GUt=Ug,KUt=HUt,ZUt=Math.max;function YUt(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var i=n==null?0:KUt(n);return i<0&&(i=ZUt(s+i,0)),WUt(e,GUt(t),i)}var XUt=YUt,QUt=UUt,JUt=XUt,eqt=QUt(JUt),tqt=eqt;const rqt=za(tqt);var nqt=Q4t(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),k0e=P.createContext(void 0),N0e=P.createContext(void 0),WBe=P.createContext(void 0),GBe=P.createContext({}),KBe=P.createContext(void 0),ZBe=P.createContext(0),YBe=P.createContext(0),H3e=function(t){var n=t.state,s=n.xAxisMap,i=n.yAxisMap,o=n.offset,l=t.clipPathId,a=t.children,h=t.width,p=t.height,x=nqt(o);return rt.createElement(k0e.Provider,{value:s},rt.createElement(N0e.Provider,{value:i},rt.createElement(GBe.Provider,{value:o},rt.createElement(WBe.Provider,{value:x},rt.createElement(KBe.Provider,{value:l},rt.createElement(ZBe.Provider,{value:p},rt.createElement(YBe.Provider,{value:h},a)))))))},sqt=function(){return P.useContext(KBe)},XBe=function(t){var n=P.useContext(k0e);n==null&&Yj();var s=n[t];return s==null&&Yj(),s},iqt=function(){var t=P.useContext(k0e);return M0(t)},aqt=function(){var t=P.useContext(N0e),n=rqt(t,function(s){return zBe(s.domain,Number.isFinite)});return n||M0(t)},QBe=function(t){var n=P.useContext(N0e);n==null&&Yj();var s=n[t];return s==null&&Yj(),s},oqt=function(){var t=P.useContext(WBe);return t},lqt=function(){return P.useContext(GBe)},S0e=function(){return P.useContext(YBe)},C0e=function(){return P.useContext(ZBe)};function FC(e){"@babel/helpers - typeof";return FC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},FC(e)}function cqt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dqt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);ne*i)return!1;var o=n();return e*(t-e*o/2-s)>=0&&e*(t+e*o/2-i)<=0}function Hqt(e,t){return i$e(e,t+1)}function Wqt(e,t,n,s,i){for(var o=(s||[]).slice(),l=t.start,a=t.end,h=0,p=1,x=l,y=function(){var S=s==null?void 0:s[h];if(S===void 0)return{v:i$e(s,p)};var C=h,A,E=function(){return A===void 0&&(A=n(S,C)),A},T=S.coordinate,O=h===0||sne(e,T,E,x,a);O||(h=0,x=l,p+=1),O&&(x=T+e*(E()/2+i),h+=p)},w;p<=o.length;)if(w=y(),w)return w.v;return[]}function KE(e){"@babel/helpers - typeof";return KE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},KE(e)}function J3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Kd(e){for(var t=1;t0?j.coordinate-A*e:j.coordinate})}else o[w]=j=Kd(Kd({},j),{},{tickCoord:j.coordinate});var E=sne(e,j.tickCoord,C,a,h);E&&(h=j.tickCoord-e*(C()/2+i),o[w]=Kd(Kd({},j),{},{isShow:!0}))},x=l-1;x>=0;x--)p(x);return o}function Xqt(e,t,n,s,i,o){var l=(s||[]).slice(),a=l.length,h=t.start,p=t.end;if(o){var x=s[a-1],y=n(x,a-1),w=e*(x.coordinate+e*y/2-p);l[a-1]=x=Kd(Kd({},x),{},{tickCoord:w>0?x.coordinate-w*e:x.coordinate});var j=sne(e,x.tickCoord,function(){return y},h,p);j&&(p=x.tickCoord-e*(y/2+i),l[a-1]=Kd(Kd({},x),{},{isShow:!0}))}for(var S=o?a-1:a,C=function(T){var O=l[T],z,F=function(){return z===void 0&&(z=n(O,T)),z};if(T===0){var q=e*(O.coordinate-e*F()/2-h);l[T]=O=Kd(Kd({},O),{},{tickCoord:q<0?O.coordinate-q*e:O.coordinate})}else l[T]=O=Kd(Kd({},O),{},{tickCoord:O.coordinate});var H=sne(e,O.tickCoord,F,h,p);H&&(h=O.tickCoord+e*(F()/2+i),l[T]=Kd(Kd({},O),{},{isShow:!0}))},A=0;A=2?Mu(i[1].coordinate-i[0].coordinate):1,E=Vqt(o,A,j);return h==="equidistantPreserveStart"?Wqt(A,E,C,i,l):(h==="preserveStart"||h==="preserveStartEnd"?w=Xqt(A,E,C,i,l,h==="preserveStartEnd"):w=Yqt(A,E,C,i,l),w.filter(function(T){return T.isShow}))}var Qqt=["viewBox"],Jqt=["viewBox"],eVt=["ticks"];function $C(e){"@babel/helpers - typeof";return $C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$C(e)}function z4(){return z4=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function tVt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function rVt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t5e(e,t){for(var n=0;n0?h(this.props):h(j)),l<=0||a<=0||!S||!S.length?null:rt.createElement(ko,{className:ra("recharts-cartesian-axis",p),ref:function(A){s.layerReference=A}},o&&this.renderAxisLine(),this.renderTicks(S,this.state.fontSize,this.state.letterSpacing),ld.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,i,o){var l,a=ra(i.className,"recharts-cartesian-axis-tick-value");return rt.isValidElement(s)?l=rt.cloneElement(s,Pc(Pc({},i),{},{className:a})):Ri(s)?l=s(Pc(Pc({},i),{},{className:a})):l=rt.createElement(Kj,z4({},i,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(P.Component);E0e(C3,"displayName","CartesianAxis");E0e(C3,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var cVt=["x1","y1","x2","y2","key"],dVt=["offset"];function Xj(e){"@babel/helpers - typeof";return Xj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xj(e)}function r5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Yd(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function pVt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var mVt=function(t){var n=t.fill;if(!n||n==="none")return null;var s=t.fillOpacity,i=t.x,o=t.y,l=t.width,a=t.height,h=t.ry;return rt.createElement("rect",{x:i,y:o,ry:h,width:l,height:a,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function l$e(e,t){var n;if(rt.isValidElement(e))n=rt.cloneElement(e,t);else if(Ri(e))n=e(t);else{var s=t.x1,i=t.y1,o=t.x2,l=t.y2,a=t.key,h=n5e(t,cVt),p=Ti(h,!1);p.offset;var x=n5e(p,dVt);n=rt.createElement("line",Gw({},x,{x1:s,y1:i,x2:o,y2:l,fill:"none",key:a}))}return n}function gVt(e){var t=e.x,n=e.width,s=e.horizontal,i=s===void 0?!0:s,o=e.horizontalPoints;if(!i||!o||!o.length)return null;var l=o.map(function(a,h){var p=Yd(Yd({},e),{},{x1:t,y1:a,x2:t+n,y2:a,key:"line-".concat(h),index:h});return l$e(i,p)});return rt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function xVt(e){var t=e.y,n=e.height,s=e.vertical,i=s===void 0?!0:s,o=e.verticalPoints;if(!i||!o||!o.length)return null;var l=o.map(function(a,h){var p=Yd(Yd({},e),{},{x1:a,y1:t,x2:a,y2:t+n,key:"line-".concat(h),index:h});return l$e(i,p)});return rt.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function yVt(e){var t=e.horizontalFill,n=e.fillOpacity,s=e.x,i=e.y,o=e.width,l=e.height,a=e.horizontalPoints,h=e.horizontal,p=h===void 0?!0:h;if(!p||!t||!t.length)return null;var x=a.map(function(w){return Math.round(w+i-i)}).sort(function(w,j){return w-j});i!==x[0]&&x.unshift(0);var y=x.map(function(w,j){var S=!x[j+1],C=S?i+l-w:x[j+1]-w;if(C<=0)return null;var A=j%t.length;return rt.createElement("rect",{key:"react-".concat(j),y:w,x:s,height:C,width:o,stroke:"none",fill:t[A],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return rt.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function vVt(e){var t=e.vertical,n=t===void 0?!0:t,s=e.verticalFill,i=e.fillOpacity,o=e.x,l=e.y,a=e.width,h=e.height,p=e.verticalPoints;if(!n||!s||!s.length)return null;var x=p.map(function(w){return Math.round(w+o-o)}).sort(function(w,j){return w-j});o!==x[0]&&x.unshift(0);var y=x.map(function(w,j){var S=!x[j+1],C=S?o+a-w:x[j+1]-w;if(C<=0)return null;var A=j%s.length;return rt.createElement("rect",{key:"react-".concat(j),x:w,y:l,width:C,height:h,stroke:"none",fill:s[A],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return rt.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var _Vt=function(t,n){var s=t.xAxis,i=t.width,o=t.height,l=t.offset;return iBe(A0e(Yd(Yd(Yd({},C3.defaultProps),s),{},{ticks:Rx(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),l.left,l.left+l.width,n)},bVt=function(t,n){var s=t.yAxis,i=t.width,o=t.height,l=t.offset;return iBe(A0e(Yd(Yd(Yd({},C3.defaultProps),s),{},{ticks:Rx(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),l.top,l.top+l.height,n)},u4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function c$e(e){var t,n,s,i,o,l,a=S0e(),h=C0e(),p=lqt(),x=Yd(Yd({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:u4.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:u4.fill,horizontal:(s=e.horizontal)!==null&&s!==void 0?s:u4.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:u4.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:u4.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:u4.verticalFill,x:Dn(e.x)?e.x:p.left,y:Dn(e.y)?e.y:p.top,width:Dn(e.width)?e.width:p.width,height:Dn(e.height)?e.height:p.height}),y=x.x,w=x.y,j=x.width,S=x.height,C=x.syncWithTicks,A=x.horizontalValues,E=x.verticalValues,T=iqt(),O=aqt();if(!Dn(j)||j<=0||!Dn(S)||S<=0||!Dn(y)||y!==+y||!Dn(w)||w!==+w)return null;var z=x.verticalCoordinatesGenerator||_Vt,F=x.horizontalCoordinatesGenerator||bVt,q=x.horizontalPoints,H=x.verticalPoints;if((!q||!q.length)&&Ri(F)){var K=A&&A.length,Z=F({yAxis:O?Yd(Yd({},O),{},{ticks:K?A:O.ticks}):void 0,width:a,height:h,offset:p},K?!0:C);vm(Array.isArray(Z),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Xj(Z),"]")),Array.isArray(Z)&&(q=Z)}if((!H||!H.length)&&Ri(z)){var re=E&&E.length,ue=z({xAxis:T?Yd(Yd({},T),{},{ticks:re?E:T.ticks}):void 0,width:a,height:h,offset:p},re?!0:C);vm(Array.isArray(ue),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Xj(ue),"]")),Array.isArray(ue)&&(H=ue)}return rt.createElement("g",{className:"recharts-cartesian-grid"},rt.createElement(mVt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),rt.createElement(gVt,Gw({},x,{offset:p,horizontalPoints:q,xAxis:T,yAxis:O})),rt.createElement(xVt,Gw({},x,{offset:p,verticalPoints:H,xAxis:T,yAxis:O})),rt.createElement(yVt,Gw({},x,{horizontalPoints:q})),rt.createElement(vVt,Gw({},x,{verticalPoints:H})))}c$e.displayName="CartesianGrid";function UC(e){"@babel/helpers - typeof";return UC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},UC(e)}function wVt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jVt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function cHt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function dHt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uHt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n0?l:t&&t.length&&Dn(i)&&Dn(o)?t.slice(i,o+1):[]};function j$e(e){return e==="number"?[0,"auto"]:void 0}var Rpe=function(t,n,s,i){var o=t.graphicalItems,l=t.tooltipAxis,a=qie(n,t);return s<0||!o||!o.length||s>=a.length?null:o.reduce(function(h,p){var x,y=(x=p.props.data)!==null&&x!==void 0?x:n;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=s&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var w;if(l.dataKey&&!l.allowDuplicatedCategory){var j=y===void 0?a:y;w=dfe(j,l.dataKey,i)}else w=y&&y[s]||a[s];return w?[].concat(HC(h),[dBe(p,w)]):h},[])},c5e=function(t,n,s,i){var o=i||{x:t.chartX,y:t.chartY},l=jHt(o,s),a=t.orderedTooltipTicks,h=t.tooltipAxis,p=t.tooltipTicks,x=sFt(l,a,p,h);if(x>=0&&p){var y=p[x]&&p[x].value,w=Rpe(t,n,x,y),j=kHt(s,a,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:w,activeCoordinate:j}}return null},NHt=function(t,n){var s=n.axes,i=n.graphicalItems,o=n.axisType,l=n.axisIdKey,a=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,y=t.children,w=t.stackOffset,j=sBe(x,o);return s.reduce(function(S,C){var A,E=C.type.defaultProps!==void 0?Yr(Yr({},C.type.defaultProps),C.props):C.props,T=E.type,O=E.dataKey,z=E.allowDataOverflow,F=E.allowDuplicatedCategory,q=E.scale,H=E.ticks,K=E.includeHidden,Z=E[l];if(S[Z])return S;var re=qie(t.data,{graphicalItems:i.filter(function(pe){var ae,ge=l in pe.props?pe.props[l]:(ae=pe.type.defaultProps)===null||ae===void 0?void 0:ae[l];return ge===Z}),dataStartIndex:h,dataEndIndex:p}),ue=re.length,he,be,ne;XVt(E.domain,z,T)&&(he=Qfe(E.domain,null,z),j&&(T==="number"||q!=="auto")&&(ne=bA(re,O,"category")));var ye=j$e(T);if(!he||he.length===0){var ie,fe=(ie=E.domain)!==null&&ie!==void 0?ie:ye;if(O){if(he=bA(re,O,T),T==="category"&&j){var de=KSt(he);F&&de?(be=he,he=Yre(0,ue)):F||(he=LCe(fe,he,C).reduce(function(pe,ae){return pe.indexOf(ae)>=0?pe:[].concat(HC(pe),[ae])},[]))}else if(T==="category")F?he=he.filter(function(pe){return pe!==""&&!_a(pe)}):he=LCe(fe,he,C).reduce(function(pe,ae){return pe.indexOf(ae)>=0||ae===""||_a(ae)?pe:[].concat(HC(pe),[ae])},[]);else if(T==="number"){var _e=cFt(re,i.filter(function(pe){var ae,ge,Me=l in pe.props?pe.props[l]:(ae=pe.type.defaultProps)===null||ae===void 0?void 0:ae[l],Ue="hide"in pe.props?pe.props.hide:(ge=pe.type.defaultProps)===null||ge===void 0?void 0:ge.hide;return Me===Z&&(K||!Ue)}),O,o,x);_e&&(he=_e)}j&&(T==="number"||q!=="auto")&&(ne=bA(re,O,"category"))}else j?he=Yre(0,ue):a&&a[Z]&&a[Z].hasStack&&T==="number"?he=w==="expand"?[0,1]:cBe(a[Z].stackGroups,h,p):he=nBe(re,i.filter(function(pe){var ae=l in pe.props?pe.props[l]:pe.type.defaultProps[l],ge="hide"in pe.props?pe.props.hide:pe.type.defaultProps.hide;return ae===Z&&(K||!ge)}),T,x,!0);if(T==="number")he=Lpe(y,he,Z,o,H),fe&&(he=Qfe(fe,he,z));else if(T==="category"&&fe){var Ee=fe,ke=he.every(function(pe){return Ee.indexOf(pe)>=0});ke&&(he=Ee)}}return Yr(Yr({},S),{},vi({},Z,Yr(Yr({},E),{},{axisType:o,domain:he,categoricalDomain:ne,duplicateDomain:be,originalDomain:(A=E.domain)!==null&&A!==void 0?A:ye,isCategorical:j,layout:x})))},{})},SHt=function(t,n){var s=n.graphicalItems,i=n.Axis,o=n.axisType,l=n.axisIdKey,a=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,y=t.children,w=qie(t.data,{graphicalItems:s,dataStartIndex:h,dataEndIndex:p}),j=w.length,S=sBe(x,o),C=-1;return s.reduce(function(A,E){var T=E.type.defaultProps!==void 0?Yr(Yr({},E.type.defaultProps),E.props):E.props,O=T[l],z=j$e("number");if(!A[O]){C++;var F;return S?F=Yre(0,j):a&&a[O]&&a[O].hasStack?(F=cBe(a[O].stackGroups,h,p),F=Lpe(y,F,O,o)):(F=Qfe(z,nBe(w,s.filter(function(q){var H,K,Z=l in q.props?q.props[l]:(H=q.type.defaultProps)===null||H===void 0?void 0:H[l],re="hide"in q.props?q.props.hide:(K=q.type.defaultProps)===null||K===void 0?void 0:K.hide;return Z===O&&!re}),"number",x),i.defaultProps.allowDataOverflow),F=Lpe(y,F,O,o)),Yr(Yr({},A),{},vi({},O,Yr(Yr({axisType:o},i.defaultProps),{},{hide:!0,orientation:tf(bHt,"".concat(o,".").concat(C%2),null),domain:F,originalDomain:z,isCategorical:S,layout:x})))}return A},{})},CHt=function(t,n){var s=n.axisType,i=s===void 0?"xAxis":s,o=n.AxisComp,l=n.graphicalItems,a=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.children,y="".concat(i,"Id"),w=Qf(x,o),j={};return w&&w.length?j=NHt(t,{axes:w,graphicalItems:l,axisType:i,axisIdKey:y,stackGroups:a,dataStartIndex:h,dataEndIndex:p}):l&&l.length&&(j=SHt(t,{Axis:o,graphicalItems:l,axisType:i,axisIdKey:y,stackGroups:a,dataStartIndex:h,dataEndIndex:p})),j},MHt=function(t){var n=M0(t),s=Rx(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:Kye(s,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Fre(n,s)}},d5e=function(t){var n=t.children,s=t.defaultShowTooltip,i=Rh(n,DC),o=0,l=0;return t.data&&t.data.length!==0&&(l=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(l=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:l,activeTooltipIndex:-1,isTooltipActive:!!s}},THt=function(t){return!t||!t.length?!1:t.some(function(n){var s=Yx(n&&n.type);return s&&s.indexOf("Bar")>=0})},u5e=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},AHt=function(t,n){var s=t.props,i=t.graphicalItems,o=t.xAxisMap,l=o===void 0?{}:o,a=t.yAxisMap,h=a===void 0?{}:a,p=s.width,x=s.height,y=s.children,w=s.margin||{},j=Rh(y,DC),S=Rh(y,PS),C=Object.keys(h).reduce(function(F,q){var H=h[q],K=H.orientation;return!H.mirror&&!H.hide?Yr(Yr({},F),{},vi({},K,F[K]+H.width)):F},{left:w.left||0,right:w.right||0}),A=Object.keys(l).reduce(function(F,q){var H=l[q],K=H.orientation;return!H.mirror&&!H.hide?Yr(Yr({},F),{},vi({},K,tf(F,"".concat(K))+H.height)):F},{top:w.top||0,bottom:w.bottom||0}),E=Yr(Yr({},A),C),T=E.bottom;j&&(E.bottom+=j.props.height||DC.defaultProps.height),S&&n&&(E=oFt(E,i,s,n));var O=p-E.left-E.right,z=x-E.top-E.bottom;return Yr(Yr({brushBottom:T},E),{},{width:Math.max(O,0),height:Math.max(z,0)})},EHt=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},k$e=function(t){var n=t.chartName,s=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,l=t.validateTooltipEventTypes,a=l===void 0?["axis"]:l,h=t.axisComponents,p=t.legendContent,x=t.formatAxisMap,y=t.defaultProps,w=function(E,T){var O=T.graphicalItems,z=T.stackGroups,F=T.offset,q=T.updateId,H=T.dataStartIndex,K=T.dataEndIndex,Z=E.barSize,re=E.layout,ue=E.barGap,he=E.barCategoryGap,be=E.maxBarSize,ne=u5e(re),ye=ne.numericAxisName,ie=ne.cateAxisName,fe=THt(O),de=[];return O.forEach(function(_e,Ee){var ke=qie(E.data,{graphicalItems:[_e],dataStartIndex:H,dataEndIndex:K}),pe=_e.type.defaultProps!==void 0?Yr(Yr({},_e.type.defaultProps),_e.props):_e.props,ae=pe.dataKey,ge=pe.maxBarSize,Me=pe["".concat(ye,"Id")],Ue=pe["".concat(ie,"Id")],Ie={},Ke=h.reduce(function(Qe,tt){var ht=T["".concat(tt.axisType,"Map")],wt=pe["".concat(tt.axisType,"Id")];ht&&ht[wt]||tt.axisType==="zAxis"||Yj();var Ct=ht[wt];return Yr(Yr({},Qe),{},vi(vi({},tt.axisType,Ct),"".concat(tt.axisType,"Ticks"),Rx(Ct)))},Ie),Re=Ke[ie],Ce=Ke["".concat(ie,"Ticks")],Je=z&&z[Me]&&z[Me].hasStack&&yFt(_e,z[Me].stackGroups),Te=Yx(_e.type).indexOf("Bar")>=0,Ye=Fre(Re,Ce),xe=[],mt=fe&&iFt({barSize:Z,stackGroups:z,totalSize:EHt(Ke,ie)});if(Te){var et,nt,Ae=_a(ge)?be:ge,pt=(et=(nt=Fre(Re,Ce,!0))!==null&&nt!==void 0?nt:Ae)!==null&&et!==void 0?et:0;xe=aFt({barGap:ue,barCategoryGap:he,bandSize:pt!==Ye?pt:Ye,sizeList:mt[Ue],maxBarSize:Ae}),pt!==Ye&&(xe=xe.map(function(Qe){return Yr(Yr({},Qe),{},{position:Yr(Yr({},Qe.position),{},{offset:Qe.position.offset-pt/2})})}))}var Be=_e&&_e.type&&_e.type.getComposedData;Be&&de.push({props:Yr(Yr({},Be(Yr(Yr({},Ke),{},{displayedData:ke,props:E,dataKey:ae,item:_e,bandSize:Ye,barPosition:xe,offset:F,stackedData:Je,layout:re,dataStartIndex:H,dataEndIndex:K}))),{},vi(vi(vi({key:_e.key||"item-".concat(Ee)},ye,Ke[ye]),ie,Ke[ie]),"animationId",q)),childIndex:aCt(_e,E.children),item:_e})}),de},j=function(E,T){var O=E.props,z=E.dataStartIndex,F=E.dataEndIndex,q=E.updateId;if(!M4e({props:O}))return null;var H=O.children,K=O.layout,Z=O.stackOffset,re=O.data,ue=O.reverseStackOrder,he=u5e(K),be=he.numericAxisName,ne=he.cateAxisName,ye=Qf(H,s),ie=gFt(re,ye,"".concat(be,"Id"),"".concat(ne,"Id"),Z,ue),fe=h.reduce(function(pe,ae){var ge="".concat(ae.axisType,"Map");return Yr(Yr({},pe),{},vi({},ge,CHt(O,Yr(Yr({},ae),{},{graphicalItems:ye,stackGroups:ae.axisType===be&&ie,dataStartIndex:z,dataEndIndex:F}))))},{}),de=AHt(Yr(Yr({},fe),{},{props:O,graphicalItems:ye}),T==null?void 0:T.legendBBox);Object.keys(fe).forEach(function(pe){fe[pe]=x(O,fe[pe],de,pe.replace("Map",""),n)});var _e=fe["".concat(ne,"Map")],Ee=MHt(_e),ke=w(O,Yr(Yr({},fe),{},{dataStartIndex:z,dataEndIndex:F,updateId:q,graphicalItems:ye,stackGroups:ie,offset:de}));return Yr(Yr({formattedGraphicalItems:ke,graphicalItems:ye,offset:de,stackGroups:ie},Ee),fe)},S=function(A){function E(T){var O,z,F;return dHt(this,E),F=fHt(this,E,[T]),vi(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),vi(F,"accessibilityManager",new YVt),vi(F,"handleLegendBBoxUpdate",function(q){if(q){var H=F.state,K=H.dataStartIndex,Z=H.dataEndIndex,re=H.updateId;F.setState(Yr({legendBBox:q},j({props:F.props,dataStartIndex:K,dataEndIndex:Z,updateId:re},Yr(Yr({},F.state),{},{legendBBox:q}))))}}),vi(F,"handleReceiveSyncEvent",function(q,H,K){if(F.props.syncId===q){if(K===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(H)}}),vi(F,"handleBrushChange",function(q){var H=q.startIndex,K=q.endIndex;if(H!==F.state.dataStartIndex||K!==F.state.dataEndIndex){var Z=F.state.updateId;F.setState(function(){return Yr({dataStartIndex:H,dataEndIndex:K},j({props:F.props,dataStartIndex:H,dataEndIndex:K,updateId:Z},F.state))}),F.triggerSyncEvent({dataStartIndex:H,dataEndIndex:K})}}),vi(F,"handleMouseEnter",function(q){var H=F.getMouseInfo(q);if(H){var K=Yr(Yr({},H),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseEnter;Ri(Z)&&Z(K,q)}}),vi(F,"triggeredAfterMouseMove",function(q){var H=F.getMouseInfo(q),K=H?Yr(Yr({},H),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseMove;Ri(Z)&&Z(K,q)}),vi(F,"handleItemMouseEnter",function(q){F.setState(function(){return{isTooltipActive:!0,activeItem:q,activePayload:q.tooltipPayload,activeCoordinate:q.tooltipPosition||{x:q.cx,y:q.cy}}})}),vi(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),vi(F,"handleMouseMove",function(q){q.persist(),F.throttleTriggeredAfterMouseMove(q)}),vi(F,"handleMouseLeave",function(q){F.throttleTriggeredAfterMouseMove.cancel();var H={isTooltipActive:!1};F.setState(H),F.triggerSyncEvent(H);var K=F.props.onMouseLeave;Ri(K)&&K(H,q)}),vi(F,"handleOuterEvent",function(q){var H=iCt(q),K=tf(F.props,"".concat(H));if(H&&Ri(K)){var Z,re;/.*touch.*/i.test(H)?re=F.getMouseInfo(q.changedTouches[0]):re=F.getMouseInfo(q),K((Z=re)!==null&&Z!==void 0?Z:{},q)}}),vi(F,"handleClick",function(q){var H=F.getMouseInfo(q);if(H){var K=Yr(Yr({},H),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onClick;Ri(Z)&&Z(K,q)}}),vi(F,"handleMouseDown",function(q){var H=F.props.onMouseDown;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"handleMouseUp",function(q){var H=F.props.onMouseUp;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"handleTouchMove",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(q.changedTouches[0])}),vi(F,"handleTouchStart",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseDown(q.changedTouches[0])}),vi(F,"handleTouchEnd",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseUp(q.changedTouches[0])}),vi(F,"handleDoubleClick",function(q){var H=F.props.onDoubleClick;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"handleContextMenu",function(q){var H=F.props.onContextMenu;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"triggerSyncEvent",function(q){F.props.syncId!==void 0&&cde.emit(dde,F.props.syncId,q,F.eventEmitterSymbol)}),vi(F,"applySyncEvent",function(q){var H=F.props,K=H.layout,Z=H.syncMethod,re=F.state.updateId,ue=q.dataStartIndex,he=q.dataEndIndex;if(q.dataStartIndex!==void 0||q.dataEndIndex!==void 0)F.setState(Yr({dataStartIndex:ue,dataEndIndex:he},j({props:F.props,dataStartIndex:ue,dataEndIndex:he,updateId:re},F.state)));else if(q.activeTooltipIndex!==void 0){var be=q.chartX,ne=q.chartY,ye=q.activeTooltipIndex,ie=F.state,fe=ie.offset,de=ie.tooltipTicks;if(!fe)return;if(typeof Z=="function")ye=Z(de,q);else if(Z==="value"){ye=-1;for(var _e=0;_e=0){var Je,Te;if(be.dataKey&&!be.allowDuplicatedCategory){var Ye=typeof be.dataKey=="function"?Ce:"payload.".concat(be.dataKey.toString());Je=dfe(_e,Ye,ye),Te=Ee&&ke&&dfe(ke,Ye,ye)}else Je=_e==null?void 0:_e[ne],Te=Ee&&ke&&ke[ne];if(Ue||Me){var xe=q.props.activeIndex!==void 0?q.props.activeIndex:ne;return[P.cloneElement(q,Yr(Yr(Yr({},Z.props),Ke),{},{activeIndex:xe})),null,null]}if(!_a(Je))return[Re].concat(HC(F.renderActivePoints({item:Z,activePoint:Je,basePoint:Te,childIndex:ne,isRange:Ee})))}else{var mt,et=(mt=F.getItemByXY(F.state.activeCoordinate))!==null&&mt!==void 0?mt:{graphicalItem:Re},nt=et.graphicalItem,Ae=nt.item,pt=Ae===void 0?q:Ae,Be=nt.childIndex,Qe=Yr(Yr(Yr({},Z.props),Ke),{},{activeIndex:Be});return[P.cloneElement(pt,Qe),null,null]}return Ee?[Re,null,null]:[Re,null]}),vi(F,"renderCustomized",function(q,H,K){return P.cloneElement(q,Yr(Yr({key:"recharts-customized-".concat(K)},F.props),F.state))}),vi(F,"renderMap",{CartesianGrid:{handler:QL,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:QL},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:QL},YAxis:{handler:QL},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((O=T.id)!==null&&O!==void 0?O:FI("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=e9e(F.triggeredAfterMouseMove,(z=T.throttleDelay)!==null&&z!==void 0?z:1e3/60),F.state={},F}return gHt(E,A),hHt(E,[{key:"componentDidMount",value:function(){var O,z;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(z=this.props.margin.top)!==null&&z!==void 0?z:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var O=this.props,z=O.children,F=O.data,q=O.height,H=O.layout,K=Rh(z,Qp);if(K){var Z=K.props.defaultIndex;if(!(typeof Z!="number"||Z<0||Z>this.state.tooltipTicks.length-1)){var re=this.state.tooltipTicks[Z]&&this.state.tooltipTicks[Z].value,ue=Rpe(this.state,F,Z,re),he=this.state.tooltipTicks[Z].coordinate,be=(this.state.offset.top+q)/2,ne=H==="horizontal",ye=ne?{x:he,y:be}:{y:he,x:be},ie=this.state.formattedGraphicalItems.find(function(de){var _e=de.item;return _e.type.name==="Scatter"});ie&&(ye=Yr(Yr({},ye),ie.props.points[Z].tooltipPosition),ue=ie.props.points[Z].tooltipPayload);var fe={activeTooltipIndex:Z,isTooltipActive:!0,activeLabel:re,activePayload:ue,activeCoordinate:ye};this.setState(fe),this.renderCursor(K),this.accessibilityManager.setIndex(Z)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,z){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==z.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var F,q;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:(q=this.props.margin.top)!==null&&q!==void 0?q:0}})}return null}},{key:"componentDidUpdate",value:function(O){hfe([Rh(O.children,Qp)],[Rh(this.props.children,Qp)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=Rh(this.props.children,Qp);if(O&&typeof O.props.shared=="boolean"){var z=O.props.shared?"axis":"item";return a.indexOf(z)>=0?z:o}return o}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var z=this.container,F=z.getBoundingClientRect(),q=ILt(F),H={chartX:Math.round(O.pageX-q.left),chartY:Math.round(O.pageY-q.top)},K=F.width/z.offsetWidth||1,Z=this.inRange(H.chartX,H.chartY,K);if(!Z)return null;var re=this.state,ue=re.xAxisMap,he=re.yAxisMap,be=this.getTooltipEventType(),ne=c5e(this.state,this.props.data,this.props.layout,Z);if(be!=="axis"&&ue&&he){var ye=M0(ue).scale,ie=M0(he).scale,fe=ye&&ye.invert?ye.invert(H.chartX):null,de=ie&&ie.invert?ie.invert(H.chartY):null;return Yr(Yr({},H),{},{xValue:fe,yValue:de},ne)}return ne?Yr(Yr({},H),ne):null}},{key:"inRange",value:function(O,z){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,q=this.props.layout,H=O/F,K=z/F;if(q==="horizontal"||q==="vertical"){var Z=this.state.offset,re=H>=Z.left&&H<=Z.left+Z.width&&K>=Z.top&&K<=Z.top+Z.height;return re?{x:H,y:K}:null}var ue=this.state,he=ue.angleAxisMap,be=ue.radiusAxisMap;if(he&&be){var ne=M0(he);return RCe({x:H,y:K},ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,z=this.getTooltipEventType(),F=Rh(O,Qp),q={};F&&z==="axis"&&(F.props.trigger==="click"?q={onClick:this.handleClick}:q={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var H=ure(this.props,this.handleOuterEvent);return Yr(Yr({},H),q)}},{key:"addListener",value:function(){cde.on(dde,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){cde.removeListener(dde,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,z,F){for(var q=this.state.formattedGraphicalItems,H=0,K=q.length;H");return e}const C$e=P.forwardRef(({id:e,className:t,children:n,config:s,...i},o)=>{const l=P.useId(),a=`chart-${e||l.replace(/:/g,"")}`;return r.jsx(N$e.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":a,ref:o,className:$t("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...i,children:[r.jsx(OHt,{id:a,config:s}),r.jsx(Ofe,{children:n})]})})});C$e.displayName="Chart";const OHt=({id:e,config:t})=>{const n=Object.entries(t).filter(([s,i])=>i.theme||i.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(LHt).map(([s,i])=>` ${i} [data-chart=${e}] { ${n.map(([o,l])=>{var h;const a=((h=l.theme)==null?void 0:h[s])||l.color;return a?` --color-${o}: ${a};`:null}).join(` `)} } `).join(` `)}}):null},M$e=P.forwardRef(({active:e,payload:t,className:n,indicator:s="dot",hideLabel:i=!1,hideIndicator:o=!1,label:l,labelFormatter:a,labelClassName:h,formatter:p,color:x,nameKey:y,labelKey:w},j)=>{const{config:S}=S$e(),C=P.useMemo(()=>{var F;if(i||!(t!=null&&t.length))return null;const[E]=t,T=`${w||E.dataKey||E.name||"value"}`,O=Fpe(S,E,T),z=!w&&typeof l=="string"?((F=S[l])==null?void 0:F.label)||l:O==null?void 0:O.label;return a?r.jsx("div",{className:$t("font-medium",h),children:a(z,t)}):z?r.jsx("div",{className:$t("font-medium",h),children:z}):null},[l,a,t,i,h,S,w]);if(!e||!(t!=null&&t.length))return null;const A=t.length===1&&s!=="dot";return r.jsxs("div",{ref:j,className:$t("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[A?null:C,r.jsx("div",{className:"grid gap-1.5",children:t.map((E,T)=>{const O=`${y||E.name||E.dataKey||"value"}`,z=Fpe(S,E,O),F=x||E.payload.fill||E.color;return r.jsx("div",{className:$t("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",s==="dot"&&"items-center"),children:p&&(E==null?void 0:E.value)!==void 0&&E.name?p(E.value,E.name,E,T,E.payload):r.jsxs(r.Fragment,{children:[z!=null&&z.icon?r.jsx(z.icon,{}):!o&&r.jsx("div",{className:$t("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":s==="dot","w-1":s==="line","w-0 border-[1.5px] border-dashed bg-transparent":s==="dashed","my-0.5":A&&s==="dashed"}),style:{"--color-bg":F,"--color-border":F}}),r.jsxs("div",{className:$t("flex flex-1 justify-between leading-none",A?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[A?C:null,r.jsx("span",{className:"text-muted-foreground",children:(z==null?void 0:z.label)||E.name})]}),E.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:E.value.toLocaleString()})]})]})},E.dataKey)})})]})});M$e.displayName="ChartTooltip";const DHt=P.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:s="bottom",nameKey:i},o)=>{const{config:l}=S$e();return n!=null&&n.length?r.jsx("div",{ref:o,className:$t("flex items-center justify-center gap-4",s==="top"?"pb-3":"pt-3",e),children:n.map(a=>{const h=`${i||a.dataKey||"value"}`,p=Fpe(l,a,h);return r.jsxs("div",{className:$t("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[p!=null&&p.icon&&!t?r.jsx(p.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:a.color}}),p==null?void 0:p.label]},a.value)})}):null});DHt.displayName="ChartLegend";function Fpe(e,t,n){if(typeof t!="object"||t===null)return;const s="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let i=n;return n in t&&typeof t[n]=="string"?i=t[n]:s&&n in s&&typeof s[n]=="string"&&(i=s[n]),i in e?e[i]:e[n]}const JL=["hsl(var(--primary))","hsl(var(--secondary))","hsl(210, 70%, 50%)","hsl(170, 60%, 45%)","hsl(280, 60%, 55%)","hsl(30, 70%, 50%)","hsl(340, 65%, 55%)","hsl(200, 65%, 50%)"];function T$e({stats:e,year:t}){const n=e.transactionsByMonth.some(i=>i.count>0),s=e.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(We,{children:r.jsx(Xe,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):r.jsxs("div",{className:"grid gap-6",children:[n&&r.jsxs(We,{className:"overflow-hidden",children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(Xe,{className:"overflow-hidden",children:r.jsx(C$e,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Ofe,{width:"100%",height:"100%",children:r.jsxs(IHt,{data:e.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(c$e,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx($ie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(Uie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(Qp,{content:r.jsx(M$e,{})}),r.jsx(dk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(Xe,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Ofe,{width:"100%",height:"100%",children:r.jsxs(PHt,{children:[r.jsx(yy,{data:e.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:i,percent:o})=>o>.05?`${i} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:e.leadSourceBreakdown.map((i,o)=>r.jsx(gie,{fill:JL[o%JL.length]},`cell-${o}`))}),r.jsx(Qp,{formatter:(i,o)=>[`${i} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:e.leadSourceBreakdown.slice(0,6).map((i,o)=>r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:JL[o%JL.length]}}),r.jsx("span",{className:"text-muted-foreground",children:i.name})]},i.name))})]})]})]})}function RHt(e){if(!e||!e.trim())return null;const t=e.trim(),n=["yyyy-MM-dd","M/d/yyyy","MM/dd/yyyy","M-d-yyyy","MM-dd-yyyy","MM/dd/yy","M/d/yy"];for(const s of n)try{const i=uxe(t,s,new Date);if(bhe(i))return fn(i,"yyyy-MM-dd")}catch{}try{const s=new Date(t);if(bhe(s))return fn(s,"yyyy-MM-dd")}catch{}return null}const FHt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function zHt({open:e,onOpenChange:t}){const[n,s]=P.useState([]),[i,o]=P.useState(!1),[l,a]=P.useState(0),{data:h}=wse(),{data:p}=Bg(),x=jse(),y=()=>{const E=FHt.join(","),T=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),O=`${E} ${T}`,z=new Blob([O],{type:"text/csv"}),F=URL.createObjectURL(z),q=document.createElement("a");q.href=F,q.download="transaction-import-template.csv",q.click(),URL.revokeObjectURL(F)},w=E=>{const T=E.split(` `).filter(z=>z.trim());if(T.length<2)return[];const O=T[0].split(",").map(z=>z.trim().toLowerCase().replace(/['"]/g,""));return T.slice(1).map((z,F)=>{var fe,de,_e,Ee;const q=[];let H="",K=!1;for(const ke of z)ke==='"'?K=!K:ke===","&&!K?(q.push(H.trim()),H=""):H+=ke;q.push(H.trim());const Z=ke=>{var ae;const pe=O.indexOf(ke);return pe>=0?(ae=q[pe])==null?void 0:ae.replace(/^["']|["']$/g,"").trim():""},re=(fe=Z("transaction_type"))==null?void 0:fe.toLowerCase(),ue=(de=Z("sale_price"))==null?void 0:de.replace(/[$,]/g,""),he=(_e=Z("commission_amount"))==null?void 0:_e.replace(/[$,]/g,""),be=(Ee=Z("is_win"))==null?void 0:Ee.toLowerCase(),ne=Z("close_date"),ye=RHt(ne);let ie;return Z("property_address")?["buyer","seller"].includes(re)?ye?(!ue||isNaN(Number(ue)))&&(ie="Invalid sale price"):ie=`Invalid date format: "${ne}" - use MM/DD/YYYY or YYYY-MM-DD`:ie='Transaction type must be "buyer" or "seller"':ie="Missing property address",{property_address:Z("property_address"),city:Z("city"),state:Z("state"),zip:Z("zip"),transaction_type:re==="seller"?"seller":"buyer",close_date:ye||"",sale_price:Number(ue)||0,commission_amount:he?Number(he):null,lead_source_name:Z("lead_source"),client_type_name:Z("client_type"),is_win:["yes","true","1"].includes(be),notes:Z("notes"),error:ie}})},j=E=>{var z;const T=(z=E.target.files)==null?void 0:z[0];if(!T)return;const O=new FileReader;O.onload=F=>{var K;const q=(K=F.target)==null?void 0:K.result,H=w(q);s(H)},O.readAsText(T)},S=async()=>{const E=n.filter(z=>!z.error);if(E.length===0){ze.error("No valid transactions to import");return}o(!0),a(0);let T=0,O=0;for(let z=0;zK.name.toLowerCase()===F.lead_source_name.toLowerCase()),H=p==null?void 0:p.find(K=>K.name.toLowerCase()===F.client_type_name.toLowerCase());await x.mutateAsync({property_address:F.property_address,city:F.city||null,state:F.state||null,zip:F.zip||null,transaction_type:F.transaction_type,close_date:F.close_date,sale_price:F.sale_price,commission_amount:F.commission_amount,lead_source_id:(q==null?void 0:q.id)||null,client_type_id:(H==null?void 0:H.id)||null,contact_id:null,notes:F.notes||null,is_win:F.is_win}),T++}catch(q){O++,console.error("Failed to import transaction:",q)}a(Math.round((z+1)/E.length*100))}o(!1),T>0&&ze.success(`Imported ${T} transaction${T>1?"s":""}`),O>0&&ze.error(`Failed to import ${O} transaction${O>1?"s":""}`),s([]),t(!1)},C=n.filter(E=>!E.error).length,A=n.filter(E=>E.error).length;return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Import Transactions"}),r.jsx(es,{children:"Upload a CSV file with your past transactions"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Download Template"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Get a CSV template with the correct format"})]}),r.jsxs(J,{variant:"outline",onClick:y,children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(ct,{id:"csv-file",type:"file",accept:".csv",onChange:j})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ft,{variant:"outline",children:[n.length," rows found"]}),C>0&&r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1"}),C," valid"]}),A>0&&r.jsxs(Ft,{variant:"destructive",children:[r.jsx(El,{className:"h-3 w-3 mr-1"}),A," errors"]})]}),r.jsx(Jo,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((E,T)=>r.jsxs("div",{className:`p-2 rounded text-sm ${E.error?"bg-destructive/10":"bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:E.property_address||"(no address)"}),r.jsx(Ft,{variant:E.transaction_type==="buyer"?"default":"secondary",children:E.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[E.close_date," • $",E.sale_price.toLocaleString()]}),E.error&&r.jsx(Oxe,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(Dxe,{className:"text-xs",children:E.error})})]},T)),n.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",n.length-10," more"]})]})}),i&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${l}%`}})}),r.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Importing... ",l,"%"]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(J,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(J,{onClick:S,disabled:C===0||i,children:[r.jsx(go,{className:"h-4 w-4 mr-2"}),"Import ",C," Transaction",C!==1?"s":""]})]})]})]})})}const BHt=d3({transactions_goal:iA().min(0).optional(),volume_goal:iA().min(0).optional(),gci_goal:iA().min(0).optional()});function $Ht({open:e,onOpenChange:t,year:n,existingGoals:s}){const i=xpt(),{data:o}=kse(),l=(o==null?void 0:o.show_commission)??!0,a=dse({resolver:use(BHt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});P.useEffect(()=>{s?a.reset({transactions_goal:s.transactions_goal??void 0,volume_goal:s.volume_goal?Number(s.volume_goal):void 0,gci_goal:s.gci_goal?Number(s.gci_goal):void 0}):a.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[s,a,e]);const h=async p=>{await i.mutateAsync({year:n,transactions_goal:p.transactions_goal??null,volume_goal:p.volume_goal??null,gci_goal:l?p.gci_goal??null:null}),t(!1)};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[n," Goals"]}),r.jsx(es,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(hse,{...a,children:r.jsxs("form",{onSubmit:a.handleSubmit(h),className:"space-y-4",children:[r.jsx(Ml,{control:a.control,name:"transactions_goal",render:({field:p})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Transactions Goal"}),r.jsx(bl,{children:r.jsx(ct,{type:"number",placeholder:"e.g., 24",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(oee,{children:"Total number of deals you want to close"}),r.jsx(bu,{})]})}),r.jsx(Ml,{control:a.control,name:"volume_goal",render:({field:p})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"Volume Goal ($)"}),r.jsx(bl,{children:r.jsx(ct,{type:"number",placeholder:"e.g., 5000000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(oee,{children:"Total sales volume you want to achieve"}),r.jsx(bu,{})]})}),l&&r.jsx(Ml,{control:a.control,name:"gci_goal",render:({field:p})=>r.jsxs(vl,{children:[r.jsx(_l,{children:"GCI Goal ($)"}),r.jsx(bl,{children:r.jsx(ct,{type:"number",placeholder:"e.g., 150000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(oee,{children:"Gross commission income target"}),r.jsx(bu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(J,{type:"submit",disabled:i.isPending,children:"Save Goals"})]})]})})]})})}const A$e=new Date().getFullYear(),UHt=Array.from({length:10},(e,t)=>A$e-t);function qHt(){var F;const[e,t]=P.useState(A$e),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[l,a]=P.useState(!1),[h,p]=P.useState(!1),{data:x,isLoading:y}=jxe(e),{yearStats:w,lifetimeStats:j,showCommission:S}=LOe(e),{data:C,isLoading:A}=POe(e),{data:E}=kse(),T=ypt(),O=()=>{if(!x||x.length===0)return;const q=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...S?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],H=x.map(he=>{var be,ne;return[he.property_address,he.city||"",he.state||"",he.zip||"",he.transaction_type,he.close_date,he.sale_price,...S?[he.commission_amount||""]:[],((be=he.lead_source)==null?void 0:be.name)||"",((ne=he.client_type)==null?void 0:ne.name)||"",he.contact?`${he.contact.first_name} ${he.contact.last_name||""}`.trim():"",he.is_win?"Yes":"No",he.notes||""]}),K=[q,...H].map(he=>he.map(be=>`"${String(be).replace(/"/g,'""')}"`).join(",")).join(` `),Z=new Blob([K],{type:"text/csv"}),re=URL.createObjectURL(Z),ue=document.createElement("a");ue.href=re,ue.download=`transactions-${e}.csv`,ue.click(),URL.revokeObjectURL(re)},z=!x||x.length===0;return r.jsxs(Or,{title:"Scorecard",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Scorecard"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Business Scorecard"}),r.jsx("p",{className:"text-muted-foreground",children:"Track your transactions, goals, and performance"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(bn,{value:String(e),onValueChange:q=>t(Number(q)),children:[r.jsx(vn,{className:"w-[120px]",children:r.jsx(wn,{})}),r.jsx(_n,{children:UHt.map(q=>r.jsx(Kt,{value:String(q),children:q},q))})]}),r.jsx(J,{variant:"outline",size:"icon",onClick:()=>p(!h),children:r.jsx(hd,{className:"h-4 w-4"})})]})]}),h&&r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsx(Xt,{className:"text-lg",children:"Settings"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Ve,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx($s,{checked:(E==null?void 0:E.show_commission)??!0,onCheckedChange:q=>T.mutate({show_commission:q})})]})})]}),z&&!y?r.jsx(We,{className:"py-12",children:r.jsxs(Xe,{className:"text-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(ac,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Start Tracking Your Success"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mt-1",children:"Add your past transactions to see your performance metrics, track your goals, and celebrate your wins."})]}),r.jsxs("div",{className:"flex flex-wrap justify-center gap-2 pt-2",children:[r.jsxs(J,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(J,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(go,{className:"h-4 w-4 mr-2"}),"Import CSV"]})]}),r.jsxs("div",{className:"pt-4 border-t mt-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Need help formatting your data?"}),r.jsx(J,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download CSV Template"]})})]})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(J,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(J,{variant:"outline",onClick:()=>a(!0),children:[r.jsx(Wx,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(J,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(go,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(J,{variant:"outline",onClick:O,disabled:z,children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"CSV Template"]})})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:w.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.totalTransactions," lifetime"]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Kn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[w.buyerCount,"/",w.sellerCount]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ud,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Td(w.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Td(j.totalVolume,!0)," lifetime"]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Kf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Td(w.averagePrice,!0)})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Pl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((F=w.topLeadSource)==null?void 0:F.name)||"-"}),w.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.topLeadSource.count," deals"]})]})}),S&&r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ud,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Td(w.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Td(j.totalCommission,!0)," lifetime"]})]})})]}),C&&r.jsx(zze,{goals:C,stats:w,year:e,showCommission:S}),r.jsxs(ba,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"transactions",children:"Transactions"}),r.jsx(ln,{value:"charts",children:"Charts"})]}),r.jsx(An,{value:"transactions",children:r.jsx(Fze,{transactions:x||[],showCommission:S,isLoading:y})}),r.jsx(An,{value:"charts",children:r.jsx(T$e,{stats:w,year:e})})]})]})]}),r.jsx(Rze,{open:n,onOpenChange:s}),r.jsx(zHt,{open:i,onOpenChange:o}),r.jsx($Ht,{open:l,onOpenChange:a,year:e,existingGoals:C})]})}function E$e({open:e,onOpenChange:t,listingId:n,listingSlug:s,listingTitle:i}){const{user:o}=zr(),[l,a]=P.useState(null),[h,p]=P.useState(!1),[x,y]=P.useState(!1);P.useEffect(()=>{(async()=>{if(!(!e||!o)){p(!0);try{const{data:A,error:E}=await ee.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",n).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(E)throw E;if(A&&A.share_token)a(A);else if(A&&!A.share_token){const{data:T,error:O}=await ee.from("listing_shares").update({share_type:"referral_link"}).eq("id",A.id).select("id, share_token, click_count, lead_count").single();if(O)throw O;a(T)}else{const{data:T,error:O}=await ee.from("listing_shares").insert({listing_id:n,sharing_agent_id:o.id,share_type:"referral_link"}).select("id, share_token, click_count, lead_count").single();if(O)throw O;a(T)}}catch(A){console.error("Error creating share link:",A),ze.error("Failed to generate share link")}finally{p(!1)}}})()},[e,o,n]);const w=l!=null&&l.share_token?`https://listings.relevelup.com/${s||n}?ref=${l.share_token}`:"",j=async()=>{try{await navigator.clipboard.writeText(w),y(!0),ze.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{ze.error("Failed to copy link")}},S=C=>{const A=encodeURIComponent(w),E=encodeURIComponent(`Check out this listing: ${i}`);switch(C){case"email":window.open(`mailto:?subject=${E}&body=${A}`);break;case"text":window.open(`sms:?body=${E}%20${A}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${A}`,"_blank");break}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Ss,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(es,{children:"Share this listing with your network. When someone submits a lead through your link, they'll become your contact!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:r.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[r.jsx("strong",{children:"How it works:"})," The listing still shows the original agent's info, but any leads from your unique link go directly to you!"]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:h?"Generating...":w,readOnly:!0,className:"font-mono text-sm"}),r.jsx(J,{onClick:j,disabled:h||!w,variant:x?"default":"outline",children:x?r.jsx(Ca,{className:"h-4 w-4"}):r.jsx(jl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(J,{variant:"outline",className:"flex-1",onClick:()=>S("email"),disabled:h,children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(J,{variant:"outline",className:"flex-1",onClick:()=>S("text"),disabled:h,children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(J,{variant:"outline",className:"flex-1",onClick:()=>S("facebook"),disabled:h,children:[r.jsx(Pd,{className:"h-4 w-4 mr-2"}),"Facebook"]})]})]}),l&&(l.click_count>0||l.lead_count>0)&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx(Ve,{className:"mb-2 block",children:"Your Share Performance"}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground mb-1",children:[r.jsx(Qo,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Clicks"})]}),r.jsx("p",{className:"text-2xl font-bold",children:l.click_count})]}),r.jsxs("div",{className:"bg-primary/10 rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-primary mb-1",children:[r.jsx(Kn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Leads"})]}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:l.lead_count})]})]})]})]})]})})}const VHt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},HHt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},WHt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function e8({listing:e,onClick:t,onEdit:n,onDelete:s,showActions:i}){var C,A;const{user:o}=zr(),{data:l}=COe(e.id),a=SOe(),[h,p]=P.useState(!1),x=E=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(E),y=((C=e.photos)==null?void 0:C.find(E=>E.is_primary))||((A=e.photos)==null?void 0:A[0]),w=(o==null?void 0:o.id)===e.agent_id,j=async E=>{E.stopPropagation();try{const T=await a.mutateAsync(e.id);ze.success(T.saved?"Listing saved!":"Listing removed from saved")}catch{ze.error("Failed to save listing")}},S=E=>{if(E.stopPropagation(),o)p(!0);else{const T=`https://listings.relevelup.com/${e.slug||e.id}`;navigator.clipboard.writeText(T),ze.success("Link copied to clipboard!")}};return r.jsxs(We,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:t,children:[r.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[y?r.jsx("img",{src:y.photo_url,alt:e.property_address||e.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(xm,{className:"h-12 w-12"})}),r.jsx(Ft,{className:`absolute top-2 left-2 ${VHt[e.status]} text-white border-0`,children:HHt[e.status]}),e.is_featured&&r.jsx("div",{className:"absolute top-2 right-2 p-1.5 bg-amber-500 rounded-full",children:r.jsx(vs,{className:"h-4 w-4 text-white fill-white"})}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[r.jsx(J,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:j,children:r.jsx(oa,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),r.jsx(J,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:S,title:w?"Copy link":"Share & earn leads",children:w?r.jsx(dc,{className:"h-4 w-4"}):r.jsx(Ss,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(E$e,{open:h,onOpenChange:p,listingId:e.id,listingSlug:e.slug||null,listingTitle:e.property_address||`${e.city}, ${e.state}`}),r.jsxs(Xe,{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xl font-bold text-primary",children:x(e.price)}),e.open_to_referrals&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:[r.jsx(Kn,{className:"h-3 w-3 mr-1"}),"Referrals"]})]}),r.jsxs("div",{children:[e.property_address&&r.jsx("p",{className:"font-medium truncate",children:e.property_address}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(pl,{className:"h-3 w-3"}),e.city,", ",e.state,e.neighborhood&&` • ${e.neighborhood}`]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.bedrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Vf,{className:"h-4 w-4"}),e.bedrooms," bd"]}),e.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(qf,{className:"h-4 w-4"}),e.bathrooms," ba"]}),e.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(xm,{className:"h-4 w-4"}),e.square_footage.toLocaleString()," sqft"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsx(Ft,{variant:"secondary",className:"text-xs",children:WHt[e.property_type]}),e.agent&&r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:e.agent.name})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Qo,{className:"h-3 w-3"}),e.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(dc,{className:"h-3 w-3"}),e.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-3 w-3"}),e.save_count]})]}),i&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(J,{variant:"outline",size:"sm",className:"flex-1",onClick:E=>{E.stopPropagation(),n()},children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(J,{variant:"destructive",size:"sm",onClick:E=>{E.stopPropagation(),s()},children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})]})}const GHt=[{value:"active",label:"Active"},{value:"coming_soon",label:"Coming Soon"},{value:"price_improvement",label:"Price Improvement"},{value:"under_contract",label:"Under Contract"},{value:"sold",label:"Sold"}],KHt=[{value:"single_family",label:"Single Family"},{value:"condo",label:"Condo"},{value:"townhouse",label:"Townhouse"},{value:"land",label:"Land"},{value:"multi_family",label:"Multi-Family"},{value:"luxury",label:"Luxury"},{value:"commercial",label:"Commercial"},{value:"other",label:"Other"}];function ZHt({filters:e,onFiltersChange:t,onClose:n}){const s=()=>{t({sortBy:"newest"})};return r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Xt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(J,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Ts,{className:"h-4 w-4"})})]})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Status"}),r.jsxs(bn,{value:e.status||"all",onValueChange:i=>t({...e,status:i==="all"?void 0:i}),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"All statuses"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Statuses"}),GHt.map(i=>r.jsx(Kt,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Property Type"}),r.jsxs(bn,{value:e.propertyType||"all",onValueChange:i=>t({...e,propertyType:i==="all"?void 0:i}),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"All types"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"all",children:"All Types"}),KHt.map(i=>r.jsx(Kt,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Min Price"}),r.jsx(ct,{type:"number",placeholder:"No minimum",value:e.minPrice||"",onChange:i=>t({...e,minPrice:i.target.value?Number(i.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Max Price"}),r.jsx(ct,{type:"number",placeholder:"No maximum",value:e.maxPrice||"",onChange:i=>t({...e,maxPrice:i.target.value?Number(i.target.value):void 0})})]})]}),r.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx($s,{checked:e.openToReferrals||!1,onCheckedChange:i=>t({...e,openToReferrals:i||void 0})})]})]})]})}function YHt({leaderboard:e}){const t=s=>{switch(s){case 0:return r.jsx(Ha,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(qx,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Pl,{className:"h-5 w-5 text-amber-700"});default:return r.jsx("span",{className:"text-sm font-medium text-muted-foreground w-5 text-center",children:s+1})}},n=(s,i)=>!s||s.length===0?r.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"No data yet. Start sharing to climb the leaderboard!"}):r.jsx("div",{className:"space-y-2",children:s.map((o,l)=>r.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${l===0?"bg-gradient-to-r from-amber-500/10 to-amber-500/5 border border-amber-500/20":"bg-muted/50"}`,children:[r.jsx("div",{className:"flex items-center justify-center w-8",children:t(l)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"font-medium truncate",children:o.name})}),r.jsxs(Ft,{variant:l===0?"default":"secondary",children:[o.count," ",i]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-emerald-500/10 to-emerald-500/5 border border-emerald-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-emerald-500/20 flex items-center justify-center",children:r.jsx(dc,{className:"h-6 w-6 text-emerald-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Listing Amplifier"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Share 10+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-sky-500/10 to-sky-500/5 border border-sky-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-sky-500/20 flex items-center justify-center",children:r.jsx(fi,{className:"h-6 w-6 text-sky-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Top Contributor"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add 5+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-purple-500/10 to-purple-500/5 border border-purple-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-purple-500/20 flex items-center justify-center",children:r.jsx(qx,{className:"h-6 w-6 text-purple-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Referral Connector"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Send 3+ referrals"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-amber-500/10 to-amber-500/5 border border-amber-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-amber-500/20 flex items-center justify-center",children:r.jsx(Ha,{className:"h-6 w-6 text-amber-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Community MVP"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Top performer"})]})]})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Community Leaderboard"})}),r.jsx(Xe,{children:r.jsxs(ba,{defaultValue:"sharers",children:[r.jsxs(fa,{className:"w-full",children:[r.jsxs(ln,{value:"sharers",className:"flex-1",children:[r.jsx(dc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(ln,{value:"listers",className:"flex-1",children:[r.jsx(fi,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(An,{value:"sharers",className:"mt-4",children:n(e==null?void 0:e.topSharers,"shares")}),r.jsx(An,{value:"listers",className:"mt-4",children:n(e==null?void 0:e.topListers,"listings")})]})})]})]})}function XHt(){var Z,re,ue,he,be,ne,ye,ie;const e=ns(),{brokerageId:t}=zr(),{data:n,isLoading:s}=wOe(),[i,o]=P.useState("feed"),[l,a]=P.useState(!1),[h,p]=P.useState(""),[x,y]=P.useState({sortBy:"newest"}),{data:w,isLoading:j}=jOe({...x,city:h||x.city}),{data:S,isLoading:C}=ept(),{data:A,isLoading:E}=wxe(),{data:T,isLoading:O}=spt(),{data:z,isLoading:F}=opt(),{data:q}=apt(),H=NOe(),K=async fe=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await H.mutateAsync(fe),ze.success("Listing deleted successfully")}catch{ze.error("Failed to delete listing")}};return s?r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):n?r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs(J,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(fi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(w==null?void 0:w.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(oa,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(S==null?void 0:S.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(oj,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(A==null?void 0:A.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(Kn,{className:"h-5 w-5 text-sky-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(((Z=T==null?void 0:T.sent)==null?void 0:Z.length)||0)+(((re=T==null?void 0:T.received)==null?void 0:re.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(ba,{value:i,onValueChange:o,children:[r.jsxs(fa,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(ln,{value:"feed",children:"Community Feed"}),t&&r.jsx(ln,{value:"brokerage",children:"Brokerage"}),r.jsx(ln,{value:"my-listings",children:"My Listings"}),r.jsx(ln,{value:"saved",children:"Saved"}),r.jsx(ln,{value:"referrals",children:"Referrals"}),r.jsx(ln,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(An,{value:"feed",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by city or neighborhood...",value:h,onChange:fe=>p(fe.target.value),className:"pl-9"})]}),r.jsxs(bn,{value:x.sortBy,onValueChange:fe=>y({...x,sortBy:fe}),children:[r.jsx(vn,{className:"w-[180px]",children:r.jsx(wn,{placeholder:"Sort by"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"newest",children:"Newest First"}),r.jsx(Kt,{value:"updated",children:"Recently Updated"}),r.jsx(Kt,{value:"price_asc",children:"Price: Low to High"}),r.jsx(Kt,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(J,{variant:"outline",onClick:()=>a(!l),children:[r.jsx(uj,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(ZHt,{filters:x,onFiltersChange:y,onClose:()=>a(!1)}),j?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((fe,de)=>r.jsxs(We,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"}),r.jsx(Pr,{className:"h-4 w-1/4"})]})]},de))}):(w==null?void 0:w.length)===0?r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to share a listing with the community!"}),r.jsxs(J,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:w==null?void 0:w.map(fe=>r.jsx(e8,{listing:fe,onClick:()=>e(`/mission-control/listings/${fe.id}`)},fe.id))})]}),r.jsx(An,{value:"my-listings",className:"space-y-4",children:E?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,de)=>r.jsxs(We,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"})]})]},de))}):(A==null?void 0:A.length)===0?r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(oj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Share your listings with the LevelUp community!"}),r.jsxs(J,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Your First Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:A==null?void 0:A.map(fe=>r.jsx(e8,{listing:fe,showActions:!0,onClick:()=>e(`/mission-control/listings/${fe.id}`),onEdit:()=>e(`/mission-control/listings/${fe.id}/edit`),onDelete:()=>K(fe.id)},fe.id))})}),r.jsx(An,{value:"saved",className:"space-y-4",children:C?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,de)=>r.jsxs(We,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"})]})]},de))}):(S==null?void 0:S.length)===0?r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(oa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No saved listings"}),r.jsx("p",{className:"text-muted-foreground",children:"Save listings to quickly access them later"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:S==null?void 0:S.map(fe=>r.jsx(e8,{listing:fe.listing,onClick:()=>e(`/mission-control/listings/${fe.listing.id}`)},fe.id))})}),r.jsx(An,{value:"referrals",className:"space-y-6",children:r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(dc,{className:"h-4 w-4"}),"Referrals Sent (",((ue=T==null?void 0:T.sent)==null?void 0:ue.length)||0,")"]}),((he=T==null?void 0:T.sent)==null?void 0:he.length)===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(be=T==null?void 0:T.sent)==null?void 0:be.map(fe=>{var de,_e;return r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fe.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((de=fe.listing)==null?void 0:de.property_address)||((_e=fe.listing)==null?void 0:_e.city)})]}),r.jsx(Ft,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]})})},fe.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(Kn,{className:"h-4 w-4"}),"Referrals Received (",((ne=T==null?void 0:T.received)==null?void 0:ne.length)||0,")"]}),((ye=T==null?void 0:T.received)==null?void 0:ye.length)===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(ie=T==null?void 0:T.received)==null?void 0:ie.map(fe=>{var de;return r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fe.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(de=fe.sender)==null?void 0:de.name]})]}),r.jsx(Ft,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]}),r.jsx(J,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>e(`/mission-control/listings/${fe.listing_id}`),children:"View Listing"})]})},fe.id)})})]})]})}),t&&r.jsx(An,{value:"brokerage",className:"space-y-4",children:F?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,de)=>r.jsxs(We,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"})]})]},de))}):(z==null?void 0:z.length)===0?r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(oj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No brokerage listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No agents in your brokerage have added listings yet."}),r.jsxs(J,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add a Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:z==null?void 0:z.map(fe=>r.jsx(e8,{listing:fe,onClick:()=>e(`/mission-control/listings/${fe.id}`)},fe.id))})}),r.jsx(An,{value:"leaderboard",children:r.jsx(YHt,{leaderboard:q})})]})]})}):r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Coming Soon"}),r.jsx("p",{className:"text-muted-foreground",children:"Listing Exchange is currently in development. Check back soon!"})]})})})}function I0e(){const{user:e}=zr();return Jt({queryKey:["deal-pipeline-stages",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await ee.from("deal_pipeline_stages").select("*").eq("owner_user_id",e.id).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function I$e(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async()=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{error:n}=await ee.rpc("initialize_deal_pipeline_stages",{p_user_id:e.id});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function P$e(){const{user:e}=zr();return Jt({queryKey:["deal-pipeline-deals",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await ee.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status) `).eq("owner_user_id",e.id).order("updated_at",{ascending:!1});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function L$e(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("deal_pipeline").insert({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||null,contact_id:n.contact_id||null,listing_id:n.listing_id||null,property_address:n.property_address||null,city:n.city||null,state:n.state||null,zip_code:n.zip_code||null,expected_price:n.expected_price||null,expected_commission:n.expected_commission||null,commission_percentage:n.commission_percentage||3,target_close_date:n.target_close_date||null,contract_date:n.contract_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:e.id}).select().single();if(i)throw i;return await ee.from("deal_activities").insert([{deal_id:s.id,activity_type:"system",title:"Deal created",description:`Deal "${n.deal_name}" was created`}]),s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function O$e(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function QHt(){const e=Wr();return cr({mutationFn:async({dealId:t,stageId:n,stageName:s})=>{const{data:i,error:o}=await ee.from("deal_pipeline").update({stage_id:n}).eq("id",t).select().single();if(o)throw o;return await ee.from("deal_activities").insert({deal_id:t,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),i},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-activities"]})}})}function JHt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("deal_pipeline").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function eWt(e){return Jt({queryKey:["deal-activities",e],queryFn:async()=>{const{data:t,error:n}=await ee.from("deal_activities").select("*").eq("deal_id",e).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function tWt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("deal_activities").insert([{deal_id:t.deal_id,activity_type:t.activity_type,title:t.title,description:t.description||null}]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-activities",n.deal_id]})}})}function rWt(e){return Jt({queryKey:["deal-checklist",e],queryFn:async()=>{const{data:t,error:n}=await ee.from("deal_checklist_items").select("*").eq("deal_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function nWt(){const e=Wr();return cr({mutationFn:async({id:t,is_completed:n,deal_id:s})=>{const{data:i,error:o}=await ee.from("deal_checklist_items").update({is_completed:n,completed_at:n?new Date().toISOString():null}).eq("id",t).select().single();if(o)throw o;return i},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function sWt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("deal_checklist_items").insert([{deal_id:t.deal_id,title:t.title,description:t.description||null,due_date:t.due_date||null,sort_order:t.sort_order||0}]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function iWt(){const{user:e}=zr();return Jt({queryKey:["deal-pipeline-stats",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return null;const{data:t,error:n}=await ee.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",e.id);if(n)throw n;const s=(t==null?void 0:t.filter(o=>{var l,a;return!((l=o.deal_pipeline_stages)!=null&&l.is_won_stage)&&!((a=o.deal_pipeline_stages)!=null&&a.is_lost_stage)}))||[],i=(t==null?void 0:t.filter(o=>{var l;return(l=o.deal_pipeline_stages)==null?void 0:l.is_won_stage}))||[];return{totalDeals:(t==null?void 0:t.length)||0,activeDeals:s.length,wonDeals:i.length,pipelineValue:s.reduce((o,l)=>o+(l.expected_price||0),0),expectedCommission:s.reduce((o,l)=>o+(l.expected_commission||0),0),wonValue:i.reduce((o,l)=>o+(l.expected_price||0),0)}},enabled:!!(e!=null&&e.id)})}function aWt(e){const{user:t}=zr();return Jt({queryKey:["deal-by-listing",e,t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id)||!e)return null;const{data:n,error:s}=await ee.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",t.id).eq("listing_id",e).maybeSingle();if(s)throw s;return n},enabled:!!(t!=null&&t.id)&&!!e})}function oWt(){const e=Wr();return cr({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update({listing_id:n}).eq("id",t).select().single();if(i)throw i;return await ee.from("deal_activities").insert({deal_id:t,activity_type:"system",title:"Linked to Listing Exchange",description:"This deal is now synced with Listing Exchange",metadata:{listing_id:n}}),s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",n.listingId]})}})}function lWt(){const e=Wr();return cr({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update({listing_id:null}).eq("id",t).select().single();if(i)throw i;return{data:s,listingId:n}},onSuccess:t=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",t.listingId]})}})}function cWt({listing:e}){const t=ns(),[n,s]=P.useState(""),[i,o]=P.useState(!1),{data:l,isLoading:a}=aWt(e.id),{data:h,isLoading:p}=I0e(),{data:x,isLoading:y}=P$e(),w=I$e(),j=oWt(),S=lWt(),C=L$e(),A=(x==null?void 0:x.filter(F=>!F.listing_id))||[],E=F=>{if(!(h!=null&&h.length))return null;switch(F){case"coming_soon":case"active":case"price_improvement":return h.find(q=>q.name==="Active");case"under_contract":return h.find(q=>q.name==="Under Contract");case"sold":return h.find(q=>q.is_won_stage);default:return h.find(q=>q.name==="Active")}},T=async()=>{o(!0);try{h!=null&&h.length||await w.mutateAsync();const F=E(e.status);await C.mutateAsync({deal_name:e.property_address?`${e.property_address}, ${e.city}`:`${e.city}, ${e.state}`,deal_type:"seller",stage_id:(F==null?void 0:F.id)||null,listing_id:e.id,property_address:e.property_address,city:e.city,state:e.state,expected_price:e.price,expected_commission:e.price*.03,commission_percentage:3,priority:"medium",probability:50}),ze.success("Deal created and linked to listing!")}catch(F){console.error("Failed to create deal:",F),ze.error("Failed to create deal")}finally{o(!1)}},O=async()=>{if(!n){ze.error("Please select a deal");return}try{await j.mutateAsync({dealId:n,listingId:e.id}),ze.success("Listing linked to deal!"),s("")}catch{ze.error("Failed to link listing")}},z=async()=>{if(l)try{await S.mutateAsync({dealId:l.id,listingId:e.id}),ze.success("Listing unlinked from deal")}catch{ze.error("Failed to unlink listing")}};return a||p?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2 text-base",children:[r.jsx(f1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(nn,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(We,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"flex items-center gap-2 text-base",children:[r.jsx(Yh,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(Xe,{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:l.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:l.deal_pipeline_stages&&r.jsx(Ft,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${l.deal_pipeline_stages.color}20`,color:l.deal_pipeline_stages.color},children:l.deal_pipeline_stages.name})})]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes sync automatically between the listing and pipeline."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(J,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>t("/mission-control/pipeline"),children:["View Pipeline",r.jsx(Ko,{className:"h-3 w-3 ml-1"})]}),r.jsx(J,{variant:"ghost",size:"sm",onClick:z,disabled:S.isPending,children:S.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(QT,{className:"h-4 w-4"})})]})]})]}):r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"flex items-center gap-2 text-base",children:[r.jsx(f1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(J,{onClick:T,disabled:i||C.isPending,className:"w-full",size:"sm",children:[i||C.isPending?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),A.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(bn,{value:n,onValueChange:s,children:[r.jsx(vn,{className:"flex-1 text-sm",children:r.jsx(wn,{placeholder:"Link to existing deal..."})}),r.jsx(_n,{children:A.map(F=>r.jsx(Kt,{value:F.id,children:F.deal_name},F.id))})]}),r.jsx(J,{variant:"secondary",size:"icon",onClick:O,disabled:!n||j.isPending,children:j.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(Yh,{className:"h-4 w-4"})})]})]})]})]})}const dWt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},uWt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},h5e={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function hWt(){var be,ne,ye,ie,fe,de,_e,Ee,ke;const{listingId:e}=Wc(),t=ns(),{user:n}=zr(),{data:s,isLoading:i}=kOe(e||""),{data:o}=COe(e||""),{data:l}=rpt(e||""),a=SOe(),h=tpt(),p=npt(),x=NOe(),y=ipt(),[w,j]=P.useState(!1),[S,C]=P.useState(!1),[A,E]=P.useState(!1),[T,O]=P.useState(null),[z,F]=P.useState({buyerName:"",buyerType:"",notes:""}),q=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),H=pe=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(pe),K=async pe=>{const ae=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,ge=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;p.mutate({listingId:s.id,shareType:pe});try{switch(pe){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(ae)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(ae),ze.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${ge} ${ae}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(ge)}&body=${encodeURIComponent(`Check out this listing: ${ae}`)}`);break}}catch(Me){console.error("Share error:",Me),ze.error("Failed to share")}},Z=async()=>{try{await x.mutateAsync(s.id),ze.success("Listing deleted"),t("/mission-control/listings")}catch{ze.error("Failed to delete listing")}},re=async()=>{if(!z.buyerName.trim()){ze.error("Please enter buyer name");return}try{await y.mutateAsync({listingId:s.id,listingAgentId:s.agent_id,buyerName:z.buyerName,buyerType:z.buyerType||void 0,notes:z.notes||void 0}),ze.success("Referral sent successfully!"),C(!1),F({buyerName:"",buyerType:"",notes:""})}catch{ze.error("Failed to send referral")}},ue=pe=>{var Re,Ce;const ae=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,ge=H((s==null?void 0:s.price)||0),Me=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Ue=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Ie=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Ke=[Me,Ue,Ie].filter(Boolean).join(" | ");switch(pe){case"just_listed":return`🏡 JUST LISTED! ${ae} ${ge} ${Ke} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Re=s==null?void 0:s.city)==null?void 0:Re.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${ae} Now ${ge}! ${Ke} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${h5e[(s==null?void 0:s.property_type)||"single_family"].toLowerCase()} in ${s==null?void 0:s.city}? 👀 I've got just the one for you! ${Ke} DM me for details! 📩 #ComingSoon #RealEstate #${(Ce=s==null?void 0:s.city)==null?void 0:Ce.replace(/\s/g,"")}`;default:return""}};if(i)return r.jsx(Or,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-10 w-32"}),r.jsx(Pr,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Pr,{className:"h-48"}),r.jsx(Pr,{className:"h-48"}),r.jsx(Pr,{className:"h-48"})]})]})});if(!s)return r.jsx(Or,{title:"Listing Not Found",description:"",children:r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(J,{onClick:()=>t("/mission-control/listings"),children:"Back to Listings"})]})})});const he=((be=s.photos)==null?void 0:be.find(pe=>pe.is_primary))||((ne=s.photos)==null?void 0:ne[0]);return r.jsxs(Or,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(J,{variant:"ghost",onClick:()=>t("/mission-control/listings"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>he&&O(he.photo_url),children:he?r.jsx("img",{src:he.photo_url,alt:"Primary",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No photos"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:(ye=s.photos)==null?void 0:ye.slice(1,5).map((pe,ae)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>O(pe.photo_url),children:r.jsx("img",{src:pe.photo_url,alt:`Photo ${ae+2}`,className:"w-full h-full object-cover"})},pe.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"p-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{className:`${dWt[s.status]} text-white border-0`,children:uWt[s.status]}),s.is_featured&&r.jsxs(Ft,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(vs,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Ft,{variant:"outline",children:[r.jsx(Kn,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:H(s.price)}),s.property_address&&r.jsx("p",{className:"text-xl font-medium",children:s.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(pl,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{variant:"outline",size:"icon",onClick:()=>a.mutate(s.id),children:r.jsx(oa,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(J,{variant:"outline",size:"icon",onClick:()=>h.mutate(s.id),children:l?r.jsx(aj,{className:"h-4 w-4"}):r.jsx(vg,{className:"h-4 w-4"})}),!q&&r.jsxs(J,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>E(!0),children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsxs(J,{variant:"outline",children:[r.jsx(dc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(ap,{children:[r.jsxs(po,{onClick:()=>K("copy"),children:[r.jsx(jl,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(po,{onClick:()=>K("facebook"),children:[r.jsx(Pd,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(po,{onClick:()=>K("text"),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(po,{onClick:()=>K("email"),children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),q&&r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"outline",onClick:()=>t(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(J,{variant:"destructive",size:"icon",onClick:()=>j(!0),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[s.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Vf,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bedrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Beds"})]}),s.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(qf,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bathrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Baths"})]}),s.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(xm,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.square_footage.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Sq Ft"})]}),s.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(Ys,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.year_built}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"pt-4 space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ft,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),h5e[s.property_type]]}),s.lot_size&&r.jsxs(Ft,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Ft,{variant:"secondary",children:"HOA"})]}),s.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Description"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})]}),s.agent_notes&&s.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.agent_notes})]}),s.mls_link&&r.jsx(J,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]}),r.jsxs("div",{className:"flex items-center gap-4 pt-4 mt-4 border-t text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Qo,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(dc,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Share Content"})}),r.jsx(Xe,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(pe=>r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("p",{className:"font-medium text-sm capitalize",children:[pe.replace("_"," ")," Caption"]}),r.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ue(pe)),ze.success("Caption copied!")},children:r.jsx(jl,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ue(pe)})]},pe))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx("span",{className:"text-lg font-semibold text-primary",children:((fe=(ie=s.agent)==null?void 0:ie.name)==null?void 0:fe.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((de=s.agent)==null?void 0:de.name)||"Unknown"}),((Ee=(_e=s.agent)==null?void 0:_e.brokerage)==null?void 0:Ee.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!q&&r.jsx("div",{className:"space-y-2",children:((ke=s.agent)==null?void 0:ke.email)&&r.jsx(J,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),q&&r.jsx(cWt,{listing:s}),!q&&s.open_to_referrals&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(J,{className:"w-full",onClick:()=>C(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Br,{open:!!T,onOpenChange:()=>O(null),children:r.jsx(Fr,{className:"max-w-4xl",children:r.jsx("img",{src:T||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Br,{open:w,onOpenChange:j,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Delete Listing"}),r.jsx(es,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(J,{variant:"destructive",onClick:Z,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Br,{open:S,onOpenChange:C,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Send Buyer Referral"}),r.jsx(es,{children:"Submit buyer information to the listing agent"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Buyer Name *"}),r.jsx(ct,{value:z.buyerName,onChange:pe=>F({...z,buyerName:pe.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Buyer Type"}),r.jsxs(bn,{value:z.buyerType,onValueChange:pe=>F({...z,buyerType:pe}),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select type"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"first_time",children:"First-Time Buyer"}),r.jsx(Kt,{value:"investor",children:"Investor"}),r.jsx(Kt,{value:"relocating",children:"Relocating"}),r.jsx(Kt,{value:"upgrade",children:"Upgrading"}),r.jsx(Kt,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Notes"}),r.jsx(ms,{value:z.notes,onChange:pe=>F({...z,notes:pe.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(J,{onClick:re,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(E$e,{open:A,onOpenChange:E,listingId:(s==null?void 0:s.id)||"",listingSlug:(s==null?void 0:s.slug)||null,listingTitle:(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`})]})}function fWt({selectedVideoId:e,onVideoSelect:t,listingId:n}){const s=ns(),{user:i}=zr(),[o,l]=P.useState(!1),[a,h]=P.useState([]),[p,x]=P.useState(!1),[y,w]=P.useState(null),[j,S]=P.useState({});P.useEffect(()=>{e&&i?C():w(null)},[e,i]);const C=async()=>{if(!e)return;const{data:Z,error:re}=await ee.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("id",e).eq("is_deleted",!1).single();!re&&Z&&(w(Z),A(Z))},A=async Z=>{try{const{data:re,error:ue}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Z.bunny_video_id,isAgentVideo:!0}});!ue&&(re!=null&&re.thumbnailUrl)&&S(he=>({...he,[Z.id]:{thumbnailUrl:re.thumbnailUrl}}))}catch(re){console.warn("Failed to get signed URL",re)}},E=async()=>{if(i){x(!0);try{const{data:Z,error:re}=await ee.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",i.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(re)throw re;h(Z||[]),Z!=null&&Z.length&&T(Z)}catch(Z){console.error("Error fetching videos:",Z),ze.error("Failed to load videos")}finally{x(!1)}}},T=async Z=>{const re=await Promise.allSettled(Z.map(async he=>{const{data:be,error:ne}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:he.bunny_video_id,isAgentVideo:!0}});if(ne)throw ne;return{id:he.id,thumbnailUrl:be==null?void 0:be.thumbnailUrl}})),ue={};for(const he of re)he.status==="fulfilled"&&he.value.thumbnailUrl&&(ue[he.value.id]={thumbnailUrl:he.value.thumbnailUrl});S(he=>({...he,...ue}))},O=()=>{l(!0),E()},z=Z=>{t(Z.id),w(Z),l(!1),ze.success("Video selected")},F=()=>{t(null),w(null)},q=()=>{const Z=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(Z)}`)},H=Z=>{if(!Z)return"0:00";const re=Math.floor(Z/60),ue=Z%60;return`${re}:${ue.toString().padStart(2,"0")}`},K=Z=>{var re;return((re=j[Z.id])==null?void 0:re.thumbnailUrl)||Z.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?r.jsx(We,{className:"overflow-hidden",children:r.jsx(Xe,{className:"p-0",children:r.jsxs("div",{className:"flex items-start gap-4 p-4",children:[r.jsxs("div",{className:"relative w-32 h-20 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[K(y)?r.jsx("img",{src:K(y),alt:y.title||"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 flex items-center justify-center",children:r.jsx(Sc,{className:"h-6 w-6 text-white fill-white"})}),y.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:H(y.duration_seconds)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:y.title||"Untitled Video"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Property Video Tour"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:O,children:"Change"}),r.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:F,className:"text-destructive hover:text-destructive",children:r.jsx(Ts,{className:"h-4 w-4"})})]})]})})}):r.jsx(We,{className:"border-dashed",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Fi,{className:"h-10 w-10 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add a video walkthrough to showcase this property"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-center",children:[r.jsxs(J,{type:"button",variant:"outline",onClick:O,className:"gap-2",children:[r.jsx(iS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(J,{type:"button",variant:"outline",onClick:q,className:"gap-2",children:[r.jsx(s1,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Br,{open:o,onOpenChange:l,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(Hr,{children:r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(iS,{className:"h-5 w-5"}),"Select a Video"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:p?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No videos in your library yet"}),r.jsxs(J,{onClick:q,className:"gap-2",children:[r.jsx(s1,{className:"h-4 w-4"}),"Record Your First Video"]})]}):r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 p-1",children:a.map(Z=>r.jsxs("button",{type:"button",onClick:()=>z(Z),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${e===Z.id?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[K(Z)?r.jsx("img",{src:K(Z),alt:Z.title||"Video",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:r.jsx(Sc,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),Z.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:H(Z.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:Z.title||"Untitled Video"})})]},Z.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(J,{type:"button",variant:"ghost",onClick:q,className:"gap-2",children:[r.jsx(s1,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(J,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const pWt=[{value:"active",label:"Active"},{value:"coming_soon",label:"Coming Soon"},{value:"price_improvement",label:"Price Improvement"},{value:"under_contract",label:"Under Contract"},{value:"sold",label:"Sold"}],mWt=[{value:"single_family",label:"Single Family"},{value:"condo",label:"Condo"},{value:"townhouse",label:"Townhouse"},{value:"land",label:"Land"},{value:"multi_family",label:"Multi-Family"},{value:"luxury",label:"Luxury"},{value:"commercial",label:"Commercial"},{value:"other",label:"Other"}];function f5e(){var ye;const{listingId:e}=Wc(),[t]=Fd(),n=t.get("brokerage"),s=ns(),{user:i}=zr(),o=!!e&&e!=="new",l=!!n&&!o,{data:a,isLoading:h}=kOe(o?e:""),p=Zft(),x=Yft(),y=Xft(),w=Qft(),j=Jft(),{data:S=[]}=Jt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:ie,error:fe}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(fe)throw fe;return ie||[]},enabled:l}),[C,A]=P.useState(""),[E,T]=P.useState(!1),[O,z]=P.useState([]),[F,q]=P.useState([]),[H,K]=P.useState({property_address:"",city:"",state:"",neighborhood:"",price:"",property_type:"single_family",status:"active",bedrooms:"",bathrooms:"",square_footage:"",lot_size:"",year_built:"",has_hoa:!1,description:"",agent_notes:"",agent_notes_public:!1,mls_link:"",video_link:"",video_id:null,allow_sharing:!0,open_to_referrals:!0,open_to_social_promotion:!0,share_with_brokerage:!1,is_public:!0});P.useEffect(()=>{var ie,fe,de,_e,Ee;a&&o&&K({property_address:a.property_address||"",city:a.city||"",state:a.state||"",neighborhood:a.neighborhood||"",price:((ie=a.price)==null?void 0:ie.toString())||"",property_type:a.property_type,status:a.status,bedrooms:((fe=a.bedrooms)==null?void 0:fe.toString())||"",bathrooms:((de=a.bathrooms)==null?void 0:de.toString())||"",square_footage:((_e=a.square_footage)==null?void 0:_e.toString())||"",lot_size:a.lot_size||"",year_built:((Ee=a.year_built)==null?void 0:Ee.toString())||"",has_hoa:a.has_hoa,description:a.description||"",agent_notes:a.agent_notes||"",agent_notes_public:a.agent_notes_public,mls_link:a.mls_link||"",video_link:a.video_link||"",video_id:a.video_id||null,allow_sharing:a.allow_sharing,open_to_referrals:a.open_to_referrals,open_to_social_promotion:a.open_to_social_promotion,share_with_brokerage:a.share_with_brokerage??!1,is_public:a.is_public})},[a,o]);const Z=ie=>{if(!ie)return;const fe=Array.from(ie);z(_e=>[..._e,...fe]);const de=fe.map(_e=>URL.createObjectURL(_e));q(_e=>[..._e,...de])},re=ie=>{URL.revokeObjectURL(F[ie]),z(fe=>fe.filter((de,_e)=>_e!==ie)),q(fe=>fe.filter((de,_e)=>_e!==ie))},ue=async ie=>{var fe;if(!(!ie||!a)){T(!0);try{for(const de of Array.from(ie)){const _e=de.name.split(".").pop(),Ee=`${i==null?void 0:i.id}/${a.id}/${Date.now()}.${_e}`,{error:ke}=await ee.storage.from("listing-photos").upload(Ee,de);if(ke)throw ke;const{data:{publicUrl:pe}}=ee.storage.from("listing-photos").getPublicUrl(Ee);await w.mutateAsync({listingId:a.id,photoUrl:pe,isPrimary:!((fe=a.photos)!=null&&fe.length)})}ze.success("Photos uploaded!")}catch(de){console.error("Upload error:",de),ze.error("Failed to upload photos")}finally{T(!1)}}},he=async ie=>{for(let fe=0;fe{if(a)try{await j.mutateAsync({photoId:ie,listingId:a.id}),ze.success("Photo removed")}catch{ze.error("Failed to remove photo")}},ne=async ie=>{if(ie.preventDefault(),!H.city.trim()||!H.state.trim()||!H.price){ze.error("Please fill in required fields (City, State, Price)");return}if(l&&!C){ze.error("Please select an agent to assign this listing to");return}try{const fe={property_address:H.property_address||null,city:H.city,state:H.state,neighborhood:H.neighborhood||null,price:Number(H.price),property_type:H.property_type,status:H.status,bedrooms:H.bedrooms?Number(H.bedrooms):null,bathrooms:H.bathrooms?Number(H.bathrooms):null,square_footage:H.square_footage?Number(H.square_footage):null,lot_size:H.lot_size||null,year_built:H.year_built?Number(H.year_built):null,has_hoa:H.has_hoa,description:H.description||null,agent_notes:H.agent_notes||null,agent_notes_public:H.agent_notes_public,mls_link:H.mls_link||null,video_link:H.video_link||null,video_id:H.video_id||null,allow_sharing:H.allow_sharing,open_to_referrals:H.open_to_referrals,open_to_social_promotion:H.open_to_social_promotion,share_with_brokerage:H.share_with_brokerage,is_public:H.is_public};if(o)await y.mutateAsync({id:e,...fe}),ze.success("Listing updated!"),s(`/mission-control/listings/${e}`);else{T(!0);let de;if(l&&C?de=await x.mutateAsync({agentId:C,...fe}):de=await p.mutateAsync(fe),O.length>0)try{await he(de.id),F.forEach(_e=>URL.revokeObjectURL(_e)),z([]),q([])}catch(_e){console.error("Photo upload error:",_e),ze.error("Listing created but some photos failed to upload")}T(!1),ze.success("Listing created!"),s(l?"/my-brokerage":`/mission-control/listings/${de.id}`)}}catch(fe){console.error("Save error:",fe),ze.error("Failed to save listing"),T(!1)}};return o&&h?r.jsx(Or,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-10 w-32"}),r.jsx(Pr,{className:"h-[600px] w-full"})]})}):r.jsx(Or,{title:o?"Edit Listing":l?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:ne,className:"space-y-6",children:[r.jsxs(J,{type:"button",variant:"ghost",onClick:()=>s(l?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),l?"Back to Brokerage":"Back to Listings"]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[l&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Assign to Agent *"})}),r.jsxs(Xe,{children:[r.jsxs(bn,{value:C,onValueChange:A,children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select an agent..."})}),r.jsx(_n,{children:S.map(ie=>r.jsx(Kt,{value:ie.id,children:ie.name||ie.email},ie.id))})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This listing will appear on the selected agent's Listing Exchange."})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Property Details"})}),r.jsx(Xe,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx(Ve,{children:"Property Address"}),r.jsx(ct,{value:H.property_address,onChange:ie=>K({...H,property_address:ie.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"City *"}),r.jsx(ct,{value:H.city,onChange:ie=>K({...H,city:ie.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"State *"}),r.jsx(ct,{value:H.state,onChange:ie=>K({...H,state:ie.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Neighborhood"}),r.jsx(ct,{value:H.neighborhood,onChange:ie=>K({...H,neighborhood:ie.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Price *"}),r.jsx(ct,{type:"number",value:H.price,onChange:ie=>K({...H,price:ie.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Property Type"}),r.jsxs(bn,{value:H.property_type,onValueChange:ie=>K({...H,property_type:ie}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:mWt.map(ie=>r.jsx(Kt,{value:ie.value,children:ie.label},ie.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Status"}),r.jsxs(bn,{value:H.status,onValueChange:ie=>K({...H,status:ie}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:pWt.map(ie=>r.jsx(Kt,{value:ie.value,children:ie.label},ie.value))})]})]})]})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Property Specs (Optional)"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Bedrooms"}),r.jsx(ct,{type:"number",value:H.bedrooms,onChange:ie=>K({...H,bedrooms:ie.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Bathrooms"}),r.jsx(ct,{type:"number",step:"0.5",value:H.bathrooms,onChange:ie=>K({...H,bathrooms:ie.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Sq Ft"}),r.jsx(ct,{type:"number",value:H.square_footage,onChange:ie=>K({...H,square_footage:ie.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Lot Size"}),r.jsx(ct,{value:H.lot_size,onChange:ie=>K({...H,lot_size:ie.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Year Built"}),r.jsx(ct,{type:"number",value:H.year_built,onChange:ie=>K({...H,year_built:ie.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx($s,{checked:H.has_hoa,onCheckedChange:ie=>K({...H,has_hoa:ie})}),r.jsx(Ve,{children:"Has HOA"})]})]})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Description & Links"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Description"}),r.jsx(ms,{value:H.description,onChange:ie=>K({...H,description:ie.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Agent Notes"}),r.jsx(ms,{value:H.agent_notes,onChange:ie=>K({...H,agent_notes:ie.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{checked:H.agent_notes_public,onCheckedChange:ie=>K({...H,agent_notes_public:ie})}),r.jsx(Ve,{className:"text-sm text-muted-foreground",children:"Make notes visible to other agents"})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"MLS Link"}),r.jsx(ct,{value:H.mls_link,onChange:ie=>K({...H,mls_link:ie.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Video Link"}),r.jsx(ct,{value:H.video_link,onChange:ie=>K({...H,video_link:ie.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Fi,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(Xe,{children:r.jsx(fWt,{selectedVideoId:H.video_id,onVideoSelect:ie=>K({...H,video_id:ie}),listingId:o?e:void 0})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Photos"})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((ye=a==null?void 0:a.photos)==null?void 0:ye.map(ie=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>be(ie.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(Ts,{className:"h-3 w-3"})}),ie.is_primary&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},ie.id))),!o&&F.map((ie,fe)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>re(fe),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(Ts,{className:"h-3 w-3"})}),fe===0&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},fe)),r.jsxs("label",{className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 cursor-pointer flex flex-col items-center justify-center gap-2 text-muted-foreground",children:[E?r.jsx(nn,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(go,{className:"h-8 w-8"}),r.jsx("span",{className:"text-xs",children:"Upload"})]}),r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ie=>o?ue(ie.target.files):Z(ie.target.files),disabled:E})]})]}),!o&&O.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[O.length," photo",O.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Sharing & Collaboration"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx($s,{checked:H.allow_sharing,onCheckedChange:ie=>K({...H,allow_sharing:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx($s,{checked:H.open_to_referrals,onCheckedChange:ie=>K({...H,open_to_referrals:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx($s,{checked:H.open_to_social_promotion,onCheckedChange:ie=>K({...H,open_to_social_promotion:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx($s,{checked:H.share_with_brokerage,onCheckedChange:ie=>K({...H,share_with_brokerage:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx($s,{checked:H.is_public,onCheckedChange:ie=>K({...H,is_public:ie})})]})]})]}),r.jsx(J,{type:"submit",className:"w-full",size:"lg",disabled:p.isPending||y.isPending,children:p.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function gWt({maxDurationSeconds:e=30,onRecordingComplete:t,onError:n,onRecordingStateChange:s,className:i,teleprompterContent:o}){const l=P.useRef(null),a=P.useRef(null),h=P.useRef(null),p=P.useRef([]),x=P.useRef(null),y=P.useRef(null),w=P.useRef(null),j=P.useRef(null),S=OI(),[C,A]=P.useState(!0),[E,T]=P.useState(!0),[O,z]=P.useState(null),[F,q]=P.useState(!1),[H,K]=P.useState(!1),[Z,re]=P.useState(null),[ue,he]=P.useState(null),[be,ne]=P.useState(0),[ye,ie]=P.useState("user"),[fe,de]=P.useState(0),[_e,Ee]=P.useState(!1),[ke,pe]=P.useState(!0),[ae,ge]=P.useState(null),[Me,Ue]=P.useState(!1),Ie=P.useCallback(Qe=>{A(Qe)},[]),Ke=P.useRef(C),Re=P.useCallback(async()=>{var tt;T(!0),ge(null);const Qe=S&&C;console.log("[VideoRecorder] initCamera start",{isMobile:S,usePortraitMode:C,shouldBePortrait:Qe,facingMode:ye});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");h.current&&(console.log("[VideoRecorder] stopping existing stream"),h.current.getTracks().forEach(jt=>jt.stop()));const ht=S&&Qe?{facingMode:{ideal:ye},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:ye},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",ht);const wt=await navigator.mediaDevices.getUserMedia({video:ht,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),wt.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");h.current=wt,z(!0);const It=wt.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",It.width,"x",It.height),l.current){const jt=l.current;jt.srcObject=wt,jt.muted=!0,jt.playsInline=!0,jt.autoplay=!0,jt.setAttribute("muted",""),jt.setAttribute("playsinline",""),jt.setAttribute("autoplay","");try{(tt=jt.load)==null||tt.call(jt)}catch(Ar){console.warn("[VideoRecorder] videoEl.load failed",Ar)}const rr=async()=>{try{return await jt.play(),console.log("[VideoRecorder] preview play ok"),Ue(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:jt.readyState,videoWidth:jt.videoWidth,videoHeight:jt.videoHeight})},300),!0}catch(Ar){return console.warn("[VideoRecorder] preview play blocked",Ar),Ue(!0),!1}};await new Promise(Ar=>{let gn=!1;const kn=()=>{gn||(gn=!0,Ar())},Jr=()=>{rr().finally(kn)};jt.onloadedmetadata=Jr,jt.onloadeddata=Jr,setTimeout(kn,1500)})}try{y.current=new AudioContext;const jt=y.current.createMediaStreamSource(wt);w.current=y.current.createAnalyser(),w.current.fftSize=256,jt.connect(w.current);const rr=()=>{if(w.current){const Ar=new Uint8Array(w.current.frequencyBinCount);w.current.getByteFrequencyData(Ar);const gn=Ar.reduce((kn,Jr)=>kn+Jr)/Ar.length;de(Math.min(100,gn/128*100))}j.current=requestAnimationFrame(rr)};rr()}catch(jt){console.warn("Audio context not available:",jt)}}catch(ht){console.error("Camera initialization error:",ht),z(!1);let wt="Failed to access camera or microphone.";ht.name==="NotAllowedError"?wt="Camera permission denied. Please allow camera access in your browser settings.":ht.name==="NotFoundError"?wt="No camera found. Please connect a camera and try again.":ht.name==="NotReadableError"?wt="Camera is in use by another application. Please close other apps using the camera.":ht.message&&(wt=ht.message),ge(wt),n==null||n(wt)}finally{T(!1)}},[ye,n,S,C]);P.useEffect(()=>{Ke.current!==C&&O&&!F&&!ue&&(Ke.current=C,Re())},[C,O,F,ue,Re]),P.useEffect(()=>(Re(),()=>{h.current&&h.current.getTracks().forEach(Qe=>Qe.stop()),x.current&&clearInterval(x.current),j.current&&cancelAnimationFrame(j.current),y.current&&y.current.close(),ue&&URL.revokeObjectURL(ue)}),[Re,ue]),P.useEffect(()=>{if(E||O!==!0||ue)return;const Qe=h.current,tt=l.current;!Qe||!tt||(tt.srcObject!==Qe&&(tt.srcObject=Qe,tt.muted=!0,tt.playsInline=!0,tt.autoplay=!0,tt.setAttribute("muted",""),tt.setAttribute("playsinline",""),tt.setAttribute("autoplay","")),tt.play().then(()=>Ue(!1)).catch(ht=>{Ue(!0),console.warn("Live preview play blocked on mount:",ht)}))},[O,E,ue]),P.useEffect(()=>{s==null||s(F)},[F,s]);const Ce=P.useCallback(async()=>{if(ue)return;const Qe=l.current;if(Qe)try{await Qe.play(),Ue(!1)}catch(tt){Ue(!0),console.warn("Live preview still blocked (needs user gesture):",tt)}},[ue]),Je=P.useCallback(()=>{a.current&&a.current.state!=="inactive"&&a.current.stop(),x.current&&(clearInterval(x.current),x.current=null),q(!1),K(!1)},[]),Te=P.useCallback(()=>{if(!h.current)return;Ce(),p.current=[],ne(0);const tt=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(wt=>MediaRecorder.isTypeSupported(wt)),ht=new MediaRecorder(h.current,tt?{mimeType:tt,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});ht.ondataavailable=wt=>{wt.data.size>0&&p.current.push(wt.data)},ht.onstop=()=>{var jt;const wt=ht.mimeType||tt||((jt=p.current[0])==null?void 0:jt.type)||"video/webm",Ct=new Blob(p.current,{type:wt});re(Ct);const It=URL.createObjectURL(Ct);he(It)},a.current=ht,ht.start(100),q(!0),x.current=setInterval(()=>{ne(wt=>wt>=e-1?(Je(),e):wt+1)},1e3)},[Ce,e,Je]),Ye=P.useCallback(()=>{a.current&&a.current.state==="recording"&&(a.current.pause(),K(!0),x.current&&clearInterval(x.current))},[]),xe=P.useCallback(()=>{a.current&&a.current.state==="paused"&&(a.current.resume(),K(!1),x.current=setInterval(()=>{ne(Qe=>Qe>=e-1?(Je(),e):Qe+1)},1e3))},[e,Je]),mt=P.useCallback(()=>{ue&&URL.revokeObjectURL(ue),re(null),he(null),ne(0),Ee(!1),pe(!0),l.current&&h.current&&(l.current.srcObject=h.current,l.current.muted=!0,Ce())},[Ce,ue]),et=P.useCallback(()=>{ie(Qe=>Qe==="user"?"environment":"user")},[]),nt=P.useCallback(()=>{Z&&t(Z,be)},[Z,be,t]),Ae=P.useCallback(()=>{l.current&&ue&&(_e?l.current.pause():(pe(!1),l.current.muted=!1,l.current.play()),Ee(!_e))},[ue,_e]);P.useEffect(()=>{if(!ue)return;const Qe=l.current;if(!Qe)return;pe(!1),Qe.pause(),Qe.removeAttribute("src"),Qe.srcObject=null,Qe.load(),Qe.src=ue,Qe.currentTime=0,Qe.playsInline=!0,Qe.muted=!1,Qe.onended=()=>Ee(!1);const tt=()=>{const ht=Qe.error,wt=ht?`Recorded video failed to play (code ${ht.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",ht),n==null||n(wt)};return Qe.addEventListener("error",tt),Qe.load(),()=>{Qe.removeEventListener("error",tt)}},[n,ue]);const pt=Qe=>{const tt=Math.floor(Qe/60),ht=Qe%60;return`${tt}:${ht.toString().padStart(2,"0")}`},Be=S&&C?"aspect-[9/16]":"aspect-video";return E?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",Be,i),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(nn,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):O===!1?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",Be,i),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(El,{className:"h-12 w-12 mx-auto mb-4 text-destructive"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Camera Access Required"}),r.jsx("p",{className:"text-gray-400 mb-4 text-sm",children:ae||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(J,{onClick:()=>Re(),variant:"secondary",className:"w-full",children:[r.jsx(ql,{className:"h-4 w-4 mr-2"}),"Try Again"]}),r.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"💡 Tip: If you're viewing this in an embedded preview, try opening the app in a new browser tab for full camera access."})]})]})}):r.jsxs("div",{className:$t("flex flex-col gap-2",i),children:[S&&!F&&!ue&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(uS,{className:$t("h-4 w-4",C?"text-muted-foreground":"text-primary")}),r.jsx(Ve,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx($s,{id:"orientation-toggle",checked:C,onCheckedChange:Ie}),r.jsx(Ve,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(gm,{className:$t("h-4 w-4",C?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:$t("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{Ce()},children:[r.jsx("video",{ref:l,src:ue??void 0,className:$t("w-full bg-black",C&&!ue?"object-contain":"object-cover",Be,ye==="user"&&!ue&&"scale-x-[-1]"),playsInline:!0,controls:!!ue,muted:ue?ke:!0,autoPlay:!ue},ue??"live"),!ue&&Me&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(J,{type:"button",variant:"secondary",onClick:()=>void Ce(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!ue&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),F&&r.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx("div",{className:$t("w-3 h-3 rounded-full",H?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[pt(be)," / ",pt(e)]})]}),F&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Hc,{value:be/e*100,className:"h-1 rounded-none"})}),!ue&&r.jsxs("div",{className:"absolute bottom-20 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx(FT,{className:"h-4 w-4 text-white"}),r.jsx("div",{className:"w-20 h-2 bg-white/20 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-green-500 transition-all duration-75",style:{width:`${fe}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:ue?r.jsxs(r.Fragment,{children:[r.jsxs(J,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:mt,children:[r.jsx(ql,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(J,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Ae,children:_e?r.jsx(Xh,{className:"h-5 w-5"}):r.jsx(Sc,{className:"h-5 w-5"})}),r.jsxs(J,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:nt,children:[r.jsx(Ca,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:et,disabled:F,children:r.jsx(pS,{className:"h-5 w-5"})}),F?r.jsxs(r.Fragment,{children:[r.jsx(J,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:H?xe:Ye,children:H?r.jsx(Sc,{className:"h-5 w-5"}):r.jsx(Xh,{className:"h-5 w-5"})}),r.jsx(J,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Je,children:r.jsx(xm,{className:"h-6 w-6 fill-current"})})]}):r.jsx(J,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Te,children:r.jsx(Fi,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}function xWt({text:e,isVisible:t,onToggleVisibility:n,isRecording:s=!1,className:i}){const o=P.useRef(null),l=P.useRef(null),a=P.useRef(0),h=P.useRef(0),[p,x]=P.useState(!1),[y,w]=P.useState(30),[j,S]=P.useState(24),[C,A]=P.useState(1.6),[E,T]=P.useState(.85),[O,z]=P.useState("top"),[F,q]=P.useState(!1),H=P.useCallback(ue=>{if(!o.current)return;a.current===0&&(a.current=ue);const he=ue-a.current;a.current=ue,h.current+=y*he/1e3;const be=Math.floor(h.current);be>0&&(o.current.scrollTop+=be,h.current-=be);const{scrollTop:ne,scrollHeight:ye,clientHeight:ie}=o.current;if(ne+ie>=ye){x(!1);return}l.current=requestAnimationFrame(H)},[y]);P.useEffect(()=>(p?(a.current=0,h.current=0,l.current=requestAnimationFrame(H)):l.current&&cancelAnimationFrame(l.current),()=>{l.current&&cancelAnimationFrame(l.current)}),[p,H]),P.useEffect(()=>{s&&t?(o.current&&(o.current.scrollTop=0),setTimeout(()=>{x(!0)},100)):s||x(!1)},[s,t]);const K=P.useCallback(()=>{o.current&&(o.current.scrollTop=0),x(!1)},[]),Z=P.useCallback(()=>{x(ue=>!ue)},[]);if(!t)return r.jsx("div",{className:$t("absolute top-4 right-4 pointer-events-auto z-10",i),children:r.jsxs(J,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const re={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return r.jsxs("div",{className:$t("absolute inset-0 pointer-events-none",i),children:[r.jsx("div",{className:$t("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",re[O]),style:{opacity:E},children:r.jsxs("div",{ref:o,className:$t("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",F&&"scale-x-[-1]"),style:{maskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)",WebkitMaskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)"},children:[r.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${j}px`,lineHeight:C,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:e}),r.jsx("div",{className:"h-32"})]})}),r.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[r.jsxs(_h,{children:[r.jsx(bh,{asChild:!0,children:r.jsx(J,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(hd,{className:"h-4 w-4"})})}),r.jsx(Ou,{className:"w-72",side:"left",align:"start",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium",children:"Teleprompter Settings"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{className:"text-xs",children:"Scroll Speed"}),r.jsx(zw,{value:[y],onValueChange:([ue])=>w(ue),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{className:"text-xs",children:"Font Size"}),r.jsx(zw,{value:[j],onValueChange:([ue])=>S(ue),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{className:"text-xs",children:"Line Spacing"}),r.jsx(zw,{value:[C*10],onValueChange:([ue])=>A(ue/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{className:"text-xs",children:"Opacity"}),r.jsx(zw,{value:[E*100],onValueChange:([ue])=>T(ue/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(J,{variant:O==="top"?"default":"outline",size:"sm",onClick:()=>z("top"),children:r.jsx(i1,{className:"h-4 w-4"})}),r.jsx(J,{variant:O==="center"?"default":"outline",size:"sm",onClick:()=>z("center"),children:r.jsx(g1,{className:"h-4 w-4"})}),r.jsx(J,{variant:O==="bottom"?"default":"outline",size:"sm",onClick:()=>z("bottom"),children:r.jsx(Iu,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{className:"text-xs",children:"Mirror Mode"}),r.jsx($s,{checked:F,onCheckedChange:q})]})]})})]}),r.jsx(J,{variant:"secondary",size:"icon",onClick:Z,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:p?r.jsx(Xh,{className:"h-4 w-4"}):r.jsx(Sc,{className:"h-4 w-4"})}),r.jsx(J,{variant:"secondary",size:"icon",onClick:K,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(pS,{className:"h-4 w-4"})}),r.jsxs(J,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(c1,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function yWt({onSelectScript:e,onCreateNew:t,selectedScriptId:n,className:s}){const{toast:i}=pa(),[o,l]=P.useState(""),[a,h]=P.useState(null),[p,x]=P.useState("levelup"),{data:y,isLoading:w}=Kjt(),{data:j,isLoading:S}=Zjt(),{data:C,isLoading:A}=Yjt(),E=Xjt(),T=P.useMemo(()=>j?j.filter(H=>{const K=!o||H.title.toLowerCase().includes(o.toLowerCase())||H.script_text.toLowerCase().includes(o.toLowerCase())||H.tags.some(re=>re.toLowerCase().includes(o.toLowerCase())),Z=!a||H.category_id===a;return K&&Z}):[],[j,o,a]),O=P.useMemo(()=>C?C.filter(H=>!o||H.title.toLowerCase().includes(o.toLowerCase())||H.script_text.toLowerCase().includes(o.toLowerCase())):[],[C,o]),z=H=>{e({title:H.title,text:H.script_text})},F=async H=>{try{await E.mutateAsync(H),i({title:"Script saved to My Scripts"})}catch{i({title:"Failed to save script",variant:"destructive"})}},q=w||S||A;return r.jsxs("div",{className:$t("flex flex-col h-full",s),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search scripts...",value:o,onChange:H=>l(H.target.value),className:"pl-9"})]})}),r.jsxs(ba,{value:p,onValueChange:H=>x(H),className:"flex-1 flex flex-col",children:[r.jsxs(fa,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(ln,{value:"levelup",children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(ln,{value:"my-scripts",children:[r.jsx(dm,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(An,{value:"levelup",className:"flex-1 flex flex-col mt-0 p-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[r.jsx(Ft,{variant:a?"outline":"default",className:"cursor-pointer",onClick:()=>h(null),children:"All"}),y==null?void 0:y.map(H=>r.jsx(Ft,{variant:a===H.id?"default":"outline",className:"cursor-pointer",onClick:()=>h(H.id),children:H.name},H.id))]}),r.jsx(Jo,{className:"flex-1 max-h-[50vh]",children:q?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ai,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No scripts found"})]}):r.jsx("div",{className:"space-y-2",children:T.map(H=>r.jsxs(We,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===H.id&&"ring-2 ring-primary"),onClick:()=>z(H),children:[r.jsx(Wt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Xt,{className:"text-sm font-medium truncate",children:H.title}),H.category&&r.jsx(Ft,{variant:"secondary",className:"mt-1 text-xs",children:H.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:K=>{K.stopPropagation(),F(H)},children:r.jsx(dm,{className:"h-4 w-4"})}),r.jsx(Ga,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(Xe,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:H.script_text})})]},H.id))})})]}),r.jsxs(An,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[t&&r.jsxs(J,{variant:"outline",className:"mb-4",onClick:t,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Jo,{className:"flex-1 max-h-[50vh]",children:A?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):O.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(dm,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No saved scripts"}),r.jsx("p",{className:"text-sm mt-1",children:"Save LevelUp scripts or create your own"})]}):r.jsx("div",{className:"space-y-2",children:O.map(H=>r.jsxs(We,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===H.id&&"ring-2 ring-primary"),onClick:()=>z(H),children:[r.jsx(Wt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Xt,{className:"text-sm font-medium truncate",children:H.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:H.is_custom?r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Ga,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(Xe,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:H.script_text})})]},H.id))})})]})]})]})}function vWt({selectedTemplate:e,onSelect:t,contactName:n,saving:s=!1}){const[i,o]=P.useState(()=>{const a=CS(e);return new Set([a.category])}),l=a=>{o(h=>{const p=new Set(h);return p.has(a)?p.delete(a):p.add(a),p})};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(nn,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:fft.map(a=>{const h=pft(a.id),p=i.has(a.id),x=h.some(y=>y.id===e);return r.jsxs(kS,{open:p,onOpenChange:()=>l(a.id),children:[r.jsxs(NS,{className:"flex items-center justify-between w-full p-2.5 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:a.name}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.length,")"]}),x&&!p&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),r.jsx(Iu,{className:$t("h-4 w-4 text-muted-foreground transition-transform",p&&"rotate-180")})]}),r.jsx(SS,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:h.map(y=>{const w=e===y.id;return r.jsxs("button",{type:"button",onClick:()=>t(y.id),disabled:s,className:$t("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",w?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[w&&r.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:r.jsx(Ca,{className:"h-2.5 w-2.5 text-primary-foreground"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"opacity-70 shrink-0",children:y.icon}),r.jsx("span",{className:"text-sm font-medium truncate",children:y.name})]})]},y.id)})})})]},a.id)})}),n&&e!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',CS(e).headerText(n),'"']})]})}function D$e({open:e,onOpenChange:t,video:n,contactName:s,onTemplateUpdated:i}){const[o,l]=P.useState(n.page_template||"default"),[a,h]=P.useState(!1),[p,x]=P.useState(!1),[y,w]=P.useState(n.page_template||"default"),[j,S]=P.useState([]),[C,A]=P.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[E,T]=P.useState(!1),[O,z]=P.useState(!1),F=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";P.useEffect(()=>{e&&j.length===0&&q()},[e]);const q=async()=>{z(!0);try{const{data:ye,error:ie}=await ee.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(ie)throw ie;const fe=(ye||[]).map(de=>({id:de.id,name:[de.first_name,de.last_name].filter(Boolean).join(" ")||"Unnamed",email:de.email||null}));S(fe)}catch(ye){console.error("Failed to fetch contacts:",ye)}finally{z(!1)}},H=async ye=>{A(ye),T(!1),h(!0);try{const{error:ie}=await ee.from("agent_videos").update({contact_id:(ye==null?void 0:ye.id)||null,recipient_name:(ye==null?void 0:ye.name)||null}).eq("id",n.id);if(ie)throw ie;ze.success(ye?`Assigned to ${ye.name}`:"Contact removed"),i==null||i()}catch(ie){console.error("Failed to update contact:",ie),ze.error("Failed to update contact")}finally{h(!1)}},K=async ye=>{l(ye),h(!0);try{const{error:ie}=await ee.from("agent_videos").update({page_template:ye}).eq("id",n.id);if(ie)throw ie;w(ye),ze.success("Template saved!"),i==null||i()}catch(ie){console.error("Failed to save template:",ie),ze.error("Failed to save template"),l(y)}finally{h(!1)}},Z=(C==null?void 0:C.name)||null,re=()=>{const ye=n.title||"Video Message",ie=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},ue=async()=>{if(!n.thumbnail_url){ze.error("Video thumbnail not available yet");return}const ye=re(),ie=`Watch: ${n.title||"Video Message"} ${F}`;try{const fe=new Blob([ye],{type:"text/html"}),de=new Blob([ie],{type:"text/plain"}),_e=new ClipboardItem({"text/html":fe,"text/plain":de});await navigator.clipboard.write([_e]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ie+` `+ye),ze.success("Copied! Paste into your email.")}},he=async()=>{await navigator.clipboard.writeText(F),x(!0),ze.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},be=()=>{const ie=CS(o).headerText(Z),fe=o==="default"?`Check out this video: ${F}`:`${ie} Check out this special video: ${F}`;window.open(`sms:?body=${encodeURIComponent(fe)}`,"_self")},ne=()=>{const ye=CS(o),ie=ye.headerText(Z),fe=o==="default"?n.title||"Video Message":ie,de=`${ye.subText} Watch the video: ${F}`,_e=C!=null&&C.email?encodeURIComponent(C.email):"";window.open(`mailto:${_e}?subject=${encodeURIComponent(fe)}&body=${encodeURIComponent(de)}`,"_self")};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(es,{children:"Choose a themed page template and share your video"})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_h,{open:E,onOpenChange:T,children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",role:"combobox","aria-expanded":E,className:"flex-1 justify-between",disabled:a,children:[C?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),C.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(a1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ou,{className:"w-[300px] p-0",align:"start",children:r.jsxs($1,{children:[r.jsx(U1,{placeholder:"Search contacts..."}),r.jsxs(q1,{children:[r.jsx(V1,{children:O?"Loading...":"No contacts found."}),r.jsx(H1,{children:j.map(ye=>r.jsxs(W1,{value:ye.name,onSelect:()=>H(ye),children:[r.jsx(Ca,{className:$t("mr-2 h-4 w-4",(C==null?void 0:C.id)===ye.id?"opacity-100":"opacity-0")}),ye.name]},ye.id))})]})]})})]}),C&&r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>H(null),disabled:a,className:"shrink-0",children:r.jsx(Ts,{className:"h-4 w-4"})})]}),C&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',CS(o).headerText(C.name),'"']})]}),r.jsx(vWt,{selectedTemplate:o,onSelect:K,contactName:Z,saving:a}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:F,readOnly:!0,className:"font-mono text-sm"}),r.jsx(J,{onClick:he,variant:p?"default":"outline",className:"shrink-0 gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Ca,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(jl,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Share for Email"}),r.jsxs(J,{variant:"outline",className:"w-full gap-2",onClick:ue,children:[r.jsx(Zo,{className:"h-4 w-4"}),"Copy with Thumbnail (for Gmail)"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste into Gmail to embed a clickable video thumbnail"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(J,{variant:"outline",className:"flex-1 gap-2",onClick:be,children:[r.jsx(Po,{className:"h-4 w-4"}),"Text"]}),r.jsxs(J,{variant:"outline",className:"flex-1 gap-2",onClick:ne,children:[r.jsx(Zs,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(ri,{children:r.jsx(J,{variant:"outline",onClick:()=>t(!1),children:"Done"})})]})})}function _Wt(){var nt;const e=ns(),[t]=Fd(),{toast:n}=pa(),s=t.get("contact_id"),i=t.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:a,isNearLimit:h}=tkt(),{data:p}=op(),x=Lze(),y=ikt(),[w,j]=P.useState("record"),[S,C]=P.useState(""),[A,E]=P.useState(!1),[T,O]=P.useState(!1),[z,F]=P.useState(!1),[q,H]=P.useState(null),[K,Z]=P.useState(0),[re,ue]=P.useState(0),[he,be]=P.useState(null),[ne,ye]=P.useState(null),[ie,fe]=P.useState(s||""),[de,_e]=P.useState(""),[Ee,ke]=P.useState(""),[pe,ae]=P.useState(null),[ge,Me]=P.useState(null),[Ue,Ie]=P.useState(null),[Ke,Re]=P.useState(!1),Ce=P.useCallback(async(Ae,pt)=>{H(Ae),j("uploading");try{const{videoId:Be,uploadUrl:Qe}=await rkt(de||"Quick Video Touch");be(Be);const{apiKey:tt}=await nkt(Be),ht=new XMLHttpRequest;ht.upload.onprogress=Ct=>{Ct.lengthComputable&&Z(Ct.loaded/Ct.total*100)},await new Promise((Ct,It)=>{ht.onload=()=>{ht.status>=200&&ht.status<300?Ct():It(new Error(`Upload failed: ${ht.status}`))},ht.onerror=()=>It(new Error("Upload failed")),ht.open("PUT",Qe),ht.setRequestHeader("AccessKey",tt),ht.send(Ae)}),j("processing");let wt=0;for(;wt<4;){await new Promise(It=>setTimeout(It,2e3));const Ct=await skt(Be);if(wt=Ct.status,ue(Ct.encodeProgress||0),wt===4)ye({playbackUrl:Ct.directPlayUrl,thumbnailUrl:Ct.thumbnailUrl,previewUrl:Ct.previewUrl||null,duration:Ct.length||pt,fileSizeMb:(Ct.storageSize||Ae.size)/(1024*1024)});else if(wt===5||wt===6)throw new Error("Video processing failed")}j("details")}catch(Be){console.error("Upload error:",Be),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),j("record")}},[de,n]),Je=async()=>{if(!(!he||!ne))try{const Ae=ie&&ie!=="none"?ie:null,pt=await x.mutateAsync({bunny_video_id:he,contact_id:Ae,playback_url:ne.playbackUrl,thumbnail_url:ne.thumbnailUrl,preview_url:ne.previewUrl,duration_seconds:ne.duration,file_size_mb:ne.fileSizeMb,title:de||"Quick Video Touch",notes:Ee,task_id:i||null,status:"ready"});ae(pt.id),Me(pt.share_token||null),Ae&&await y.mutateAsync({contactId:Ae,videoId:pt.id,notes:Ee}),n({title:"Video saved successfully!"}),j("share")}catch(Ae){console.error("Save video error:",Ae),n({title:"Failed to save video",description:(Ae==null?void 0:Ae.message)||"Please try again.",variant:"destructive"})}},Te=(Ae,pt)=>{navigator.clipboard.writeText(pt),Ie(Ae),setTimeout(()=>Ie(null),2e3),n({title:"Copied to clipboard!"})},Ye=()=>ge?`https://video.relevelup.com/${ge}`:(ne==null?void 0:ne.playbackUrl)||"",xe=()=>{const Ae=p==null?void 0:p.find(ht=>ht.id===ie),pt=Ae?`${Ae.first_name}`:"",Be=(Ae==null?void 0:Ae.phone)||"",Qe=(Ae==null?void 0:Ae.email)||"",tt=Ye();return{text:`Hey${pt?` ${pt}`:""}! I recorded a quick video for you: ${tt}`,link:tt,contactPhone:Be,contactEmail:Qe}},mt=()=>{const{text:Ae,contactPhone:pt}=xe(),Be=pt?`sms:${pt}?body=${encodeURIComponent(Ae)}`:`sms:?body=${encodeURIComponent(Ae)}`;window.open(Be,"_self")},et=()=>{const{link:Ae,contactEmail:pt}=xe(),Be="Check out this video",Qe=`I recorded a quick video for you: ${Ae}`,tt=pt?`mailto:${pt}?subject=${encodeURIComponent(Be)}&body=${encodeURIComponent(Qe)}`:`mailto:?subject=${encodeURIComponent(Be)}&body=${encodeURIComponent(Qe)}`;window.open(tt,"_self")};return o?r.jsx(Or,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>e(-1),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Quick Video Touch"}),r.jsx("p",{className:"text-muted-foreground",children:"Record a personal video message"})]})]}),h&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",a.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(0)," MB remaining"]})]})]}),w==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(gWt,{maxDurationSeconds:30,onRecordingComplete:Ce,onRecordingStateChange:F,className:"w-full",teleprompterContent:A&&S&&r.jsx(xWt,{text:S,isVisible:A,onToggleVisibility:()=>E(!1),isRecording:z})}),!A&&S&&r.jsxs(J,{variant:"outline",className:"mt-4",onClick:()=>E(!0),children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(We,{className:"lg:col-span-1",children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(ms,{placeholder:"Type or paste your script here...",value:S,onChange:Ae=>C(Ae.target.value),rows:6}),r.jsxs(Jne,{open:T,onOpenChange:O,children:[r.jsx(Ige,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:"w-full",children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(_I,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(ese,{className:"p-4 border-b",children:r.jsx(tse,{children:"Select a Script"})}),r.jsx(yWt,{onSelectScript:Ae=>{C(Ae.text),O(!1),E(!0)},className:"h-[calc(100vh-80px)]"})]})]}),S&&r.jsx(J,{className:"w-full",onClick:()=>E(!0),children:"Use Script"})]})]})]}),w==="uploading"&&r.jsx(We,{className:"max-w-md mx-auto",children:r.jsxs(Xe,{className:"pt-6 text-center",children:[r.jsx(go,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-pulse"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Uploading Video..."}),r.jsx(Hc,{value:K,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[K.toFixed(0),"%"]})]})}),w==="processing"&&r.jsx(We,{className:"max-w-md mx-auto",children:r.jsxs(Xe,{className:"pt-6 text-center",children:[r.jsx(nn,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-spin"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Processing Video..."}),r.jsx(Hc,{value:re,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[re.toFixed(0),"%"]})]})}),w==="details"&&r.jsxs(We,{className:"max-w-lg mx-auto",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Video Details"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Title"}),r.jsx(ct,{value:de,onChange:Ae=>_e(Ae.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Attach to Contact (Optional)"}),r.jsxs(bn,{value:ie,onValueChange:fe,children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"No contact - use anywhere"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(So,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),p==null?void 0:p.map(Ae=>r.jsx(Kt,{value:Ae.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cc,{className:"h-4 w-4"}),Ae.first_name," ",Ae.last_name]})},Ae.id))]})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Notes"}),r.jsx(ms,{value:Ee,onChange:Ae=>ke(Ae.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(J,{className:"w-full",onClick:Je,disabled:x.isPending,children:[x.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),w==="share"&&r.jsxs(We,{className:"max-w-lg mx-auto",children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ca,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(J,{variant:"outline",className:"justify-start",onClick:mt,children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(J,{variant:"outline",className:"justify-start",onClick:et,children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(J,{variant:"outline",className:"justify-start",onClick:()=>Te("link",xe().link),children:[r.jsx(So,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Ue==="link"&&r.jsx(Ca,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(J,{variant:"outline",className:"justify-start",onClick:()=>Re(!0),children:[r.jsx(Ld,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(J,{variant:"outline",onClick:()=>e("/mission-control/video-library"),children:"View Library"}),r.jsx(J,{onClick:()=>{j("record"),H(null),be(null),ye(null)},children:"Record Another"})]})]})]}),pe&&ge&&r.jsx(D$e,{open:Ke,onOpenChange:Re,video:{id:pe,share_token:ge,title:de||null,contact_id:ie||null,thumbnail_url:(ne==null?void 0:ne.thumbnailUrl)||null},contactName:((nt=p==null?void 0:p.find(Ae=>Ae.id===ie))==null?void 0:nt.first_name)||null})]})}):r.jsx(Or,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(zh,{className:"h-16 w-16 text-destructive mx-auto mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Storage Limit Reached"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"You've reached your video storage limit. Delete videos from your library to record more."}),r.jsx(J,{onClick:()=>e("/mission-control/video-library"),children:"Open Video Library"})]})})}function bWt({open:e,onOpenChange:t}){const{data:n}=op(),{data:s}=kye(),i=Lze(),o=P.useRef(null),[l,a]=P.useState(null),[h,p]=P.useState(""),[x,y]=P.useState(""),[w,j]=P.useState(""),[S,C]=P.useState(!1),[A,E]=P.useState(0),[T,O]=P.useState("idle"),z=(s==null?void 0:s.total_storage_mb)||0,q=((s==null?void 0:s.max_storage_mb)||1024)-z,H=ue=>{var ne;const he=(ne=ue.target.files)==null?void 0:ne[0];if(!he)return;if(!he.type.startsWith("video/")){ze.error("Please select a video file");return}const be=he.size/(1024*1024);if(be>500){ze.error("Video file must be less than 500MB");return}if(be>q){ze.error(`Not enough storage. You have ${q.toFixed(1)} MB remaining.`);return}a(he),h||p(he.name.replace(/\.[^/.]+$/,""))},K=async()=>{if(!l){ze.error("Please select a video file");return}C(!0),E(0),O("creating");try{const{data:ue,error:he}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:h||l.name,isAgentVideo:!0}});if(he)throw new Error(he.message);const{videoId:be,libraryId:ne}=ue;O("uploading");const{data:ye,error:ie}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:be,isAgentVideo:!0}});if(ie)throw new Error(ie.message);await new Promise((_e,Ee)=>{const ke=new XMLHttpRequest;ke.upload.addEventListener("progress",pe=>{if(pe.lengthComputable){const ae=Math.round(pe.loaded/pe.total*100);E(ae)}}),ke.addEventListener("load",()=>{ke.status>=200&&ke.status<300?_e():Ee(new Error(`Upload failed with status ${ke.status}`))}),ke.addEventListener("error",()=>Ee(new Error("Upload failed"))),ke.open("PUT",ye.uploadUrl),ke.setRequestHeader("AccessKey",ye.apiKey),ke.send(l)}),O("processing");const fe=l.size/(1024*1024),de=`https://iframe.mediadelivery.net/embed/${ne}/${be}`;await i.mutateAsync({bunny_video_id:be,playback_url:de,file_size_mb:fe,title:h||l.name,notes:x||void 0,contact_id:w||void 0,status:"processing",touch_type:"video_upload"}),ze.success("Video uploaded successfully! Processing may take a few minutes."),Z()}catch(ue){console.error("Upload error:",ue),ze.error(ue instanceof Error?ue.message:"Failed to upload video")}finally{C(!1),O("idle")}},Z=()=>{S||(a(null),p(""),y(""),j(""),E(0),O("idle"),t(!1))},re=()=>{switch(T){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${A}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Br,{open:e,onOpenChange:Z,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Upload Video"}),r.jsx(es,{children:"Upload a video file from your device to your video library."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Video File"}),l?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Fi,{className:"h-8 w-8 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:l.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(l.size/(1024*1024)).toFixed(1)," MB"]})]}),!S&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ue=>{ue.stopPropagation(),a(null)},children:r.jsx(Ts,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>{var ue;return(ue=o.current)==null?void 0:ue.click()},children:[r.jsx(go,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),r.jsx("input",{ref:o,type:"file",accept:"video/*",className:"hidden",onChange:H,disabled:S})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"title",children:"Title"}),r.jsx(ct,{id:"title",value:h,onChange:ue=>p(ue.target.value),placeholder:"Enter video title",disabled:S})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Associate with Contact (optional)"}),r.jsxs(bn,{value:w||"__none__",onValueChange:ue=>j(ue==="__none__"?"":ue),disabled:S,children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select a contact"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(ue=>r.jsxs(Kt,{value:ue.id,children:[ue.first_name," ",ue.last_name||""]},ue.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(ms,{id:"notes",value:x,onChange:ue=>y(ue.target.value),placeholder:"Add any notes about this video",rows:2,disabled:S})]}),S&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:re()})]}),r.jsx(Hc,{value:T==="uploading"?A:T==="processing"?100:10})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:Z,disabled:S,children:"Cancel"}),r.jsx(J,{onClick:K,disabled:!l||S,children:S?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(go,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function wWt({previewSrc:e,thumbnailSrc:t,alt:n,isHovered:s}){const[i,o]=P.useState(!1),[l,a]=P.useState(!1),h=s&&e&&!i,p=t&&!l;return!p&&!h?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[p&&r.jsx("img",{src:t,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${h?"opacity-0":"opacity-100"}`,onError:()=>a(!0)}),h&&r.jsx("img",{src:e,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function jWt({video:e,previewSrc:t,thumbnailSrc:n,onOpen:s,onDelete:i,onNavigateToContact:o,onGetEmbedCode:l,onCopyEmailHtml:a,onShareWithTemplate:h,getContactName:p,getShareUrl:x,copyToClipboard:y,formatDuration:w}){const[j,S]=P.useState(!1);return r.jsxs(We,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(wWt,{previewSrc:t,thumbnailSrc:n,alt:e.title||"Video preview",isHovered:j}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center",children:r.jsx(Sc,{className:"h-6 w-6 text-primary ml-1"})})}),r.jsx("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:w(e.duration_seconds)}),e.status!=="ready"&&r.jsx(Ft,{variant:e.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:e.status})]}),r.jsx(Xe,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"font-medium truncate",children:e.title||"Untitled Video"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[r.jsx(Cc,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:p(e.contact_id)})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-0.5",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),r.jsx("span",{children:fn(new Date(e.created_at),"MMM d, yyyy")})]}),(e.view_count??0)>0&&r.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[r.jsx(Qo,{className:"h-3 w-3"}),r.jsxs("span",{children:[e.view_count," ",e.view_count===1?"view":"views"]})]})]})]}),r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:C=>C.stopPropagation(),children:r.jsx(Sx,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",className:"bg-popover",children:[r.jsxs(po,{onClick:C=>{C.stopPropagation(),s()},children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(fC,{}),r.jsxs(po,{onClick:C=>{C.stopPropagation(),h()},children:[r.jsx(Ld,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(po,{onClick:C=>{C.stopPropagation(),y(x(e),"Share link")},children:[r.jsx(So,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(po,{onClick:C=>{C.stopPropagation(),l()},children:[r.jsx(cj,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(po,{onClick:C=>{C.stopPropagation(),a()},children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsx(fC,{}),e.contact_id&&r.jsxs(po,{onClick:C=>{C.stopPropagation(),o()},children:[r.jsx(Cc,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(po,{onClick:C=>{C.stopPropagation(),i()},className:"text-destructive",children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function kWt(){const e=ns(),{data:t,isLoading:n}=Qjt(),{data:s}=kye(),{data:i}=op(),o=ekt(),[l,a]=P.useState(""),[h,p]=P.useState(null),[x,y]=P.useState(!1),[w,j]=P.useState(!1),[S,C]=P.useState(!1),[A,E]=P.useState(!1),[T,O]=P.useState(!1),[z,F]=P.useState({}),q=ae=>{if(!ae)return"Unassigned";const ge=i==null?void 0:i.find(Me=>Me.id===ae);return ge?`${ge.first_name} ${ge.last_name||""}`.trim():"Unknown"},H=ae=>{if(!ae)return"0:00";const ge=Math.floor(ae/60),Me=ae%60;return`${ge}:${Me.toString().padStart(2,"0")}`},K=t==null?void 0:t.filter(ae=>{if(!l)return!0;const ge=q(ae.contact_id).toLowerCase(),Me=(ae.title||"").toLowerCase(),Ue=(ae.notes||"").toLowerCase();return ge.includes(l.toLowerCase())||Me.includes(l.toLowerCase())||Ue.includes(l.toLowerCase())});P.useEffect(()=>{(async()=>{if(!(t!=null&&t.length))return;const ge=t.filter(Ue=>(Ue==null?void 0:Ue.bunny_video_id)&&!z[Ue.id]);if(!ge.length)return;const Me=await Promise.allSettled(ge.map(async Ue=>{const{data:Ie,error:Ke}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Ue.bunny_video_id,isAgentVideo:!0}});if(Ke)throw Ke;return{id:Ue.id,previewUrl:Ie==null?void 0:Ie.previewUrl,thumbnailUrl:Ie==null?void 0:Ie.thumbnailUrl}}));F(Ue=>{const Ie={...Ue};for(const Ke of Me)Ke.status==="fulfilled"&&(Ie[Ke.value.id]={previewUrl:Ke.value.previewUrl,thumbnailUrl:Ke.value.thumbnailUrl});return Ie})})().catch(ge=>console.warn("Failed to load signed Bunny asset URLs",ge))},[t,z]);const Z=(s==null?void 0:s.total_storage_mb)||0,re=(s==null?void 0:s.max_storage_mb)||1024,ue=Z/re*100,he=ue>=80,be=ue>=100,ne=async(ae,ge)=>{await navigator.clipboard.writeText(ae),ze.success(`${ge} copied to clipboard`)},ye=ae=>ae.share_token?`https://video.relevelup.com/${ae.share_token}`:ae.playback_url||"",ie=ae=>{const ge=ye(ae),Me=i==null?void 0:i.find(Je=>Je.id===ae.contact_id),Ue=q(ae.contact_id),Ie=Ue!=="Unassigned"?Ue.split(" ")[0]:"",Ke=(Me==null?void 0:Me.phone)||"",Re=`Hey${Ie?` ${Ie}`:""}! I recorded a quick video message for you. Check it out: ${ge}`,Ce=Ke?`sms:${Ke}?body=${encodeURIComponent(Re)}`:`sms:?body=${encodeURIComponent(Re)}`;window.open(Ce,"_self")},fe=ae=>{const ge=i==null?void 0:i.find(Ce=>Ce.id===ae.contact_id),Me=(ge==null?void 0:ge.email)||"",Ue=ye(ae),Ie="Check out this video",Ke=`I recorded a quick video for you: ${Ue}`,Re=Me?`mailto:${Me}?subject=${encodeURIComponent(Ie)}&body=${encodeURIComponent(Ke)}`:`mailto:?subject=${encodeURIComponent(Ie)}&body=${encodeURIComponent(Ke)}`;window.open(Re,"_self")},de=ae=>{var Ie;const ge=ye(ae),Me=ae.title||"Video Message",Ue=ae.share_token?`https://video.relevelup.com/thumb/${ae.share_token}`:((Ie=z[ae.id])==null?void 0:Ie.thumbnailUrl)||ae.thumbnail_url||"";return``},_e=async ae=>{if(!ae.thumbnail_url&&!ae.share_token){ze.error("Video thumbnail not available yet");return}const ge=de(ae),Me=ye(ae),Ue=`Watch: ${ae.title||"Video Message"} ${Me}`;try{const Ie=new Blob([ge],{type:"text/html"}),Ke=new Blob([Ue],{type:"text/plain"}),Re=new ClipboardItem({"text/html":Ie,"text/plain":Ke});await navigator.clipboard.write([Re]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(Ue+` `+ge),ze.success("Copied! Paste into your email.")}},Ee=async ae=>{try{ze.loading("Preparing download...",{id:"download"});const{data:ge,error:Me}=await ee.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:ae.bunny_video_id,isAgentVideo:!0}});if(Me||!(ge!=null&&ge.downloadUrl))throw new Error((Me==null?void 0:Me.message)||"Failed to get download URL");const Ie=`${((ae.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,Ke=await fetch(ge.downloadUrl);if(!Ke.ok)throw new Error("Failed to fetch video file");const Re=await Ke.blob(),Ce=URL.createObjectURL(Re),Je=document.createElement("a");Je.href=Ce,Je.download=Ie,Je.rel="noreferrer",document.body.appendChild(Je),Je.click(),Je.remove(),URL.revokeObjectURL(Ce),ze.success("Download started",{id:"download"})}catch(ge){console.error("Download error:",ge),ze.error("Could not force download (your browser may block it).",{id:"download"})}},ke=ae=>{p(ae),y(!0)},pe=async()=>{if(h)try{await o.mutateAsync({id:h.id,bunnyVideoId:h.bunny_video_id,hardDelete:!0}),j(!1),p(null),ze.success("Video deleted successfully")}catch{ze.error("Failed to delete video")}};return r.jsx(Or,{title:"Video Library",description:"Manage your video touches",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Video Library"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage and share your video touches"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(J,{variant:"outline",onClick:()=>C(!0),children:[r.jsx(go,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(J,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(We,{className:he?"border-amber-500":be?"border-destructive":"",children:r.jsxs(Xe,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(AT,{className:`h-5 w-5 ${be?"text-destructive":he?"text-amber-500":"text-muted-foreground"}`}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-sm font-medium",children:"Storage Used"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[Z.toFixed(1)," MB / ",re>=1024?`${(re/1024).toFixed(0)} GB`:`${re} MB`]})]}),r.jsx(Hc,{value:Math.min(ue,100),className:`h-2 ${be?"[&>div]:bg-destructive":he?"[&>div]:bg-amber-500":""}`})]}),he&&!be&&r.jsxs(Ft,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(El,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),be&&r.jsxs(Ft,{variant:"destructive",children:[r.jsx(El,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),be&&r.jsx("p",{className:"text-sm text-destructive mt-2",children:"You've reached your storage limit. Delete videos to record more."})]})}),r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search videos by contact, title, or notes...",value:l,onChange:ae=>a(ae.target.value),className:"pl-10"})]}),n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):(K==null?void 0:K.length)===0?r.jsx(We,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No videos yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Record your first video touch to get started"}),r.jsxs(J,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Record Video"]})]})}):r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:K==null?void 0:K.map(ae=>{var ge,Me;return r.jsx(jWt,{video:ae,previewSrc:(ge=z[ae.id])==null?void 0:ge.previewUrl,thumbnailSrc:(Me=z[ae.id])==null?void 0:Me.thumbnailUrl,onOpen:()=>ke(ae),onDelete:()=>{p(ae),j(!0)},onNavigateToContact:()=>e(`/mission-control/contacts/${ae.contact_id}`),onGetEmbedCode:()=>{p(ae),E(!0)},onCopyEmailHtml:()=>_e(ae),onShareWithTemplate:()=>{p(ae),O(!0)},getContactName:q,getShareUrl:ye,copyToClipboard:ne,formatDuration:H},ae.id)})}),r.jsx(Br,{open:x,onOpenChange:y,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:(h==null?void 0:h.title)||"Video Preview"}),r.jsx(es,{children:(h==null?void 0:h.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Cc,{className:"h-3 w-3"}),q(h.contact_id)]})})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:h.playback_url?(()=>{let ae=h.playback_url;return ae.includes("iframe.mediadelivery.net/play/")&&(ae=ae.replace("/play/","/embed/"),ae+=(ae.includes("?")?"&":"?")+"autoplay=false&responsive=true"),ae.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:ae,title:h.title||"Video preview",className:"absolute top-0 left-0 w-full h-full rounded-lg",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:h.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:h.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>ze.error("Video preview failed to load")},h.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground ml-2",children:"Video not available"})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(J,{variant:"outline",onClick:()=>ie(h),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(J,{variant:"outline",onClick:()=>fe(h),children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(J,{variant:"outline",onClick:()=>ne(ye(h),"Share link"),children:[r.jsx(jl,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(J,{variant:"outline",onClick:()=>_e(h),children:[r.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(J,{variant:"outline",onClick:()=>Ee(h),children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(J,{variant:"outline",onClick:()=>{y(!1),O(!0)},children:[r.jsx(Ld,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(J,{variant:"destructive",onClick:()=>{y(!1),j(!0)},children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Br,{open:w,onOpenChange:j,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Delete Video"}),r.jsx(es,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(J,{variant:"destructive",onClick:pe,disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(bWt,{open:S,onOpenChange:C}),r.jsx(Br,{open:A,onOpenChange:E,children:r.jsxs(Fr,{className:"sm:max-w-lg",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Embed Video"}),r.jsx(es,{children:"Copy this code to embed the video on your website."})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Embed Code"}),r.jsx(ms,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(J,{className:"flex-1",onClick:()=>{const ae=``;ne(ae,"Embed code")},children:[r.jsx(jl,{className:"h-4 w-4 mr-2"}),"Copy Embed Code"]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this code into your website's HTML where you want the video to appear. The video will automatically resize to fit its container."})]})]})}),h&&r.jsx(D$e,{open:T,onOpenChange:O,video:h,contactName:q(h.contact_id)})]})})}function R$e({stages:e,currentStageId:t,onStageSelect:n,disabled:s}){const[i,o]=P.useState(!1),l=e.find(h=>h.id===t),a=h=>{h.id!==t&&n(h.id,h.name),o(!1)};return r.jsxs(Sm,{open:i,onOpenChange:o,children:[r.jsx(Cm,{asChild:!0,children:r.jsxs(J,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:h=>h.stopPropagation(),children:[l&&r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:l.color}}),r.jsx("span",{className:"max-w-[80px] truncate",children:(l==null?void 0:l.name)||"Move"}),r.jsx(Ga,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(ap,{align:"end",className:"w-48 z-50 bg-popover",onClick:h=>h.stopPropagation(),children:e.map(h=>{const p=h.icon&&CAe[h.icon]||Pu,x=h.id===t;return r.jsxs(po,{onClick:()=>a(h),className:$t("flex items-center gap-2 cursor-pointer",x&&"bg-accent"),children:[r.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${h.color}20`},children:r.jsx(p,{className:"h-3 w-3",style:{color:h.color}})}),r.jsx("span",{className:"flex-1",children:h.name}),x&&r.jsx(Ca,{className:"h-4 w-4 text-primary"})]},h.id)})})]})}const NWt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},SWt={low:{color:"bg-slate-100 text-slate-600",dot:"bg-slate-400"},medium:{color:"bg-amber-100 text-amber-700",dot:"bg-amber-500"},high:{color:"bg-orange-100 text-orange-700",dot:"bg-orange-500"},urgent:{color:"bg-red-100 text-red-700",dot:"bg-red-500"}};function F$e({deal:e,onClick:t,isDragging:n,stages:s,onStageChange:i,showStagePicker:o=!1,isWonStage:l=!1}){var A,E;const a=OI(),h=NWt[e.deal_type],p=SWt[e.priority],x=P.useMemo(()=>e.target_close_date?mC(new Date(e.target_close_date),new Date):null,[e.target_close_date]),y=x!==null&&x<0,w=x!==null&&x<=7&&x>=0,j=l&&!e.scorecard_transaction_id,S=!!e.scorecard_transaction_id,C=T=>T?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T):null;return r.jsx(We,{className:$t("cursor-pointer transition-all duration-200 hover:shadow-md hover:border-primary/30 group",n&&"opacity-50 rotate-2 shadow-xl",y&&"border-red-200 bg-red-50/30",j&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:t,children:r.jsxs(Xe,{className:"p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:e.deal_name})}),r.jsx(Ft,{variant:"outline",className:$t("text-[10px] px-1.5 py-0 shrink-0",h.color),children:h.label})]}),e.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ci,{className:"h-5 w-5",children:r.jsxs(di,{className:"text-[10px] bg-primary/10 text-primary",children:[(A=e.contact.first_name)==null?void 0:A[0],(E=e.contact.last_name)==null?void 0:E[0]]})}),r.jsxs("span",{className:"truncate",children:[e.contact.first_name," ",e.contact.last_name]})]}),e.listing&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(Yh,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),j&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[r.jsx(Ha,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),S&&l&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[r.jsx(Za,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:"Synced to Scorecard"})]}),!e.listing&&(e.property_address||e.city)&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(fi,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:e.property_address||`${e.city}, ${e.state}`})]}),e.expected_price&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(ud,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:C(e.expected_price)}),e.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",C(e.expected_commission)," GCI"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-1 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:$t("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",p.color),children:[r.jsx("div",{className:$t("w-1.5 h-1.5 rounded-full",p.dot)}),r.jsx("span",{className:"capitalize",children:e.priority})]}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.probability,"%"]})]}),o&&a&&s&&i?r.jsx(R$e,{stages:s,currentStageId:e.stage_id||"",onStageSelect:(T,O)=>i(e.id,T,O)}):e.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-[10px]",y&&"text-red-600",w&&!y&&"text-amber-600",!y&&!w&&"text-muted-foreground"),children:[y?r.jsx(El,{className:"h-3 w-3"}):r.jsx(Ys,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:w?`${x}d left`:fn(new Date(e.target_close_date),"MMM d")})]}):null]})]})})}function CWt({stage:e,deals:t,onDealClick:n,onAddDeal:s,onDragStart:i,onDragOver:o,onDrop:l,isDragOver:a,isWonStage:h=!1}){const p=P.useRef(null),x=t.reduce((S,C)=>S+(C.expected_price||0),0),y=t.reduce((S,C)=>S+(C.expected_commission||0),0),w=S=>S>=1e6?`$${(S/1e6).toFixed(1)}M`:S>=1e3?`$${(S/1e3).toFixed(0)}K`:`$${S.toFixed(0)}`,j=e.icon&&CAe[e.icon]||Pu;return r.jsxs("div",{ref:p,className:$t("flex flex-col h-full min-w-[280px] max-w-[320px] bg-muted/30 rounded-xl border border-border/50 transition-all duration-200",a&&"border-primary/50 bg-primary/5 ring-2 ring-primary/20"),onDragOver:S=>o(S,e.id),onDrop:S=>l(S,e.id),children:[r.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:e.color,borderTopWidth:3},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{backgroundColor:`${e.color}20`},children:r.jsx(j,{className:"h-4 w-4",style:{color:e.color}})}),r.jsx("div",{children:r.jsx("h3",{className:"font-semibold text-sm",children:e.name})})]}),r.jsx(Ft,{variant:"secondary",className:"text-xs font-medium px-2",children:t.length})]}),x>0&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:w(x)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[w(y)," GCI"]})]})]}),r.jsx(Jo,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[t.map(S=>r.jsx("div",{draggable:!0,onDragStart:C=>{C.dataTransfer.effectAllowed="move",i(S.id,e.id)},children:r.jsx(F$e,{deal:S,onClick:()=>n(S),isWonStage:h})},S.id)),t.length===0&&r.jsxs("div",{className:"py-8 px-4 text-center text-muted-foreground text-sm",children:[r.jsx("p",{className:"mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-xs",children:"Drag deals here or add new"})]})]})}),r.jsx("div",{className:"p-2 border-t border-border/50 shrink-0",children:r.jsxs(J,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(e.id),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function MWt({stats:e,isLoading:t}){const n=i=>i>=1e6?`$${(i/1e6).toFixed(1)}M`:i>=1e3?`$${(i/1e3).toFixed(0)}K`:`$${i.toLocaleString()}`,s=[{label:"Active Deals",value:(e==null?void 0:e.activeDeals)||0,icon:Wx,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((e==null?void 0:e.pipelineValue)||0),icon:ac,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((e==null?void 0:e.expectedCommission)||0),icon:ud,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(e==null?void 0:e.wonDeals)||0,icon:Ha,color:"text-amber-500",bgColor:"bg-amber-500/10"}];return t?r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(i=>r.jsx(We,{className:"animate-pulse",children:r.jsx(Xe,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},i))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(i=>r.jsx(We,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:$t("p-2 rounded-lg",i.bgColor),children:r.jsx(i.icon,{className:$t("h-5 w-5",i.color)})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:i.label}),r.jsx("p",{className:"text-xl font-bold",children:i.value})]})]})})},i.label))})}const TWt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],AWt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function EWt({open:e,onOpenChange:t,deal:n,defaultStageId:s}){const{data:i}=I0e(),{data:o}=op(),{data:l}=wxe(),a=L$e(),h=O$e(),[p,x]=P.useState(""),[y,w]=P.useState(!1),j=(l==null?void 0:l.filter(z=>((n==null?void 0:n.listing_id)===z.id,!0)))||[],[S,C]=P.useState({deal_name:"",deal_type:"buyer",stage_id:"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""});P.useEffect(()=>{var z,F,q;e&&(n?(C({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||"",contact_id:n.contact_id||"",listing_id:n.listing_id||"",property_address:n.property_address||"",city:n.city||"",state:n.state||"",zip_code:n.zip_code||"",expected_price:((z=n.expected_price)==null?void 0:z.toString())||"",commission_percentage:((F=n.commission_percentage)==null?void 0:F.toString())||"3",target_close_date:n.target_close_date?new Date(n.target_close_date):void 0,contract_date:n.contract_date?new Date(n.contract_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&x(`${n.contact.first_name} ${n.contact.last_name}`)):(C({deal_name:"",deal_type:"buyer",stage_id:s||((q=i==null?void 0:i[0])==null?void 0:q.id)||"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""}),x("")))},[e,n,s,i]);const A=o==null?void 0:o.filter(z=>{var q,H,K;const F=p.toLowerCase();return((q=z.first_name)==null?void 0:q.toLowerCase().includes(F))||((H=z.last_name)==null?void 0:H.toLowerCase().includes(F))||((K=z.email)==null?void 0:K.toLowerCase().includes(F))}).slice(0,5),E=()=>{const z=parseFloat(S.expected_price)||0,F=parseFloat(S.commission_percentage)||0;return z*(F/100)},T=async z=>{var F,q;if(z.preventDefault(),!S.deal_name.trim()){ze.error("Please enter a deal name");return}try{const H={deal_name:S.deal_name,deal_type:S.deal_type,stage_id:S.stage_id||null,contact_id:S.contact_id||null,listing_id:S.listing_id||null,property_address:S.property_address||null,city:S.city||null,state:S.state||null,zip_code:S.zip_code||null,expected_price:S.expected_price?parseFloat(S.expected_price):null,expected_commission:E()||null,commission_percentage:S.commission_percentage?parseFloat(S.commission_percentage):3,target_close_date:((F=S.target_close_date)==null?void 0:F.toISOString().split("T")[0])||null,contract_date:((q=S.contract_date)==null?void 0:q.toISOString().split("T")[0])||null,priority:S.priority,probability:parseInt(S.probability)||50,notes:S.notes||null};n?(await h.mutateAsync({id:n.id,...H}),ze.success("Deal updated successfully")):(await a.mutateAsync(H),ze.success("Deal created successfully")),t(!1)}catch{ze.error("Failed to save deal")}},O=a.isPending||h.isPending;return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(es,{children:n?"Update the deal details below.":"Enter the details for your new deal."})]}),r.jsxs("form",{onSubmit:T,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Ve,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(ct,{id:"deal_name",value:S.deal_name,onChange:z=>C(F=>({...F,deal_name:z.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Deal Type"}),r.jsxs(bn,{value:S.deal_type,onValueChange:z=>C(F=>({...F,deal_type:z})),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:TWt.map(z=>r.jsx(Kt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Stage"}),r.jsxs(bn,{value:S.stage_id,onValueChange:z=>C(F=>({...F,stage_id:z})),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select stage"})}),r.jsx(_n,{children:i==null?void 0:i.map(z=>r.jsx(Kt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:z.color}}),z.name]})},z.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{value:p,onChange:z=>{x(z.target.value),w(!0),z.target.value||C(F=>({...F,contact_id:""}))},onFocus:()=>w(!0),placeholder:"Search contacts...",className:"pl-9"}),y&&p&&A&&A.length>0&&r.jsx("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:A.map(z=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{C(F=>({...F,contact_id:z.id})),x(`${z.first_name} ${z.last_name}`),w(!1)},children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[z.first_name," ",z.last_name]}),z.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:z.email})]},z.id))})]})]}),j.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{className:"flex items-center gap-2",children:[r.jsx(Yh,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(bn,{value:S.listing_id,onValueChange:z=>{const F=j.find(q=>q.id===z);C(F?q=>{var H;return{...q,listing_id:z,deal_type:"seller",property_address:F.property_address||q.property_address,city:F.city||q.city,state:F.state||q.state,expected_price:((H=F.price)==null?void 0:H.toString())||q.expected_price}}:q=>({...q,listing_id:z}))},children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"",children:"None"}),j.map(z=>r.jsx(Kt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:z.property_address||`${z.city}, ${z.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",(z.price/1e3).toFixed(0),"K"]})]})},z.id))]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes will sync automatically between the deal and listing."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Property Details"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Ve,{htmlFor:"property_address",children:"Address"}),r.jsx(ct,{id:"property_address",value:S.property_address,onChange:z=>C(F=>({...F,property_address:z.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"city",children:"City"}),r.jsx(ct,{id:"city",value:S.city,onChange:z=>C(F=>({...F,city:z.target.value}))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"state",children:"State"}),r.jsx(ct,{id:"state",value:S.state,onChange:z=>C(F=>({...F,state:z.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(ct,{id:"zip_code",value:S.zip_code,onChange:z=>C(F=>({...F,zip_code:z.target.value}))})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Financial Details"}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"expected_price",children:"Expected Price"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(ct,{id:"expected_price",type:"number",value:S.expected_price,onChange:z=>C(F=>({...F,expected_price:z.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(ct,{id:"commission_percentage",type:"number",step:"0.1",value:S.commission_percentage,onChange:z=>C(F=>({...F,commission_percentage:z.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Expected GCI"}),r.jsx(ct,{value:E()?`$${E().toLocaleString()}`:"-",disabled:!0,className:"bg-muted"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Dates & Status"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Target Close Date"}),r.jsxs(_h,{children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!S.target_close_date&&"text-muted-foreground"),children:[r.jsx(Ys,{className:"mr-2 h-4 w-4"}),S.target_close_date?fn(S.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(Ou,{className:"w-auto p-0",align:"start",children:r.jsx(Bj,{mode:"single",selected:S.target_close_date,onSelect:z=>C(F=>({...F,target_close_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Contract Date"}),r.jsxs(_h,{children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!S.contract_date&&"text-muted-foreground"),children:[r.jsx(Ys,{className:"mr-2 h-4 w-4"}),S.contract_date?fn(S.contract_date,"PPP"):"Pick a date"]})}),r.jsx(Ou,{className:"w-auto p-0",align:"start",children:r.jsx(Bj,{mode:"single",selected:S.contract_date,onSelect:z=>C(F=>({...F,contract_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Priority"}),r.jsxs(bn,{value:S.priority,onValueChange:z=>C(F=>({...F,priority:z})),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:AWt.map(z=>r.jsx(Kt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(ct,{type:"number",min:"0",max:"100",value:S.probability,onChange:z=>C(F=>({...F,probability:z.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"notes",children:"Notes"}),r.jsx(ms,{id:"notes",value:S.notes,onChange:z=>C(F=>({...F,notes:z.target.value})),placeholder:"Add any additional notes about this deal...",rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(J,{type:"submit",disabled:O,children:[O&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const IWt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},PWt={note:Po,call:ca,email:Zs,meeting:Ys,stage_change:Ls,task_completed:Za,document:fi,system:Ki};function LWt({deal:e,open:t,onOpenChange:n,onEdit:s,onAddToScorecard:i,isWonStage:o}){var he,be;const{data:l,isLoading:a}=eWt((e==null?void 0:e.id)||""),{data:h,isLoading:p}=rWt((e==null?void 0:e.id)||""),x=tWt(),y=sWt(),w=nWt(),j=JHt(),[S,C]=P.useState(""),[A,E]=P.useState(""),[T,O]=P.useState(!1);if(!e)return null;const z=IWt[e.deal_type],F=ne=>ne?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ne):"-",q=async()=>{if(S.trim())try{await x.mutateAsync({deal_id:e.id,activity_type:"note",title:"Note added",description:S}),C(""),ze.success("Note added")}catch{ze.error("Failed to add note")}},H=async()=>{if(A.trim())try{await y.mutateAsync({deal_id:e.id,title:A,sort_order:((h==null?void 0:h.length)||0)+1}),E(""),ze.success("Task added")}catch{ze.error("Failed to add task")}},K=async(ne,ye)=>{try{await w.mutateAsync({id:ne,is_completed:ye,deal_id:e.id})}catch{ze.error("Failed to update task")}},Z=async()=>{try{await j.mutateAsync(e.id),ze.success("Deal deleted"),n(!1)}catch{ze.error("Failed to delete deal")}},re=(h==null?void 0:h.filter(ne=>ne.is_completed).length)||0,ue=(h==null?void 0:h.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(Jne,{open:t,onOpenChange:n,children:r.jsxs(_I,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(ese,{className:"p-6 pb-4 border-b shrink-0",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{variant:"outline",className:$t("text-xs",z.color),children:z.label}),r.jsxs(Ft,{variant:"secondary",className:"text-xs capitalize",children:[e.priority," priority"]})]}),r.jsx(tse,{className:"text-xl",children:e.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{variant:"outline",size:"icon",onClick:()=>s(e),children:r.jsx(rc,{className:"h-4 w-4"})}),r.jsx(J,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>O(!0),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})}),r.jsx(Jo,{className:"flex-1",children:r.jsxs("div",{className:"p-6 space-y-6",children:[e.contact&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(ci,{className:"h-10 w-10",children:r.jsxs(di,{className:"bg-primary/10 text-primary",children:[(he=e.contact.first_name)==null?void 0:he[0],(be=e.contact.last_name)==null?void 0:be[0]]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"font-medium",children:[e.contact.first_name," ",e.contact.last_name]}),e.contact.email&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.contact.email})]}),r.jsxs("div",{className:"flex gap-2",children:[e.contact.phone&&r.jsx(J,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${e.contact.phone}`,children:r.jsx(ca,{className:"h-4 w-4"})})}),e.contact.email&&r.jsx(J,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${e.contact.email}`,children:r.jsx(Zs,{className:"h-4 w-4"})})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(e.property_address||e.city)&&r.jsxs("div",{className:"col-span-2 flex items-start gap-2 text-sm",children:[r.jsx(fi,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:e.property_address||"Address TBD"}),r.jsx("p",{className:"text-muted-foreground",children:[e.city,e.state,e.zip_code].filter(Boolean).join(", ")})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected Price"}),r.jsx("p",{className:"text-lg font-bold",children:F(e.expected_price)})]}),r.jsxs("div",{className:"bg-emerald-500/10 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected GCI"}),r.jsx("p",{className:"text-lg font-bold text-emerald-600",children:F(e.expected_commission)})]}),o&&!e.scorecard_transaction_id&&i&&r.jsxs(J,{onClick:()=>i(e),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(Ha,{className:"h-4 w-4 mr-2"}),"Add to Scorecard"]}),e.scorecard_transaction_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-lg p-3",children:[r.jsx(Za,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),e.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ys,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",fn(new Date(e.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(ud,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[e.probability,"% probability"]})]})]}),e.notes&&r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium mb-1",children:"Notes"}),r.jsx("p",{className:"text-muted-foreground",children:e.notes})]}),r.jsxs(ba,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(fa,{className:"w-full grid grid-cols-2",children:[r.jsxs(ln,{value:"tasks",className:"gap-1",children:[r.jsx(Za,{className:"h-4 w-4"}),"Tasks ",ue>0&&`(${re}/${ue})`]}),r.jsxs(ln,{value:"activity",className:"gap-1",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(An,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{placeholder:"Add a new task...",value:A,onChange:ne=>E(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&H()}),r.jsx(J,{onClick:H,disabled:!A.trim(),children:r.jsx(jn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[h==null?void 0:h.map(ne=>r.jsxs("div",{className:$t("flex items-center gap-3 p-3 rounded-lg border transition-colors",ne.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(cc,{checked:ne.is_completed,onCheckedChange:ye=>K(ne.id,!!ye)}),r.jsx("span",{className:$t("flex-1 text-sm",ne.is_completed&&"line-through text-muted-foreground"),children:ne.title}),ne.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:fn(new Date(ne.due_date),"MMM d")})]},ne.id)),(h==null?void 0:h.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs(An,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ms,{placeholder:"Add a note...",value:S,onChange:ne=>C(ne.target.value),rows:2}),r.jsxs(J,{onClick:q,disabled:!S.trim(),size:"sm",className:"w-full",children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[l==null?void 0:l.map(ne=>{const ye=PWt[ne.activity_type]||Ki;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:r.jsx(ye,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:ne.title}),ne.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:ne.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:tu(new Date(ne.created_at),{addSuffix:!0})})]})]},ne.id)}),(l==null?void 0:l.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No activity yet"})]})]})]})]})})]})}),r.jsx(uh,{open:T,onOpenChange:O,children:r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Delete Deal?"}),r.jsxs(Su,{children:['This will permanently delete "',e.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function OWt({open:e,onOpenChange:t,deal:n,onComplete:s}){const i=jse(),o=O$e(),{data:l}=wse(),{data:a}=Bg(),[h,p]=P.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:fn(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});P.useEffect(()=>{if(n&&e){const w=n.deal_type==="seller"?"seller":"buyer",j=n.expected_price||0,S=n.commission_percentage||3,C=n.expected_commission||j*S/100;p({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:w,close_date:n.actual_close_date||n.target_close_date||fn(new Date,"yyyy-MM-dd"),sale_price:j,commission_amount:C,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,e]);const x=async w=>{if(w.preventDefault(),!!n)try{const j=await i.mutateAsync({property_address:h.property_address,city:h.city||null,state:h.state||null,zip:h.zip||null,transaction_type:h.transaction_type,close_date:h.close_date,sale_price:h.sale_price,commission_amount:h.commission_amount||null,lead_source_id:h.lead_source_id||null,client_type_id:h.client_type_id||null,contact_id:n.contact_id||null,notes:h.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:j.id,actual_close_date:h.close_date}),ze.success("Deal added to Scorecard! 🎉"),t(!1),s==null||s()}catch(j){console.error("Error syncing to scorecard:",j),ze.error("Failed to add to scorecard")}},y=w=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(w);return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{className:"space-y-3",children:[r.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20",children:r.jsx(Ha,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(qr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(es,{className:"text-center",children:"Review and confirm the details before adding this deal to your Scorecard."})]}),r.jsxs("form",{onSubmit:x,className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(ct,{id:"property_address",value:h.property_address,onChange:w=>p(j=>({...j,property_address:w.target.value})),placeholder:"123 Main St",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"city",children:"City"}),r.jsx(ct,{id:"city",value:h.city,onChange:w=>p(j=>({...j,city:w.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"state",children:"State"}),r.jsx(ct,{id:"state",value:h.state,onChange:w=>p(j=>({...j,state:w.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"zip",children:"Zip"}),r.jsx(ct,{id:"zip",value:h.zip,onChange:w=>p(j=>({...j,zip:w.target.value})),placeholder:"75001"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Transaction Type *"}),r.jsxs(bn,{value:h.transaction_type,onValueChange:w=>p(j=>({...j,transaction_type:w})),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"buyer",children:"Buyer"}),r.jsx(Kt,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(ct,{id:"close_date",type:"date",value:h.close_date,onChange:w=>p(j=>({...j,close_date:w.target.value})),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(ud,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(ct,{id:"sale_price",type:"number",value:h.sale_price||"",onChange:w=>p(j=>({...j,sale_price:Number(w.target.value)})),placeholder:"450000",required:!0,min:0}),h.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ve,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(hS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(ct,{id:"commission_amount",type:"number",value:h.commission_amount||"",onChange:w=>p(j=>({...j,commission_amount:Number(w.target.value)})),placeholder:"13500",min:0}),h.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Lead Source"}),r.jsxs(bn,{value:h.lead_source_id,onValueChange:w=>p(j=>({...j,lead_source_id:w})),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select source"})}),r.jsx(_n,{children:l==null?void 0:l.map(w=>r.jsx(Kt,{value:w.id,children:w.name},w.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Client Type"}),r.jsxs(bn,{value:h.client_type_id,onValueChange:w=>p(j=>({...j,client_type_id:w})),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select type"})}),r.jsx(_n,{children:a==null?void 0:a.map(w=>r.jsx(Kt,{value:w.id,children:w.name},w.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"notes",children:"Notes"}),r.jsx(ms,{id:"notes",value:h.notes,onChange:w=>p(j=>({...j,notes:w.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(ri,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(J,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Skip for now"}),r.jsx(J,{type:"submit",disabled:i.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:i.isPending?"Adding...":r.jsxs(r.Fragment,{children:["Add to Scorecard",r.jsx(Ko,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const DWt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},p5e={urgent:0,high:1,medium:2,low:3};function RWt({deals:e,stages:t,onDealClick:n,onStageChange:s}){const[i,o]=P.useState("target_close_date"),[l,a]=P.useState("asc"),h=j=>{i===j?a(S=>S==="asc"?"desc":"asc"):(o(j),a("asc"))},p=P.useMemo(()=>[...e].sort((j,S)=>{var A,E;let C=0;switch(i){case"deal_name":C=j.deal_name.localeCompare(S.deal_name);break;case"stage":{const T=((A=t.find(z=>z.id===j.stage_id))==null?void 0:A.sort_order)||0,O=((E=t.find(z=>z.id===S.stage_id))==null?void 0:E.sort_order)||0;C=T-O;break}case"expected_price":C=(j.expected_price||0)-(S.expected_price||0);break;case"expected_commission":C=(j.expected_commission||0)-(S.expected_commission||0);break;case"target_close_date":{const T=j.target_close_date?new Date(j.target_close_date).getTime():1/0,O=S.target_close_date?new Date(S.target_close_date).getTime():1/0;C=T-O;break}case"priority":C=p5e[j.priority]-p5e[S.priority];break}return l==="asc"?C:-C}),[e,t,i,l]),x=j=>j?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(j):"—",y=j=>j?t.find(S=>S.id===j):null,w=({field:j,children:S})=>r.jsxs(J,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>h(j),children:[S,i===j?l==="asc"?r.jsx(yg,{className:"ml-2 h-4 w-4"}):r.jsx(n1,{className:"ml-2 h-4 w-4"}):r.jsx(zx,{className:"ml-2 h-4 w-4 opacity-50"})]});return e.length===0?r.jsx("div",{className:"text-center py-16",children:r.jsx("p",{className:"text-muted-foreground",children:"No deals to display"})}):r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{className:"bg-muted/50",children:[r.jsx(Et,{className:"w-[250px]",children:r.jsx(w,{field:"deal_name",children:"Deal Name"})}),r.jsx(Et,{className:"w-[150px]",children:r.jsx(w,{field:"stage",children:"Stage"})}),r.jsx(Et,{className:"w-[100px]",children:"Type"}),r.jsx(Et,{className:"w-[120px]",children:r.jsx(w,{field:"expected_price",children:"Price"})}),r.jsx(Et,{className:"w-[120px]",children:r.jsx(w,{field:"expected_commission",children:"GCI"})}),r.jsx(Et,{className:"w-[130px]",children:r.jsx(w,{field:"target_close_date",children:"Close Date"})}),r.jsx(Et,{className:"w-[100px]",children:r.jsx(w,{field:"priority",children:"Priority"})})]})}),r.jsx(Hs,{children:p.map(j=>{y(j.stage_id);const S=DWt[j.deal_type],C=j.target_close_date?mC(new Date(j.target_close_date),new Date):null,A=C!==null&&C<0,E=C!==null&&C<=7&&C>=0;return r.jsxs(Ir,{className:$t("cursor-pointer hover:bg-muted/50 transition-colors",A&&"bg-red-50/50"),onClick:()=>n(j),children:[r.jsx(vt,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:j.deal_name}),j.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[j.contact.first_name," ",j.contact.last_name]})]})}),r.jsx(vt,{onClick:T=>T.stopPropagation(),children:r.jsx(R$e,{stages:t,currentStageId:j.stage_id||"",onStageSelect:(T,O)=>s(j.id,T,O)})}),r.jsx(vt,{children:r.jsx(Ft,{variant:"outline",className:$t("text-xs",S.color),children:S.label})}),r.jsx(vt,{children:r.jsx("span",{className:"font-medium",children:x(j.expected_price)})}),r.jsx(vt,{children:r.jsx("span",{className:"text-emerald-600",children:x(j.expected_commission)})}),r.jsx(vt,{children:j.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-sm",A&&"text-red-600",E&&!A&&"text-amber-600"),children:[A&&r.jsx(El,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:fn(new Date(j.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(vt,{children:r.jsx(Ft,{variant:"outline",className:$t("text-xs capitalize",j.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",j.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",j.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",j.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:j.priority})})]},j.id)})})]})})}function FWt(){var pe;const e=OI(),{data:t,isLoading:n}=I0e(),{data:s,isLoading:i,refetch:o}=P$e(),{data:l,isLoading:a}=iWt(),h=I$e(),p=QHt(),[x,y]=P.useState("board"),[w,j]=P.useState(!1),[S,C]=P.useState(!1),[A,E]=P.useState(null),[T,O]=P.useState(null),[z,F]=P.useState(null),[q,H]=P.useState(null),[K,Z]=P.useState(!1),[re,ue]=P.useState(null);P.useEffect(()=>{!n&&t&&t.length===0&&h.mutate()},[n,t]);const he=ae=>{E(ae),C(!0)},be=ae=>{O(ae||null),E(null),j(!0)},ne=ae=>{E(ae),C(!1),j(!0)},ye=(ae,ge)=>{F(ae)},ie=(ae,ge)=>{ae.preventDefault(),ae.dataTransfer.dropEffect="move",H(ge)},fe=async(ae,ge)=>{if(ae.preventDefault(),H(null),!z)return;const Me=s==null?void 0:s.find(Ie=>Ie.id===z),Ue=t==null?void 0:t.find(Ie=>Ie.id===ge);if(!Me||!Ue||Me.stage_id===ge){F(null);return}try{if(await p.mutateAsync({dealId:z,stageId:ge,stageName:Ue.name}),ze.success(`Moved to ${Ue.name}`),Ue.is_won_stage&&!Me.scorecard_transaction_id){const Ie={...Me,stage_id:ge};ue(Ie),Z(!0)}}catch{ze.error("Failed to move deal")}F(null)},de=P.useCallback(async(ae,ge,Me)=>{const Ue=s==null?void 0:s.find(Ke=>Ke.id===ae),Ie=t==null?void 0:t.find(Ke=>Ke.id===ge);if(!(!Ue||!Ie||Ue.stage_id===ge))try{if(await p.mutateAsync({dealId:ae,stageId:ge,stageName:Me}),ze.success(`Moved to ${Me}`),Ie.is_won_stage&&!Ue.scorecard_transaction_id){const Ke={...Ue,stage_id:ge};ue(Ke),Z(!0)}}catch{ze.error("Failed to move deal")}},[s,t,p]),_e=ae=>(s==null?void 0:s.filter(ge=>ge.stage_id===ae))||[],Ee=n||i,ke=e?"list":x;return r.jsxs(Or,{children:[r.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)]",children:[r.jsxs("div",{className:"shrink-0 p-4 md:p-6 pb-0 space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Deal Pipeline"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Track and manage your active deals"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(ql,{className:"h-4 w-4"})}),!e&&r.jsx(fI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Ng,{children:[r.jsx(Sg,{asChild:!0,children:r.jsxs(J,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),className:"px-3 gap-1.5",children:[r.jsx(fm,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(ym,{children:"Kanban board view"})]}),r.jsxs(Ng,{children:[r.jsx(Sg,{asChild:!0,children:r.jsxs(J,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[r.jsx(Hf,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(ym,{children:"Grouped list view"})]}),r.jsxs(Ng,{children:[r.jsx(Sg,{asChild:!0,children:r.jsxs(J,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[r.jsx(KT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(ym,{children:"Sortable table view"})]})]})}),r.jsxs(J,{onClick:()=>be(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(MWt,{stats:l||null,isLoading:a})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Ee?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(ae=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Pr,{className:"h-full rounded-xl"})},ae))}):ke==="board"?r.jsxs(Jo,{className:"h-full -mx-4 md:-mx-6 px-4 md:px-6",children:[r.jsx("div",{className:"flex gap-4 h-full pb-4",children:t==null?void 0:t.map(ae=>r.jsx(CWt,{stage:ae,deals:_e(ae.id),onDealClick:he,onAddDeal:be,onDragStart:ye,onDragOver:ie,onDrop:fe,isDragOver:q===ae.id,isWonStage:ae.is_won_stage},ae.id))}),r.jsx(Rge,{orientation:"horizontal"})]}):ke==="table"?r.jsx(Jo,{className:"h-full",children:r.jsx(RWt,{deals:s||[],stages:t||[],onDealClick:he,onStageChange:de})}):r.jsx(Jo,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[t==null?void 0:t.map(ae=>{const ge=_e(ae.id);return ge.length===0?null:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ae.color}}),r.jsx("h3",{className:"font-semibold",children:ae.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",ge.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:ge.map(Me=>r.jsx(F$e,{deal:Me,onClick:()=>he(Me),stages:t,onStageChange:de,showStagePicker:!0,isWonStage:ae.is_won_stage},Me.id))})]},ae.id)}),(s==null?void 0:s.length)===0&&r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-muted rounded-full flex items-center justify-center",children:r.jsx(fm,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Start tracking your opportunities by adding your first deal"}),r.jsxs(J,{onClick:()=>be(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(EWt,{open:w,onOpenChange:j,deal:A,defaultStageId:T}),r.jsx(LWt,{deal:A,open:S,onOpenChange:C,onEdit:ne,isWonStage:A?(pe=t==null?void 0:t.find(ae=>ae.id===A.stage_id))==null?void 0:pe.is_won_stage:!1,onAddToScorecard:ae=>{ue(ae),Z(!0),C(!1)}}),r.jsx(OWt,{open:K,onOpenChange:Z,deal:re,onComplete:()=>{o(),ue(null)}})]})}const zpe=[{value:"video_intro",label:"Video Intro",icon:Fi,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:RT,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:Hx,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:Yh,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:dc,description:"Links to your social profiles"}],zWt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],BWt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function z$e({cardId:e}){const{data:t,isLoading:n}=Mit(e),s=Tit(),i=Ait(),o=Eit(),[l,a]=P.useState(!1),[h,p]=P.useState(""),[x,y]=P.useState(null);if(n)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Pr,{className:"h-16 w-full"}),r.jsx(Pr,{className:"h-16 w-full"})]});const w=()=>{h&&s.mutate({card_id:e,block_type:h,sort_order:(t==null?void 0:t.length)||0,config:BWt[h]||{}},{onSuccess:()=>{a(!1),p("")}})},j=T=>{i.mutate({id:T.id,is_visible:!T.is_visible})},S=(T,O)=>{if(!t)return;const z=t.findIndex(H=>H.id===T.id),F=O==="up"?z-1:z+1;if(F<0||F>=t.length)return;const q=t[F];i.mutate({id:T.id,sort_order:q.sort_order}),i.mutate({id:q.id,sort_order:T.sort_order})},C=T=>{confirm("Remove this block from this card?")&&o.mutate(T.id)},A=(T,O)=>{i.mutate({id:T.id,config:O},{onSuccess:()=>y(null)})},E=T=>zpe.find(O=>O.value===T);return r.jsxs("div",{className:"space-y-3",children:[!t||t.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-muted-foreground mb-4 text-sm",children:"No blocks yet. Add a block to customize this card."}),r.jsxs(J,{size:"sm",onClick:()=>a(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):r.jsxs(r.Fragment,{children:[t.map((T,O)=>{const z=E(T.block_type),F=(z==null?void 0:z.icon)||Hx;return r.jsx(We,{className:T.is_visible?"":"opacity-50",children:r.jsx(Xe,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pj,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx(F,{className:"h-4 w-4 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-xs",children:(z==null?void 0:z.label)||T.block_type}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:$Wt(T)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>S(T,"up"),disabled:O===0,children:r.jsx(yg,{className:"h-3 w-3"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>S(T,"down"),disabled:O===t.length-1,children:r.jsx(n1,{className:"h-3 w-3"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(T),children:T.is_visible?r.jsx(Qo,{className:"h-3 w-3"}):r.jsx(c1,{className:"h-3 w-3"})}),r.jsx(J,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(T),children:"Edit"}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>C(T),children:r.jsx(Zn,{className:"h-3 w-3"})})]})]})})},T.id)}),r.jsxs(J,{variant:"outline",size:"sm",className:"w-full",onClick:()=>a(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:zpe.map(T=>{const O=T.icon;return r.jsxs("button",{onClick:()=>p(T.value),className:`flex items-center gap-3 p-3 rounded-lg border text-left transition-colors ${h===T.value?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[r.jsx(O,{className:"h-5 w-5 text-primary flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:T.description})]})]},T.value)})}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(J,{onClick:w,disabled:!h||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(UWt,{block:x,onSave:T=>A(x,T),onClose:()=>y(null)})]})}function $Wt(e){var n;const t=e.config;switch(e.block_type){case"video_intro":return t.video_url?"Video configured":"No video set";case"testimonials":{const s=((n=t.testimonials)==null?void 0:n.length)||0;return`${s} testimonial${s!==1?"s":""}`}case"specialties":{const s=t.tags||[];return s.length?s.slice(0,3).join(", ")+(s.length>3?"...":""):"No tags"}case"custom_links":{const s=t.links||[];return`${s.length} link${s.length!==1?"s":""}`}case"social_media":{const s=t.platforms||[];return s.length?s.map(i=>i.platform).join(", "):"No platforms"}default:return""}}function UWt({block:e,onSave:t,onClose:n}){const[s,i]=P.useState(e.config),o=zpe.find(l=>l.value===e.block_type);return r.jsx(Br,{open:!0,onOpenChange:n,children:r.jsxs(Fr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Edit ",o==null?void 0:o.label]})}),e.block_type==="video_intro"&&r.jsx(qWt,{config:s,onChange:i,cardId:e.card_id}),e.block_type==="testimonials"&&r.jsx(VWt,{config:s,onChange:i}),e.block_type==="specialties"&&r.jsx(HWt,{config:s,onChange:i}),e.block_type==="custom_links"&&r.jsx(WWt,{config:s,onChange:i}),e.block_type==="social_media"&&r.jsx(GWt,{config:s,onChange:i}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(J,{onClick:()=>t(s),children:"Save"})]})]})})}function qWt({config:e,onChange:t,cardId:n}){var j,S;const[s,i]=P.useState(""),[o,l]=P.useState((j=e.video_url)!=null&&j.includes("youtube")||(S=e.video_url)!=null&&S.includes("youtu.be")?"youtube":"library"),{data:a}=Jt({queryKey:["card-owner",n],queryFn:async()=>{const{data:C}=await ee.from("agent_cards").select("user_id").eq("id",n).single();return C==null?void 0:C.user_id},enabled:!!n}),{data:h,isLoading:p}=Jt({queryKey:["agent-videos-library",a],queryFn:async()=>{const{data:C,error:A}=await ee.from("agent_videos").select("id, title, bunny_video_id, thumbnail_url, playback_url, created_at").eq("owner_user_id",a).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(A)throw A;return C||[]},enabled:!!a}),x=(h==null?void 0:h.filter(C=>!s||(C.title||"").toLowerCase().includes(s.toLowerCase())))||[],y=e.bunny_video_id,w=C=>{var O;const A=(O=C.playback_url)==null?void 0:O.match(/\/(?:play|embed)\/(\d+)\//),T=`https://iframe.mediadelivery.net/embed/${A?A[1]:"570924"}/${C.bunny_video_id}?autoplay=false&responsive=true`;t({...e,video_url:T,bunny_video_id:C.bunny_video_id,video_source:"library"})};return r.jsx("div",{className:"space-y-4",children:r.jsxs(ba,{value:o,onValueChange:l,children:[r.jsxs(fa,{className:"w-full",children:[r.jsx(ln,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(ln,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(An,{value:"library",className:"space-y-3 mt-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search videos...",value:s,onChange:C=>i(C.target.value),className:"pl-9"})]}),r.jsx(Jo,{className:"h-[240px]",children:p?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Pr,{className:"h-14 w-full"}),r.jsx(Pr,{className:"h-14 w-full"})]}):x.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:(h==null?void 0:h.length)===0?"No videos in library yet":"No matching videos"}):r.jsx("div",{className:"space-y-1.5 pr-3",children:x.map(C=>r.jsxs("button",{onClick:()=>w(C),className:`w-full flex items-center gap-3 p-2 rounded-lg border text-left transition-colors ${y===C.bunny_video_id?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[C.thumbnail_url?r.jsx("img",{src:C.thumbnail_url,alt:"",className:"h-10 w-16 rounded object-cover flex-shrink-0 bg-muted",onError:A=>{var E;A.currentTarget.style.display="none",(E=A.currentTarget.nextElementSibling)==null||E.classList.remove("hidden")}}):null,r.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${C.thumbnail_url?"hidden":""}`,children:r.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate flex-1",children:C.title||"Untitled Video"}),y===C.bunny_video_id&&r.jsx(Ca,{className:"h-4 w-4 text-primary flex-shrink-0"})]},C.id))})})]}),r.jsx(An,{value:"youtube",className:"space-y-3 mt-3",children:r.jsxs("div",{children:[r.jsx(Ve,{children:"YouTube URL"}),r.jsx(ct,{placeholder:"https://www.youtube.com/watch?v=...",value:e.video_source==="youtube"&&e.video_url||"",onChange:C=>t({...e,video_url:C.target.value,bunny_video_id:null,video_source:"youtube"})}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Paste a YouTube video link"})]})})]})})}function VWt({config:e,onChange:t}){const n=e.testimonials||[],s=(l,a,h)=>{const p=[...n];p[l]={...p[l],[a]:h},t({...e,testimonials:p})},i=()=>t({...e,testimonials:[...n,{name:"",quote:"",role:""}]}),o=l=>t({...e,testimonials:n.filter((a,h)=>h!==l)});return r.jsxs("div",{className:"space-y-4",children:[n.map((l,a)=>r.jsx(We,{children:r.jsxs(Xe,{className:"p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ve,{className:"text-xs font-medium",children:["Testimonial ",a+1]}),n.length>1&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(a),children:r.jsx(Zn,{className:"h-3 w-3"})})]}),r.jsx(ct,{placeholder:"Client name",value:l.name,onChange:h=>s(a,"name",h.target.value)}),r.jsx(ct,{placeholder:"Role/title (optional)",value:l.role||"",onChange:h=>s(a,"role",h.target.value)}),r.jsx("textarea",{className:"w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Their testimonial quote...",value:l.quote,onChange:h=>s(a,"quote",h.target.value)})]})},a)),r.jsxs(J,{variant:"outline",size:"sm",onClick:i,className:"w-full",children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function HWt({config:e,onChange:t}){const n=e.tags||[],[s,i]=P.useState(""),o=a=>{t({...e,tags:n.includes(a)?n.filter(h=>h!==a):[...n,a]})},l=()=>{s.trim()&&!n.includes(s.trim())&&(t({...e,tags:[...n,s.trim()]}),i(""))};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{className:"text-sm mb-2 block",children:"Preset Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:zWt.map(a=>r.jsx("button",{onClick:()=>o(a),className:`px-3 py-1.5 text-xs rounded-full border transition-colors ${n.includes(a)?"bg-primary text-primary-foreground border-primary":"bg-muted border-border hover:bg-muted/80"}`,children:a},a))})]}),r.jsxs("div",{children:[r.jsx(Ve,{className:"text-sm mb-2 block",children:"Custom Tag"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{placeholder:"Add your own...",value:s,onChange:a=>i(a.target.value),onKeyDown:a=>a.key==="Enter"&&(a.preventDefault(),l())}),r.jsx(J,{variant:"outline",size:"sm",onClick:l,children:"Add"})]})]}),n.length>0&&r.jsxs("div",{children:[r.jsxs(Ve,{className:"text-xs text-muted-foreground mb-1 block",children:["Selected (",n.length,")"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(a=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-primary/10 text-primary rounded-full",children:[a,r.jsx("button",{onClick:()=>o(a),className:"hover:text-destructive",children:"×"})]},a))})]})]})}function WWt({config:e,onChange:t}){const n=e.links||[],s=(l,a,h)=>{const p=[...n];p[l]={...p[l],[a]:h},t({...e,links:p})},i=()=>t({...e,links:[...n,{label:"",url:""}]}),o=l=>t({...e,links:n.filter((a,h)=>h!==l)});return r.jsxs("div",{className:"space-y-3",children:[n.map((l,a)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(ct,{placeholder:"Button label",value:l.label,onChange:h=>s(a,"label",h.target.value)}),r.jsx(ct,{placeholder:"https://...",value:l.url,onChange:h=>s(a,"url",h.target.value)})]}),n.length>1&&r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(a),children:r.jsx(Zn,{className:"h-3 w-3"})})]},a)),r.jsxs(J,{variant:"outline",size:"sm",onClick:i,className:"w-full",children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const m5e=[{value:"instagram",label:"Instagram"},{value:"facebook",label:"Facebook"},{value:"linkedin",label:"LinkedIn"},{value:"twitter",label:"X (Twitter)"},{value:"youtube",label:"YouTube"},{value:"tiktok",label:"TikTok"},{value:"zillow",label:"Zillow"},{value:"realtor",label:"Realtor.com"}];function GWt({config:e,onChange:t}){const n=e.platforms||[],s=h=>{n.find(p=>p.platform===h)||t({...e,platforms:[...n,{platform:h,url:""}]})},i=(h,p)=>{const x=[...n];x[h]={...x[h],url:p},t({...e,platforms:x})},o=h=>{t({...e,platforms:n.filter((p,x)=>x!==h)})},l=m5e.filter(h=>!n.find(p=>p.platform===h.value)),a=h=>{const p=ihe[h],x=m5e.find(y=>y.value===h);return{label:(x==null?void 0:x.label)||h,color:(p==null?void 0:p.color)||"#666",iconPath:p==null?void 0:p.icon}};return r.jsxs("div",{className:"space-y-4",children:[n.length>0&&r.jsx("div",{className:"space-y-3",children:n.map((h,p)=>{const x=a(h.platform);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-9 w-9 rounded-lg flex items-center justify-center flex-shrink-0 border",style:{borderColor:x.color+"30",backgroundColor:x.color+"10"},children:x.iconPath&&r.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:x.color,children:r.jsx("path",{d:x.iconPath})})}),r.jsx("div",{className:"flex-1",children:r.jsx(ct,{placeholder:`Your ${x.label} profile URL`,value:h.url,onChange:y=>i(p,y.target.value)})}),r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(p),children:r.jsx(Zn,{className:"h-3.5 w-3.5"})})]},p)})}),l.length>0&&r.jsxs("div",{children:[r.jsx(Ve,{className:"text-xs text-muted-foreground mb-2 block",children:"Add a platform"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(h=>{const p=ihe[h.value];return r.jsxs("button",{onClick:()=>s(h.value),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-full border border-border bg-muted hover:bg-muted/80 transition-colors",children:[(p==null?void 0:p.icon)&&r.jsx("svg",{viewBox:"0 0 24 24",width:12,height:12,fill:p.color,children:r.jsx("path",{d:p.icon})}),h.label]},h.value)})})]}),n.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Tap a platform above to add your social media profile."})]})}var KWt=Object.defineProperty,cne=Object.getOwnPropertySymbols,B$e=Object.prototype.hasOwnProperty,$$e=Object.prototype.propertyIsEnumerable,g5e=(e,t,n)=>t in e?KWt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bpe=(e,t)=>{for(var n in t||(t={}))B$e.call(t,n)&&g5e(e,n,t[n]);if(cne)for(var n of cne(t))$$e.call(t,n)&&g5e(e,n,t[n]);return e},$pe=(e,t)=>{var n={};for(var s in e)B$e.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&cne)for(var s of cne(e))t.indexOf(s)<0&&$$e.call(e,s)&&(n[s]=e[s]);return n};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var Qj;(e=>{const t=class Na{constructor(h,p,x,y){if(this.version=h,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],hNa.MAX_VERSION)throw new RangeError("Version value out of range");if(y<-1||y>7)throw new RangeError("Mask value out of range");this.size=h*4+17;let w=[];for(let S=0;S7)throw new RangeError("Invalid value");let S,C;for(S=x;;S++){const O=Na.getNumDataCodewords(S,p)*8,z=l.getTotalBits(h,S);if(z<=O){C=z;break}if(S>=y)throw new RangeError("Data too long")}for(const O of[Na.Ecc.MEDIUM,Na.Ecc.QUARTILE,Na.Ecc.HIGH])j&&C<=Na.getNumDataCodewords(S,O)*8&&(p=O);let A=[];for(const O of h){n(O.mode.modeBits,4,A),n(O.numChars,O.mode.numCharCountBits(S),A);for(const z of O.getData())A.push(z)}i(A.length==C);const E=Na.getNumDataCodewords(S,p)*8;i(A.length<=E),n(0,Math.min(4,E-A.length),A),n(0,(8-A.length%8)%8,A),i(A.length%8==0);for(let O=236;A.lengthT[z>>>3]|=O<<7-(z&7)),new Na(S,p,T,w)}getModule(h,p){return 0<=h&&h>>9)*1335;const y=(p<<10|x)^21522;i(y>>>15==0);for(let w=0;w<=5;w++)this.setFunctionModule(8,w,s(y,w));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(let w=9;w<15;w++)this.setFunctionModule(14-w,8,s(y,w));for(let w=0;w<8;w++)this.setFunctionModule(this.size-1-w,8,s(y,w));for(let w=8;w<15;w++)this.setFunctionModule(8,this.size-15+w,s(y,w));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let h=this.version;for(let x=0;x<12;x++)h=h<<1^(h>>>11)*7973;const p=this.version<<12|h;i(p>>>18==0);for(let x=0;x<18;x++){const y=s(p,x),w=this.size-11+x%3,j=Math.floor(x/3);this.setFunctionModule(w,j,y),this.setFunctionModule(j,w,y)}}drawFinderPattern(h,p){for(let x=-4;x<=4;x++)for(let y=-4;y<=4;y++){const w=Math.max(Math.abs(y),Math.abs(x)),j=h+y,S=p+x;0<=j&&j{(O!=C-w||F>=S)&&T.push(z[O])});return i(T.length==j),T}drawCodewords(h){if(h.length!=Math.floor(Na.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(let y=0;y>>3],7-(p&7)),p++)}}i(p==h.length*8)}applyMask(h){if(h<0||h>7)throw new RangeError("Mask value out of range");for(let p=0;p5&&h++):(this.finderPenaltyAddHistory(S,C),j||(h+=this.finderPenaltyCountPatterns(C)*Na.PENALTY_N3),j=this.modules[w][A],S=1);h+=this.finderPenaltyTerminateAndCount(j,S,C)*Na.PENALTY_N3}for(let w=0;w5&&h++):(this.finderPenaltyAddHistory(S,C),j||(h+=this.finderPenaltyCountPatterns(C)*Na.PENALTY_N3),j=this.modules[A][w],S=1);h+=this.finderPenaltyTerminateAndCount(j,S,C)*Na.PENALTY_N3}for(let w=0;wj+(S?1:0),p);const x=this.size*this.size,y=Math.ceil(Math.abs(p*20-x*10)/x)-1;return i(0<=y&&y<=9),h+=y*Na.PENALTY_N4,i(0<=h&&h<=2568888),h}getAlignmentPatternPositions(){if(this.version==1)return[];{const h=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(h*2-2))*2;let x=[6];for(let y=this.size-7;x.lengthNa.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*h+128)*h+64;if(h>=2){const x=Math.floor(h/7)+2;p-=(25*x-10)*x-55,h>=7&&(p-=36)}return i(208<=p&&p<=29648),p}static getNumDataCodewords(h,p){return Math.floor(Na.getNumRawDataModules(h)/8)-Na.ECC_CODEWORDS_PER_BLOCK[p.ordinal][h]*Na.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][h]}static reedSolomonComputeDivisor(h){if(h<1||h>255)throw new RangeError("Degree out of range");let p=[];for(let y=0;y0);for(const y of h){const w=y^x.shift();x.push(0),p.forEach((j,S)=>x[S]^=Na.reedSolomonMultiply(j,w))}return x}static reedSolomonMultiply(h,p){if(h>>>8||p>>>8)throw new RangeError("Byte out of range");let x=0;for(let y=7;y>=0;y--)x=x<<1^(x>>>7)*285,x^=(p>>>y&1)*h;return i(x>>>8==0),x}finderPenaltyCountPatterns(h){const p=h[1];i(p<=this.size*3);const x=p>0&&h[2]==p&&h[3]==p*3&&h[4]==p&&h[5]==p;return(x&&h[0]>=p*4&&h[6]>=p?1:0)+(x&&h[6]>=p*4&&h[0]>=p?1:0)}finderPenaltyTerminateAndCount(h,p,x){return h&&(this.finderPenaltyAddHistory(p,x),p=0),p+=this.size,this.finderPenaltyAddHistory(p,x),this.finderPenaltyCountPatterns(x)}finderPenaltyAddHistory(h,p){p[0]==0&&(h+=this.size),p.pop(),p.unshift(h)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(a,h,p){if(h<0||h>31||a>>>h)throw new RangeError("Value out of range");for(let x=h-1;x>=0;x--)p.push(a>>>x&1)}function s(a,h){return(a>>>h&1)!=0}function i(a){if(!a)throw new Error("Assertion error")}const o=class Bl{constructor(h,p,x){if(this.mode=h,this.numChars=p,this.bitData=x,p<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}static makeBytes(h){let p=[];for(const x of h)n(x,8,p);return new Bl(Bl.Mode.BYTE,h.length,p)}static makeNumeric(h){if(!Bl.isNumeric(h))throw new RangeError("String contains non-numeric characters");let p=[];for(let x=0;x=1<{(t=>{const n=class{constructor(i,o){this.ordinal=i,this.formatBits=o}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Qj||(Qj={}));(e=>{(t=>{const n=class{constructor(i,o){this.modeBits=i,this.numBitsCharCount=o}numCharCountBits(i){return this.numBitsCharCount[Math.floor((i+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Qj||(Qj={}));var $4=Qj;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var ZWt={L:$4.QrCode.Ecc.LOW,M:$4.QrCode.Ecc.MEDIUM,Q:$4.QrCode.Ecc.QUARTILE,H:$4.QrCode.Ecc.HIGH},U$e=128,q$e="L",V$e="#FFFFFF",H$e="#000000",W$e=!1,G$e=1,YWt=4,XWt=0,QWt=.1;function K$e(e,t=0){const n=[];return e.forEach(function(s,i){let o=null;s.forEach(function(l,a){if(!l&&o!==null){n.push(`M${o+t} ${i+t}h${a-o}v1H${o+t}z`),o=null;return}if(a===s.length-1){if(!l)return;o===null?n.push(`M${a+t},${i+t} h1v1H${a+t}z`):n.push(`M${o+t},${i+t} h${a+1-o}v1H${o+t}z`);return}l&&o===null&&(o=a)})}),n.join("")}function Z$e(e,t){return e.slice().map((n,s)=>s=t.y+t.h?n:n.map((i,o)=>o=t.x+t.w?i:!1))}function JWt(e,t,n,s){if(s==null)return null;const i=e.length+n*2,o=Math.floor(t*QWt),l=i/t,a=(s.width||o)*l,h=(s.height||o)*l,p=s.x==null?e.length/2-a/2:s.x*l,x=s.y==null?e.length/2-h/2:s.y*l,y=s.opacity==null?1:s.opacity;let w=null;if(s.excavate){let S=Math.floor(p),C=Math.floor(x),A=Math.ceil(a+p-S),E=Math.ceil(h+x-C);w={x:S,y:C,w:A,h:E}}const j=s.crossOrigin;return{x:p,y:x,h,w:a,excavation:w,opacity:y,crossOrigin:j}}function eGt(e,t){return t!=null?Math.max(Math.floor(t),0):e?YWt:XWt}function Y$e({value:e,level:t,minVersion:n,includeMargin:s,marginSize:i,imageSettings:o,size:l,boostLevel:a}){let h=rt.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((C,A)=>(C.push(...$4.QrSegment.makeSegments(A)),C),[]);return $4.QrCode.encodeSegments(S,ZWt[t],n,void 0,void 0,a)},[e,t,n,a]);const{cells:p,margin:x,numCells:y,calculatedImageSettings:w}=rt.useMemo(()=>{let j=h.getModules();const S=eGt(s,i),C=j.length+S*2,A=JWt(j,l,S,o);return{cells:j,margin:S,numCells:C,calculatedImageSettings:A}},[h,l,o,s,i]);return{qrcode:h,margin:x,cells:p,numCells:y,calculatedImageSettings:w}}var tGt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),rGt=rt.forwardRef(function(t,n){const s=t,{value:i,size:o=U$e,level:l=q$e,bgColor:a=V$e,fgColor:h=H$e,includeMargin:p=W$e,minVersion:x=G$e,boostLevel:y,marginSize:w,imageSettings:j}=s,C=$pe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:A}=C,E=$pe(C,["style"]),T=j==null?void 0:j.src,O=rt.useRef(null),z=rt.useRef(null),F=rt.useCallback(ne=>{O.current=ne,typeof n=="function"?n(ne):n&&(n.current=ne)},[n]),[q,H]=rt.useState(!1),{margin:K,cells:Z,numCells:re,calculatedImageSettings:ue}=Y$e({value:i,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:w,imageSettings:j,size:o});rt.useEffect(()=>{if(O.current!=null){const ne=O.current,ye=ne.getContext("2d");if(!ye)return;let ie=Z;const fe=z.current,de=ue!=null&&fe!==null&&fe.complete&&fe.naturalHeight!==0&&fe.naturalWidth!==0;de&&ue.excavation!=null&&(ie=Z$e(Z,ue.excavation));const _e=window.devicePixelRatio||1;ne.height=ne.width=o*_e;const Ee=o/re*_e;ye.scale(Ee,Ee),ye.fillStyle=a,ye.fillRect(0,0,re,re),ye.fillStyle=h,tGt?ye.fill(new Path2D(K$e(ie,K))):Z.forEach(function(ke,pe){ke.forEach(function(ae,ge){ae&&ye.fillRect(ge+K,pe+K,1,1)})}),ue&&(ye.globalAlpha=ue.opacity),de&&ye.drawImage(fe,ue.x+K,ue.y+K,ue.w,ue.h)}}),rt.useEffect(()=>{H(!1)},[T]);const he=Bpe({height:o,width:o},A);let be=null;return T!=null&&(be=rt.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{H(!0)},ref:z,crossOrigin:ue==null?void 0:ue.crossOrigin})),rt.createElement(rt.Fragment,null,rt.createElement("canvas",Bpe({style:he,height:o,width:o,ref:F,role:"img"},E)),be)});rGt.displayName="QRCodeCanvas";var X$e=rt.forwardRef(function(t,n){const s=t,{value:i,size:o=U$e,level:l=q$e,bgColor:a=V$e,fgColor:h=H$e,includeMargin:p=W$e,minVersion:x=G$e,boostLevel:y,title:w,marginSize:j,imageSettings:S}=s,C=$pe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:A,cells:E,numCells:T,calculatedImageSettings:O}=Y$e({value:i,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:j,imageSettings:S,size:o});let z=E,F=null;S!=null&&O!=null&&(O.excavation!=null&&(z=Z$e(E,O.excavation)),F=rt.createElement("image",{href:S.src,height:O.h,width:O.w,x:O.x+A,y:O.y+A,preserveAspectRatio:"none",opacity:O.opacity,crossOrigin:O.crossOrigin}));const q=K$e(z,A);return rt.createElement("svg",Bpe({height:o,width:o,viewBox:`0 0 ${T} ${T}`,ref:n,role:"img"},C),!!w&&rt.createElement("title",null,w),rt.createElement("path",{fill:a,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),rt.createElement("path",{fill:h,d:q,shapeRendering:"crispEdges"}),F)});X$e.displayName="QRCodeSVG";function nGt({slug:e,agentName:t}){const n=P.useRef(null),s=`https://cards.relevelup.com/${e}`,i=P.useCallback(()=>{var y;const o=(y=n.current)==null?void 0:y.querySelector("svg");if(!o)return;const l=document.createElement("canvas"),a=1024;l.width=a,l.height=a;const h=l.getContext("2d");if(!h)return;const p=new XMLSerializer().serializeToString(o),x=new Image;x.onload=()=>{h.fillStyle="#ffffff",h.fillRect(0,0,a,a),h.drawImage(x,0,0,a,a);const w=document.createElement("a");w.download=`${e}-qr-code.png`,w.href=l.toDataURL("image/png"),w.click(),ze.success("QR code downloaded!")},x.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(p)))},[e]);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"QR Code"}),r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{ref:n,className:"bg-white p-3 rounded-lg border shadow-sm shrink-0",children:r.jsx(X$e,{value:s,size:120,level:"H",bgColor:"#ffffff",fgColor:"#000000"})}),r.jsxs("div",{className:"space-y-2 min-w-0",children:[r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Download this QR code to use on business cards, flyers, signs, or any print materials. Scanning it opens your digital card instantly."}),r.jsxs(J,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[r.jsx(Xa,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function sGt(){const{user:e}=zr(),{data:t,isLoading:n}=dit(e==null?void 0:e.id);return n?r.jsx(Or,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Pr,{className:"h-8 w-48"}),r.jsx(Pr,{className:"h-32 w-full"}),r.jsx(Pr,{className:"h-32 w-full"})]})}):t?r.jsx(Or,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-6 animate-fade-in",children:[r.jsx(aGt,{card:t}),r.jsx(lGt,{card:t})]})}):r.jsx(Or,{children:r.jsx(iGt,{userId:e==null?void 0:e.id})})}function iGt({userId:e}){var h;const[t,n]=P.useState(""),s=p6e(),{data:i}=Jt({queryKey:["my-profile-for-card",e],queryFn:async()=>{if(!e)return null;const{data:p}=await ee.from("profiles").select("name").eq("id",e).single();return p},enabled:!!e}),o=((h=i==null?void 0:i.name)==null?void 0:h.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||"",l=()=>{if(!e)return;const p=(t.trim()||o).toLowerCase().replace(/[^a-z0-9-]/g,"-");if(!p){ze.error("Please enter a URL slug for your card");return}s.mutate({user_id:e,slug:p,is_published:!0},{onSuccess:()=>ze.success("Your digital card has been created!")})},a=[{icon:Ux,title:"Shareable Link",desc:"One link that works everywhere"},{icon:jg,title:"Lead Capture",desc:"Collect leads automatically"},{icon:Gf,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:Ld,title:"Fully Customizable",desc:"Themes, colors, and content blocks"}];return r.jsxs("div",{className:"max-w-2xl mx-auto p-4 animate-fade-in",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary/90 via-primary to-primary/80 p-8 md:p-12 mb-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_30%_20%,rgba(255,255,255,0.15),transparent_50%)]"}),r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_80%_80%,rgba(0,0,0,0.1),transparent_50%)]"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm text-sm font-medium mb-4",children:[r.jsx(Ss,{className:"h-3.5 w-3.5"}),"New Feature"]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3 tracking-tight",children:"Your Digital Business Card"}),r.jsx("p",{className:"text-primary-foreground/80 text-lg max-w-md leading-relaxed",children:"Ditch the paper. Share a beautiful, interactive card that captures leads and makes a lasting impression."})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:a.map(p=>r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border bg-card hover:shadow-md transition-shadow",children:[r.jsx("div",{className:"mt-0.5 p-2 rounded-lg bg-primary/10 shrink-0",children:r.jsx(p.icon,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:p.title}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p.desc})]})]},p.title))}),r.jsxs(We,{className:"shadow-lg border-2",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx(Xt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(En,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(Xe,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Your Card URL"}),r.jsxs("div",{className:"flex items-center gap-0 mt-1.5",children:[r.jsx("span",{className:"inline-flex items-center px-3 h-10 rounded-l-md border border-r-0 bg-muted text-sm text-muted-foreground whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(ct,{value:t||o,onChange:p=>n(p.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),r.jsxs(J,{onClick:l,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function aGt({card:e}){const n=`https://cards.relevelup.com/${e.slug}`,s=()=>{navigator.clipboard.writeText(n),ze.success("Card link copied!")};return r.jsx("div",{className:"rounded-xl border bg-card p-5",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:"My Digital Card"}),r.jsx(Ft,{variant:e.is_published?"default":"secondary",className:"text-[10px] uppercase tracking-wider",children:e.is_published?"Live":"Draft"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Ux,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",e.slug]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[r.jsx(jl,{className:"h-3.5 w-3.5"})," Copy Link"]}),r.jsx(J,{size:"sm",asChild:!0,className:"gap-1.5",children:r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function oGt({userId:e}){const t=Wr(),n=P.useRef(null),{data:s,isLoading:i}=Jt({queryKey:["card-editor-profile",e],queryFn:async()=>{const{data:q}=await ee.from("profiles").select("name, email, phone, avatar_url").eq("id",e).single();let H=(q==null?void 0:q.avatar_url)||null;if(!H){const{data:K}=await ee.storage.from("avatars").list(`${e}`);if(K&&K.length>0){const{data:Z}=ee.storage.from("avatars").getPublicUrl(`${e}/${K[0].name}`);H=`${Z.publicUrl}?t=${Date.now()}`,await ee.from("profiles").update({avatar_url:H}).eq("id",e)}}return{...q,avatar_url:H}}}),[o,l]=P.useState(null),[a,h]=P.useState(null),[p,x]=P.useState(null),[y,w]=P.useState(!1),j=o??(s==null?void 0:s.name)??"",S=a??(s==null?void 0:s.phone)??"",C=p??(s==null?void 0:s.email)??"",A=s==null?void 0:s.avatar_url,E=((s==null?void 0:s.name)||"A").split(" ").map(q=>q[0]).join("").toUpperCase().slice(0,2),T=!(s!=null&&s.avatar_url)||!(s!=null&&s.phone),O=cr({mutationFn:async q=>{const{error:H}=await ee.from("profiles").update(q).eq("id",e);if(H)throw H},onSuccess:()=>{t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Profile updated!")},onError:()=>ze.error("Failed to update profile")}),z=()=>{const q={};if(o!==null&&o!==(s==null?void 0:s.name)&&(q.name=o),a!==null&&a!==(s==null?void 0:s.phone)&&(q.phone=a||null),p!==null&&p!==(s==null?void 0:s.email)&&(q.email=p),Object.keys(q).length===0){ze.info("No changes to save");return}O.mutate(q)},F=async q=>{var K;const H=(K=q.target.files)==null?void 0:K[0];if(H){if(!H.type.startsWith("image/")){ze.error("Please select an image file");return}w(!0);try{const Z=H.name.split(".").pop(),re=`${e}/avatar.${Z}`,{error:ue}=await ee.storage.from("avatars").upload(re,H,{upsert:!0});if(ue)throw ue;const{data:he}=ee.storage.from("avatars").getPublicUrl(re),be=he.publicUrl+"?t="+Date.now();await ee.from("profiles").update({avatar_url:be}).eq("id",e),t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Photo updated!")}catch{ze.error("Failed to upload photo")}finally{w(!1)}}};return i?r.jsx(Pr,{className:"h-32 w-full rounded-xl"}):r.jsx(We,{className:T?"border-amber-300 dark:border-amber-700":"",children:r.jsxs(Xe,{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Ve,{className:"text-sm font-semibold",children:"Profile Info"}),T&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[r.jsx(El,{className:"h-3 w-3"}),"Missing info — complete below so your card looks great"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-3",children:"This info shows on your digital card and updates your profile everywhere."}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"relative group cursor-pointer",onClick:()=>{var q;return(q=n.current)==null?void 0:q.click()},children:[r.jsxs(ci,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(Wa,{src:A||void 0,alt:j}),r.jsx(di,{className:"text-lg font-semibold bg-primary/10 text-primary",children:E})]}),r.jsx("div",{className:"absolute inset-0 bg-black/40 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(s1,{className:"h-5 w-5 text-white"})}),r.jsx("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:F})]}),r.jsxs("div",{className:"flex-1 space-y-0.5",children:[r.jsx("p",{className:"text-sm font-medium",children:y?"Uploading...":A?"Tap to change photo":"Add a profile photo"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This photo appears on your card, profile, and community posts"})]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),r.jsx(ct,{value:j,onChange:q=>l(q.target.value),placeholder:"Your full name",className:"h-10"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),r.jsx(ct,{value:S,onChange:q=>h(q.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),r.jsx(ct,{value:C,onChange:q=>x(q.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(J,{variant:"outline",size:"sm",onClick:z,disabled:O.isPending,className:"w-full",children:O.isPending?"Saving...":"Update Profile Info"})]})})}function lGt({card:e}){var w;const t=m6e(),n=Wr(),{data:s}=g6e(e.id),[i,o]=P.useState(e.slug),[l,a]=P.useState(!1),[h,p]=P.useState({is_published:e.is_published,theme:e.theme,title:e.title||"",positioning_statement:e.positioning_statement||"",bio:e.bio||"",review_snippet:e.review_snippet||"",review_source_url:e.review_source_url||"",booking_url:e.booking_url||"",custom_cta_label:e.custom_cta_label||"",show_photo:e.show_photo,show_bio:e.show_bio,show_credentials:e.show_credentials,show_social_links:e.show_social_links,show_save_contact:e.show_save_contact,show_leave_review:e.show_leave_review,show_refer_friend:e.show_refer_friend}),x=async()=>{const j=i.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!j){ze.error("Please enter a valid URL");return}if(j===e.slug){ze.info("No changes to save");return}a(!0);try{const{data:S}=await ee.from("agent_cards").select("id").eq("slug",j).neq("id",e.id).maybeSingle();if(S){ze.error("This URL is already taken. Try another one.");return}const{error:C}=await ee.from("agent_cards").update({slug:j}).eq("id",e.id);if(C)throw C;o(j),n.invalidateQueries({queryKey:["agent-card"]}),ze.success("Card address updated!")}catch{ze.error("Failed to update card address")}finally{a(!1)}},y=()=>{t.mutate({id:e.id,...h,title:h.title||null,positioning_statement:h.positioning_statement||null,bio:h.bio||null,review_snippet:h.review_snippet||null,review_source_url:h.review_source_url||null,booking_url:h.booking_url||null,custom_cta_label:h.custom_cta_label||null},{onSuccess:()=>ze.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ba,{defaultValue:"content",children:[r.jsxs(fa,{className:"w-full h-11 p-1",children:[r.jsxs(ln,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(hm,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(ln,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Qo,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(ln,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(jg,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(ln,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx($T,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(ln,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(gj,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),r.jsxs(An,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(oGt,{userId:e.user_id}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx(Ve,{className:"text-sm font-semibold",children:"Card Status"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Toggle your card on or off"})]}),r.jsx($s,{checked:h.is_published,onCheckedChange:j=>p(S=>({...S,is_published:j}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Card Address"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex flex-1",children:[r.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 bg-muted text-muted-foreground text-xs whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(ct,{value:i,onChange:j=>o(j.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"your-name",className:"rounded-l-none h-10"})]}),r.jsx(J,{variant:"outline",size:"sm",onClick:x,disabled:l||i===e.slug,className:"shrink-0",children:l?"Saving...":"Update"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is your unique card URL. Only letters, numbers, and dashes allowed."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Theme"}),r.jsxs(bn,{value:h.theme,onValueChange:j=>p(S=>({...S,theme:j})),children:[r.jsx(vn,{className:"h-11",children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"standard",children:"✨ Standard — Modern & Clean"}),r.jsx(Kt,{value:"luxury",children:"🌙 Luxury — Dark & Gold"}),r.jsx(Kt,{value:"bold",children:"🔥 Bold — Vibrant & Punchy"}),r.jsx(Kt,{value:"classic",children:"📋 Classic — Professional"})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(ct,{value:h.title,onChange:j=>p(S=>({...S,title:j.target.value})),placeholder:"e.g. Luxury Real Estate Specialist",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown below your name on the card"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Positioning Statement"}),r.jsx(ct,{value:h.positioning_statement,onChange:j=>p(S=>({...S,positioning_statement:j.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Bio"}),r.jsx(ms,{value:h.bio,onChange:j=>p(S=>({...S,bio:j.target.value})),placeholder:"A short intro about you and what makes you different...",rows:3})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Review Snippet"}),r.jsx(ct,{value:h.review_snippet,onChange:j=>p(S=>({...S,review_snippet:j.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Review Source URL"}),r.jsx(ct,{value:h.review_source_url,onChange:j=>p(S=>({...S,review_source_url:j.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Booking URL"}),r.jsx(ct,{value:h.booking_url,onChange:j=>p(S=>({...S,booking_url:j.target.value})),placeholder:"https://calendly.com/your-link",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to show a built-in lead form instead"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:"Custom CTA Label"}),r.jsx(ct,{value:h.custom_cta_label,onChange:j=>p(S=>({...S,custom_cta_label:j.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(An,{value:"sections",className:"mt-4",children:r.jsx(We,{children:r.jsx(Xe,{className:"p-5 divide-y",children:[{key:"show_photo",label:"Photo",desc:"Uses the photo from your Profile Info above"},{key:"show_bio",label:"Bio Section",desc:"Display your bio on the card"},{key:"show_credentials",label:"Credentials",desc:"Show star rating and reviews"},{key:"show_social_links",label:"Social Links",desc:"Display your social media links"},{key:"show_save_contact",label:"Save Contact",desc:"Let visitors save you as a contact"},{key:"show_leave_review",label:"Leave Review",desc:"Link to your review page"},{key:"show_refer_friend",label:"Refer a Friend",desc:"Enable referral submissions"}].map(({key:j,label:S,desc:C})=>r.jsxs("div",{className:"flex items-center justify-between py-4 first:pt-0 last:pb-0",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Ve,{className:"text-sm font-medium",children:S}),r.jsx("p",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx($s,{checked:h[j],onCheckedChange:A=>p(E=>({...E,[j]:A}))})]},j))})})}),r.jsx(An,{value:"blocks",className:"mt-4",children:r.jsx(z$e,{cardId:e.id})}),r.jsx(An,{value:"analytics",className:"mt-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Views",value:(s==null?void 0:s.views)??0,icon:Qo,color:"text-blue-600 bg-blue-100 dark:text-blue-400 dark:bg-blue-900/30"},{label:"Clicks",value:(s==null?void 0:s.clicks)??0,icon:gj,color:"text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900/30"},{label:"Leads",value:((w=s==null?void 0:s.leads)==null?void 0:w.length)??0,icon:Qh,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(j=>r.jsx(We,{className:"overflow-hidden",children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:`p-1.5 rounded-md ${j.color}`,children:r.jsx(j.icon,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:j.label})]}),r.jsx("div",{className:"text-2xl font-bold",children:j.value})]})},j.label))}),s&&s.leads.length>0&&r.jsxs(We,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsx(Xt,{className:"text-base",children:"Recent Leads"})}),r.jsx(Xe,{className:"pt-0 space-y-2",children:s.leads.slice(0,5).map(j=>r.jsxs("div",{className:"flex items-center justify-between text-sm p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:j.name}),j.phone&&r.jsx("span",{className:"text-muted-foreground ml-2",children:j.phone})]}),j.intent&&r.jsx(Ft,{variant:"secondary",className:"text-xs",children:j.intent})]},j.id))})]}),(!s||s.leads.length===0)&&r.jsx(We,{children:r.jsxs(Xe,{className:"p-8 text-center",children:[r.jsx(gj,{className:"h-10 w-10 text-muted-foreground/40 mx-auto mb-3"}),r.jsx("p",{className:"font-medium text-muted-foreground",children:"No analytics data yet"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Share your card link to start tracking"})]})})]})}),r.jsx(An,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(We,{children:r.jsx(Xe,{className:"p-6",children:r.jsx(nGt,{slug:e.slug})})})})]}),r.jsx(J,{onClick:y,disabled:t.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:t.isPending?"Saving...":"Save Changes"})]})}const Q$e=new Date().getFullYear(),cGt=Array.from({length:5},(e,t)=>Q$e-t);function dGt(){const[e,t]=P.useState(Q$e),n=ns(),{data:s,isLoading:i}=vpt();return i?r.jsx(Or,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Pr,{className:"h-24"},o))}),r.jsx(Pr,{className:"h-96"})]})}):r.jsx(Or,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Scorecard Admin"}),r.jsx("p",{className:"text-muted-foreground",children:"View agent performance and scorecards"})]}),r.jsxs(bn,{value:String(e),onValueChange:o=>t(Number(o)),children:[r.jsx(vn,{className:"w-[120px]",children:r.jsx(wn,{})}),r.jsx(_n,{children:cGt.map(o=>r.jsx(Kt,{value:String(o),children:o},o))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Kn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Agents Tracking"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ac,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with transactions"})]})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Agents with Scorecards"}),r.jsx(En,{children:"Click to view individual agent scorecards"})]}),r.jsx(Xe,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ac,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Agent"}),r.jsx(Et,{children:"Email"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:s.map(o=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:o.name}),r.jsx(vt,{className:"text-muted-foreground",children:o.email}),r.jsx(vt,{className:"text-right",children:r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const J$e=new Date().getFullYear(),uGt=Array.from({length:10},(e,t)=>J$e-t);function hGt(){var w;const{userId:e}=Wc(),t=ns(),[n,s]=P.useState(J$e),{data:i,isLoading:o}=Jt({queryKey:["agent-profile",e],queryFn:async()=>{const{data:j,error:S}=await ee.from("profiles").select("id, name, email").eq("id",e).single();if(S)throw S;return j},enabled:!!e}),{data:l,isLoading:a}=jxe(n,e),{yearStats:h,lifetimeStats:p,showCommission:x}=LOe(n,e),{data:y}=POe(n,e);return o?r.jsx(Or,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(j=>r.jsx(Pr,{className:"h-24"},j))})]})}):r.jsx(Or,{title:`${i==null?void 0:i.name}'s Scorecard`,children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>t("/admin/scorecard"),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:i==null?void 0:i.name}),r.jsx("p",{className:"text-muted-foreground",children:i==null?void 0:i.email})]})]}),r.jsxs(bn,{value:String(n),onValueChange:j=>s(Number(j)),children:[r.jsx(vn,{className:"w-[120px]",children:r.jsx(wn,{})}),r.jsx(_n,{children:uGt.map(j=>r.jsx(Kt,{value:String(j),children:j},j))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:h.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.totalTransactions," lifetime"]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Kn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[h.buyerCount,"/",h.sellerCount]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ud,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Td(h.totalVolume,!0)})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Kf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Td(h.averagePrice,!0)})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Pl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((w=h.topLeadSource)==null?void 0:w.name)||"-"})]})})]}),y&&r.jsx(zze,{goals:y,stats:h,year:n,showCommission:x}),r.jsxs(ba,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"transactions",children:"Transactions"}),r.jsx(ln,{value:"charts",children:"Charts"})]}),r.jsx(An,{value:"transactions",children:r.jsx(Fze,{transactions:l||[],showCommission:x,isLoading:a})}),r.jsx(An,{value:"charts",children:r.jsx(T$e,{stats:h,year:n})})]})]})})}function fGt(){const e=Wr(),[t,n]=P.useState(""),[s,i]=P.useState("all");L6e();const{data:o,refetch:l}=Jt({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:T}=await ee.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(T==null?void 0:T.enabled)??!1}}),{data:a,isLoading:h}=Jt({queryKey:["admin-listings"],queryFn:async()=>{const{data:T,error:O}=await ee.from("listings").select(` *, agent:profiles!listings_agent_id_fkey(id, name, email), photos:listing_photos(id, photo_url, is_primary) `).order("created_at",{ascending:!1});if(O)throw O;return T}}),{data:p}=Jt({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:T}=await ee.from("listings").select("id, is_approved, status"),{data:O}=await ee.from("listing_shares").select("id"),{data:z}=await ee.from("listing_views").select("id");return{total:(T==null?void 0:T.length)||0,pending:(T==null?void 0:T.filter(F=>!F.is_approved).length)||0,active:(T==null?void 0:T.filter(F=>F.status==="active").length)||0,totalShares:(O==null?void 0:O.length)||0,totalViews:(z==null?void 0:z.length)||0}}}),x=cr({mutationFn:async({id:T,approved:O})=>{const{error:z}=await ee.from("listings").update({is_approved:O}).eq("id",T);if(z)throw z},onSuccess:(T,{approved:O})=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success(O?"Listing approved":"Listing unapproved")}}),y=cr({mutationFn:async({id:T,featured:O})=>{const{error:z}=await ee.from("listings").update({is_featured:O}).eq("id",T);if(z)throw z},onSuccess:(T,{featured:O})=>{e.invalidateQueries({queryKey:["admin-listings"]}),ze.success(O?"Listing featured":"Listing unfeatured")}}),w=cr({mutationFn:async T=>{const{error:O}=await ee.from("listings").delete().eq("id",T);if(O)throw O},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success("Listing deleted")}}),j=cr({mutationFn:async T=>{const{error:O}=await ee.from("feature_flags").update({enabled:T}).eq("key","listing_exchange_enabled");if(O)throw O},onSuccess:()=>{l(),ze.success("Feature flag updated")}}),S=o??!1,C=a==null?void 0:a.filter(T=>{var F,q,H,K;const O=((F=T.city)==null?void 0:F.toLowerCase().includes(t.toLowerCase()))||((H=(q=T.agent)==null?void 0:q.name)==null?void 0:H.toLowerCase().includes(t.toLowerCase()))||((K=T.property_address)==null?void 0:K.toLowerCase().includes(t.toLowerCase())),z=s==="all"||s==="pending"&&!T.is_approved||s==="approved"&&T.is_approved;return O&&z}),A=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T),E=T=>{const O={active:"bg-green-500/10 text-green-600 border-green-200",coming_soon:"bg-blue-500/10 text-blue-600 border-blue-200",price_improvement:"bg-amber-500/10 text-amber-600 border-amber-200",under_contract:"bg-purple-500/10 text-purple-600 border-purple-200",sold:"bg-gray-500/10 text-gray-600 border-gray-200"};return O[T]||O.active};return r.jsx(Or,{title:"Listing Exchange Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage community listings"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Feature visible to agents"}),r.jsx($s,{checked:S,onCheckedChange:T=>j.mutate(T)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Listings"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.total)||0})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kf,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.active)||0})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-4 w-4 text-amber-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Pending Review"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.pending)||0})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qo,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Views"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.totalViews)||0})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dc,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Shares"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.totalShares)||0})]})})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by city, address, or agent...",value:t,onChange:T=>n(T.target.value),className:"pl-9"})]}),r.jsx(ba,{value:s,onValueChange:T=>i(T),children:r.jsxs(fa,{children:[r.jsx(ln,{value:"all",children:"All"}),r.jsx(ln,{value:"pending",children:"Pending"}),r.jsx(ln,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{children:["Listings (",(C==null?void 0:C.length)||0,")"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Property"}),r.jsx(Et,{children:"Agent"}),r.jsx(Et,{children:"Price"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-center",children:"Approved"}),r.jsx(Et,{className:"text-center",children:"Featured"}),r.jsx(Et,{children:"Views"}),r.jsx(Et,{children:"Shares"}),r.jsx(Et,{children:"Date"}),r.jsx(Et,{})]})}),r.jsx(Hs,{children:h?r.jsx(Ir,{children:r.jsx(vt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(C==null?void 0:C.length)===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):C==null?void 0:C.map(T=>{var O,z,F,q,H;return r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(z=(O=T.photos)==null?void 0:O[0])!=null&&z.photo_url?r.jsx("img",{src:T.photos[0].photo_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(na,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.property_address||`${T.city}, ${T.state}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(F=T.property_type)==null?void 0:F.replace("_"," ")})]})]})}),r.jsx(vt,{children:r.jsx("p",{className:"text-sm",children:((q=T.agent)==null?void 0:q.name)||"Unknown"})}),r.jsx(vt,{className:"font-medium",children:A(T.price)}),r.jsx(vt,{children:r.jsx(Ft,{variant:"outline",className:E(T.status),children:(H=T.status)==null?void 0:H.replace("_"," ")})}),r.jsx(vt,{className:"text-center",children:r.jsx($s,{checked:T.is_approved??!1,onCheckedChange:K=>x.mutate({id:T.id,approved:K})})}),r.jsx(vt,{className:"text-center",children:r.jsx($s,{checked:T.is_featured??!1,onCheckedChange:K=>y.mutate({id:T.id,featured:K})})}),r.jsx(vt,{children:T.view_count||0}),r.jsx(vt,{children:T.share_count||0}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:fn(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(vt,{children:r.jsxs(Sm,{children:[r.jsx(Cm,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",children:r.jsx(og,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",children:[r.jsxs(po,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(po,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(po,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&w.mutate(T.id)},children:[r.jsx(Ts,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const pGt=()=>{var y,w;const[e,t]=P.useState(""),[n,s]=P.useState(null),{data:i,isLoading:o}=Jt({queryKey:["membership-reviews"],queryFn:async()=>{const{data:j,error:S}=await ee.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(S)throw S;const C=(j==null?void 0:j.map(T=>T.user_id))||[],{data:A}=await ee.from("profiles").select("id, name, email").in("id",C);return j==null?void 0:j.map(T=>({...T,profiles:(A==null?void 0:A.find(O=>O.id===T.user_id))||null}))}}),l=i==null?void 0:i.filter(j=>{var C,A,E,T,O;const S=e.toLowerCase();return((A=(C=j.profiles)==null?void 0:C.name)==null?void 0:A.toLowerCase().includes(S))||((T=(E=j.profiles)==null?void 0:E.email)==null?void 0:T.toLowerCase().includes(S))||((O=j.review_text)==null?void 0:O.toLowerCase().includes(S))}),a=i!=null&&i.length?(i.reduce((j,S)=>j+S.rating,0)/i.length).toFixed(1):"0.0",h=i==null?void 0:i.reduce((j,S)=>(j[S.rating]=(j[S.rating]||0)+1,j),{}),p=(i==null?void 0:i.filter(j=>j.posted_to_google).length)||0,x=j=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(S=>r.jsx(vs,{className:$t("h-4 w-4",j>=S?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},S))});return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Membership Reviews",description:"View and manage feedback from LevelUp members"}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsx(We,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(En,{children:"Total Reviews"}),r.jsx(Xt,{className:"text-3xl",children:(i==null?void 0:i.length)||0})]})}),r.jsx(We,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(En,{children:"Average Rating"}),r.jsxs(Xt,{className:"flex items-center gap-2 text-3xl",children:[a,r.jsx(vs,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(We,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(En,{children:"5-Star Reviews"}),r.jsx(Xt,{className:"text-3xl",children:(h==null?void 0:h[5])||0})]})}),r.jsx(We,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(En,{children:"Posted to Google"}),r.jsxs(Xt,{className:"flex items-center gap-2 text-3xl",children:[p,r.jsx(Ls,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name, email, or review...",value:e,onChange:j=>t(j.target.value),className:"pl-9"})]}),r.jsx(We,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Member"}),r.jsx(Et,{children:"Rating"}),r.jsx(Et,{className:"hidden md:table-cell",children:"Review"}),r.jsx(Et,{children:"Google"}),r.jsx(Et,{children:"Date"})]})}),r.jsx(Hs,{children:o?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Ir,{children:r.jsx(vt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(j=>{var S,C;return r.jsxs(Ir,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(j),children:[r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((S=j.profiles)==null?void 0:S.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(C=j.profiles)==null?void 0:C.email})]})}),r.jsx(vt,{children:x(j.rating)}),r.jsx(vt,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:j.review_text||"-"})}),r.jsx(vt,{children:j.posted_to_google?r.jsx(Ft,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Ft,{variant:"outline",children:"No"})}),r.jsx(vt,{className:"text-sm text-muted-foreground",children:fn(new Date(j.created_at),"MMM d, yyyy")})]},j.id)})})]})})}),r.jsx(Br,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Review Details"})}),n&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:((y=n.profiles)==null?void 0:y.name)||"Unknown Member"}),((w=n.profiles)==null?void 0:w.email)&&r.jsxs("a",{href:`mailto:${n.profiles.email}`,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-primary",children:[r.jsx(Zs,{className:"h-3 w-3"}),n.profiles.email]})]}),r.jsxs("div",{className:"text-right",children:[x(n.rating),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[n.rating," out of 5 stars"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Review"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:n.review_text||"No written review provided."})]}),r.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ys,{className:"h-4 w-4"}),fn(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Ft,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Ft,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},mGt=[{value:"0",label:"Sunday"},{value:"1",label:"Monday"},{value:"2",label:"Tuesday"},{value:"3",label:"Wednesday"},{value:"4",label:"Thursday"},{value:"5",label:"Friday"},{value:"6",label:"Saturday"}],gGt=Array.from({length:24},(e,t)=>({value:String(t),label:t===0?"12:00 AM":t<12?`${t}:00 AM`:t===12?"12:00 PM":`${t-12}:00 PM`}));function xGt(){const e=Wr(),{user:t}=zr(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[l,a]=P.useState(!1),{data:h,isLoading:p}=Jt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("weekly_digest_settings").select("*").single();if(Z)throw Z;return K}}),{data:x,isLoading:y}=Jt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(Z)throw Z;return K}}),{data:w}=Jt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:K,error:Z}=await ee.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(Z)throw Z;return K||0}}),{data:j,refetch:S}=Jt({queryKey:["digest-queue-status"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const[Z,re,ue,he]=await Promise.all([ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",K.toISOString())]);return{pending:Z.count||0,processing:re.count||0,sent:ue.count||0,failed:he.count||0,total:(Z.count||0)+(re.count||0)+(ue.count||0)+(he.count||0)}},refetchInterval:5e3});P.useEffect(()=>{if(j&&(j.pending>0||j.processing>0)){const K=setInterval(()=>{S(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(K)}},[j,S,e]);const{data:C=0}=Jt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const{count:Z,error:re}=await ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString());if(re)throw re;return Z||0}}),A=cr({mutationFn:async K=>{const{error:Z}=await ee.from("weekly_digest_settings").update(K).eq("id",h==null?void 0:h.id);if(Z)throw Z},onSuccess:()=>{e.invalidateQueries({queryKey:["weekly-digest-settings"]}),ze.success("Settings updated")},onError:K=>{ze.error("Failed to update settings: "+K.message)}}),E=async()=>{s(!0);try{const{data:K,error:Z}=await ee.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(Z)throw Z;K.queued?ze.success(`${K.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):K.sent!==void 0&&ze.success(`Digest sent! ${K.sent} emails delivered, ${K.failed} failed`),S(),e.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(K){ze.error("Failed to send digest: "+K.message)}finally{s(!1)}},T=async()=>{var K,Z,re,ue,he,be;if(!(t!=null&&t.email)){ze.error("No email found for your account");return}o(!0);try{const{data:ne,error:ye}=await ee.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:t.email}});if(ye)throw ye;const ie=ne==null?void 0:ne.resendId,fe=ne==null?void 0:ne.resendDetails,de=fe==null?void 0:fe.status,_e=((K=fe==null?void 0:fe.body)==null?void 0:K.status)||((re=(Z=fe==null?void 0:fe.body)==null?void 0:Z.data)==null?void 0:re.status),Ee=((he=(ue=fe==null?void 0:fe.body)==null?void 0:ue.error)==null?void 0:he.message)||((be=fe==null?void 0:fe.body)==null?void 0:be.message);ze.success(ie?`Preview accepted by email provider (id: ${ie})${de?`, status check: ${de}`:""}${_e?`, provider: ${_e}`:""}${Ee?` (${Ee})`:""}. Check spam/promotions—delivery can take a few minutes.`:"Preview accepted by email provider. Check spam/promotions—delivery can take a few minutes.")}catch(ne){ze.error("Failed to send preview: "+ne.message)}finally{o(!1)}},O=async()=>{a(!0);try{const{data:K,error:Z}=await ee.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(Z)throw Z;K.queued===0||K.sent===0&&K.failed===0&&!K.queued?ze.info("No failed emails to retry"):K.queued?ze.success(`${K.queued} emails queued for retry!`):ze.success(`Retry complete! ${K.sent} emails delivered, ${K.failed} failed`),S(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(K){ze.error("Failed to retry: "+K.message)}finally{a(!1)}},z=j!=null&&j.total?Math.round((j.sent+j.failed)/j.total*100):0,F=((j==null?void 0:j.pending)||0)>0||((j==null?void 0:j.processing)||0)>0,{data:q}=Jt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var be,ne;const K=new Date;K.setUTCHours(0,0,0,0);const[Z,re,ue,he]=await Promise.all([ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:Z.count||0,totalFailed:re.count||0,agentOsEngaged:ue.count||0,lastSent:((ne=(be=he.data)==null?void 0:be[0])==null?void 0:ne.sent_at)||null}},refetchInterval:F?5e3:!1}),H={totalSent:(q==null?void 0:q.totalSent)||0,totalFailed:(q==null?void 0:q.totalFailed)||0,lastSent:q==null?void 0:q.lastSent,agentOsEngaged:(q==null?void 0:q.agentOsEngaged)||0};return p?r.jsx(Or,{title:"Weekly Digest",description:"Manage automated weekly email digests",children:r.jsxs("div",{className:"animate-pulse space-y-4",children:[r.jsx("div",{className:"h-32 bg-muted rounded-lg"}),r.jsx("div",{className:"h-64 bg-muted rounded-lg"})]})}):r.jsx(Or,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(ba,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(fa,{children:[r.jsxs(ln,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(hd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(ln,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(ac,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(An,{value:"settings",className:"space-y-6",children:[F&&j&&r.jsx(We,{className:"border-primary/50 bg-primary/5",children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(nn,{className:"h-5 w-5 animate-spin text-primary"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:"Sending emails..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[j.sent.toLocaleString()," sent, ",j.pending.toLocaleString()," pending",j.failed>0&&`, ${j.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[z,"%"]})]}),r.jsx(Hc,{value:z,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Processing ~80 emails per minute. Estimated time remaining: ~",Math.ceil(j.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Kn,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:w}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10",children:r.jsx(Za,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:r.jsx(zc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(We,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Ki,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.lastSent?fn(new Date(H.lastSent),"MMM d"):"Never"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last Sent"})]})]})})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(En,{children:"Configure when the digest is sent"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx($s,{checked:h==null?void 0:h.is_enabled,onCheckedChange:K=>A.mutate({is_enabled:K})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Cron Frequency"}),r.jsxs(bn,{value:(h==null?void 0:h.cron_frequency)||"daily",onValueChange:K=>A.mutate({cron_frequency:K}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx(Kt,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(h==null?void 0:h.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Day of Week"}),r.jsxs(bn,{value:String(h==null?void 0:h.send_day),onValueChange:K=>A.mutate({send_day:parseInt(K)}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:mGt.map(K=>r.jsx(Kt,{value:K.value,children:K.label},K.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Time (UTC)"}),r.jsxs(bn,{value:String(h==null?void 0:h.send_hour),onValueChange:K=>A.mutate({send_hour:parseInt(K)}),disabled:(h==null?void 0:h.cron_frequency)==="daily",children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:gGt.map(K=>r.jsx(Kt,{value:K.value,children:K.label},K.value))})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(J,{onClick:T,disabled:i,variant:"outline",className:"flex-1",children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Preview to Me"]}),r.jsxs(J,{onClick:E,disabled:n,className:"flex-1",children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),C>0&&r.jsxs(J,{onClick:O,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(ql,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${C} Failed`]})]})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(En,{children:"Choose what to include in the digest"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ve,{children:"New Resources"})]}),r.jsx($s,{checked:h==null?void 0:h.include_new_resources,onCheckedChange:K=>A.mutate({include_new_resources:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ve,{children:"Community Highlights"})]}),r.jsx($s,{checked:h==null?void 0:h.include_community_posts,onCheckedChange:K=>A.mutate({include_community_posts:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ac,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ve,{children:"Agent OS Stats"})]}),r.jsx($s,{checked:h==null?void 0:h.include_agent_os_stats,onCheckedChange:K=>A.mutate({include_agent_os_stats:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ve,{children:"Upcoming Events"})]}),r.jsx($s,{checked:h==null?void 0:h.include_upcoming_events,onCheckedChange:K=>A.mutate({include_upcoming_events:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ve,{children:"Goals Progress"})]}),r.jsx($s,{checked:h==null?void 0:h.include_goals_progress,onCheckedChange:K=>A.mutate({include_goals_progress:K})})]})]})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Custom Introduction"}),r.jsx(En,{children:"Personalize the intro message (optional)"})]}),r.jsx(Xe,{children:r.jsx(ms,{placeholder:"Here's what's new this week to help you grow your business...",value:(h==null?void 0:h.custom_intro_text)||"",onChange:K=>A.mutate({custom_intro_text:K.target.value||null}),rows:3})})]})]}),r.jsx(An,{value:"stats",children:r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Zs,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(En,{children:"Recent digest emails sent to members"})]}),r.jsx(Xe,{children:y?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(K=>r.jsx("div",{className:"h-12 bg-muted rounded"},K))}):x&&x.length>0?r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Email"}),r.jsx(Et,{children:"Sent At"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{children:"Resources"}),r.jsx(Et,{children:"Agent OS"})]})}),r.jsx(Hs,{children:x.map(K=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:K.email_sent_to}),r.jsx(vt,{children:fn(new Date(K.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(vt,{children:r.jsx(Ft,{variant:K.delivery_status==="sent"?"default":"destructive",children:K.delivery_status})}),r.jsx(vt,{children:K.resources_count}),r.jsx(vt,{children:K.has_agent_os_activity?r.jsx(Ft,{variant:"secondary",children:"Active"}):r.jsx(Ft,{variant:"outline",children:"Not Started"})})]},K.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Zs,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No digests sent yet"}),r.jsx("p",{className:"text-sm",children:"Send your first digest to see delivery stats"})]})})]})})]})})}const yGt={first_event:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200",streak_3:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",streak_5:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",events_5:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",events_10:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",events_25:"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200"};function vGt(){var pe,ae,ge;const e=Wr(),[t,n]=P.useState(""),[s,i]=P.useState(null),[o,l]=P.useState(!1),[a,h]=P.useState(!1),[p,x]=P.useState(""),[y,w]=P.useState(""),[j,S]=P.useState(!0),[C,A]=P.useState(!1),[E,T]=P.useState(""),[O,z]=P.useState(null),{data:F,isLoading:q}=Jt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Me,error:Ue}=await ee.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Ue)throw Ue;const Ie=(Me==null?void 0:Me.map(Ce=>Ce.user_id))||[],{data:Ke}=await ee.from("profiles").select("id, name, email").in("id",Ie),Re=new Map((Ke==null?void 0:Ke.map(Ce=>[Ce.id,{name:Ce.name,email:Ce.email}]))||[]);return Me==null?void 0:Me.map(Ce=>({...Ce,profile:Re.get(Ce.user_id)||null}))}}),{data:H}=Jt({queryKey:["all-profiles-for-points",F],queryFn:async()=>{const{data:Me,error:Ue}=await ee.from("profiles").select("id, name, email").order("name");if(Ue)throw Ue;return Me}}),Z=((H==null?void 0:H.filter(Me=>!(F!=null&&F.some(Ue=>Ue.user_id===Me.id))))||[]).filter(Me=>{var Ie,Ke;if(!E)return!0;const Ue=E.toLowerCase();return((Ie=Me.name)==null?void 0:Ie.toLowerCase().includes(Ue))||((Ke=Me.email)==null?void 0:Ke.toLowerCase().includes(Ue))}),{data:re,isLoading:ue}=Jt({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Me,error:Ue}=await ee.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Ue)throw Ue;return Me},enabled:!!(s!=null&&s.user_id)&&a}),{data:he}=Jt({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Me,error:Ue}=await ee.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Ue)throw Ue;return Me},enabled:!!(s!=null&&s.user_id)}),be=cr({mutationFn:async({userId:Me,points:Ue,reason:Ie})=>{const{error:Ke}=await ee.from("agent_points").insert({user_id:Me,points:Ue,reason:Ie});if(Ke)throw Ke;const{data:Re}=await ee.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Me).maybeSingle(),Ce=((Re==null?void 0:Re.total_points)||0)+Ue,Je=((Re==null?void 0:Re.spendable_points)||0)+Ue,{error:Te}=await ee.from("agent_attendance_stats").upsert({user_id:Me,total_points:Math.max(0,Ce),spendable_points:Math.max(0,Je),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Te)throw Te},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-agent-points"]}),e.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),x(""),w(""),ze.success(j?"Points awarded successfully!":"Points deducted successfully!")},onError:Me=>{console.error("Error modifying points:",Me),ze.error("Failed to modify points")}}),ne=()=>{if(!s||!p||!y){ze.error("Please fill in all fields");return}const Me=parseInt(p);if(isNaN(Me)||Me<=0){ze.error("Please enter a valid positive number");return}be.mutate({userId:s.user_id,points:j?Me:-Me,reason:y})},ye=()=>{if(!O||!p||!y){ze.error("Please fill in all fields");return}const Me=parseInt(p);if(isNaN(Me)||Me<=0){ze.error("Please enter a valid positive number");return}be.mutate({userId:O.id,points:Me,reason:y},{onSuccess:()=>{A(!1),z(null),T("")}})},ie=(Me,Ue)=>{i(Me),S(Ue),l(!0)},fe=Me=>{i(Me),h(!0)},de=F==null?void 0:F.filter(Me=>{var Re,Ce,Je,Te;const Ue=((Ce=(Re=Me.profile)==null?void 0:Re.name)==null?void 0:Ce.toLowerCase())||"",Ie=((Te=(Je=Me.profile)==null?void 0:Je.email)==null?void 0:Te.toLowerCase())||"",Ke=t.toLowerCase();return Ue.includes(Ke)||Ie.includes(Ke)}),_e=(F==null?void 0:F.reduce((Me,Ue)=>Me+Ue.total_points,0))||0,Ee=(F==null?void 0:F.length)||0,ke=Ee>0?Math.round(_e/Ee):0;return q?r.jsx(Or,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Me=>r.jsx(Pr,{className:"h-24"},Me))}),r.jsx(Pr,{className:"h-96"})]})}):r.jsx(Or,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Agent Points Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Track, view, and manage agent gamification points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Kn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ee}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ha,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:_e.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Kf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Average Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:ke}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"per agent"})]})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search agents...",value:t,onChange:Me=>n(Me.target.value),className:"pl-10"})]}),r.jsxs(J,{onClick:()=>A(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Agent Leaderboard"}),r.jsx(En,{children:"All agents with their points, events, and streaks"})]}),r.jsx(Xe,{children:!de||de.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ha,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{className:"w-12",children:"#"}),r.jsx(Et,{children:"Agent"}),r.jsx(Et,{className:"text-center",children:"Total Points"}),r.jsx(Et,{className:"text-center",children:"Spendable"}),r.jsx(Et,{className:"text-center",children:"Events"}),r.jsx(Et,{className:"text-center",children:"Streak"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:de.map((Me,Ue)=>{var Ie,Ke,Re,Ce;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:Ue<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Ue===0?"bg-yellow-100 text-yellow-700":Ue===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Ue+1}):r.jsx("span",{className:"text-muted-foreground",children:Ue+1})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{children:((Ke=(Ie=Me.profile)==null?void 0:Ie.name)==null?void 0:Ke.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Re=Me.profile)==null?void 0:Re.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(Ce=Me.profile)==null?void 0:Ce.email})]})]})}),r.jsx(vt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),Me.total_points]})}),r.jsx(vt,{className:"text-center",children:r.jsxs(Ft,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(Va,{className:"h-3 w-3 mr-1"}),Me.spendable_points||0]})}),r.jsx(vt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Ys,{className:"h-3 w-3 text-muted-foreground"}),Me.total_events_attended]})}),r.jsx(vt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Kh,{className:"h-3 w-3 text-orange-500"}),Me.current_streak]})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>ie(Me,!0),title:"Award points",children:r.jsx(jn,{className:"h-4 w-4 text-green-600"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>ie(Me,!1),title:"Deduct points",children:r.jsx(g1,{className:"h-4 w-4 text-red-600"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>fe(Me),title:"View history",children:r.jsx(tS,{className:"h-4 w-4"})})]})})]},Me.user_id)})})]})})]}),r.jsx(Br,{open:o,onOpenChange:l,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:j?"Award Points":"Deduct Points"}),r.jsxs(es,{children:[j?"Award":"Deduct"," points ",j?"to":"from"," ",((pe=s==null?void 0:s.profile)==null?void 0:pe.name)||"this agent"]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"points",children:"Points Amount"}),r.jsx(ct,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Me=>x(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"reason",children:"Reason"}),r.jsx(ms,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Me=>w(Me.target.value)})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(J,{onClick:ne,disabled:be.isPending,className:j?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:be.isPending?"Saving...":j?"Award Points":"Deduct Points"})]})]})}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:["Point History: ",(ae=s==null?void 0:s.profile)==null?void 0:ae.name]}),r.jsx(es,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(ba,{defaultValue:"history",className:"w-full",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsx(ln,{value:"history",children:"Point History"}),r.jsx(ln,{value:"badges",children:"Badges"})]}),r.jsx(An,{value:"history",className:"mt-4",children:ue?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Me=>r.jsx(Pr,{className:"h-12"},Me))}):!re||re.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(tS,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No point history yet"})]}):r.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:re.map(Me=>r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:Me.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:fn(new Date(Me.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Ft,{variant:Me.points>=0?"default":"destructive",className:Me.points>=0?"bg-green-100 text-green-800":"",children:[Me.points>=0?"+":"",Me.points]})]},Me.id))})}),r.jsx(An,{value:"badges",className:"mt-4",children:!he||he.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Pl,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No badges earned yet"})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:he.map(Me=>r.jsxs("div",{className:`p-3 rounded-lg ${yGt[Me.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Pl,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Me.badge_name})]}),Me.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Me.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",fn(new Date(Me.earned_at),"MMM d, yyyy")]})]},Me.id))})})]})]})}),r.jsx(Br,{open:C,onOpenChange:Me=>{A(Me),Me||(z(null),T(""),x(""),w(""))},children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Award Points to New Agent"}),r.jsx(es,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:O?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(ci,{className:"h-10 w-10",children:r.jsx(di,{children:((ge=O.name)==null?void 0:ge.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:O.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:O.email})]}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>z(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(ct,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Me=>x(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"new-reason",children:"Reason"}),r.jsx(ms,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:Me=>w(Me.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(Mi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ct,{placeholder:"Search by name or email...",value:E,onChange:Me=>T(Me.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:Z.length===0?r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx(Kn,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:E?"No matching agents found":"All agents already have points"})]}):Z.slice(0,20).map(Me=>{var Ue;return r.jsxs("button",{onClick:()=>z(Me),className:"w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors border-b last:border-b-0 text-left",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{children:((Ue=Me.name)==null?void 0:Ue.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Me.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Me.email})]})]},Me.id)})})]})}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),O&&r.jsxs(J,{onClick:ye,disabled:be.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function _Gt(){const{data:e,isLoading:t}=cit(),[n,s]=P.useState(null),[i,o]=P.useState(!1);return r.jsxs(Or,{title:"Digital Agent Cards",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Digital Agent Cards"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage agent digital business cards"})]}),r.jsxs(J,{onClick:()=>o(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]}),t?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(l=>r.jsx(Pr,{className:"h-48"},l))}):e&&e.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(l=>r.jsx(bGt,{card:l,onEdit:()=>s(l)},l.id))}):r.jsx(We,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(Kn,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No cards yet"}),r.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Create your first digital agent card"}),r.jsxs(J,{onClick:()=>o(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(wGt,{open:i,onOpenChange:o}),n&&r.jsx(jGt,{card:n,open:!!n,onOpenChange:l=>!l&&s(null)})]})}function bGt({card:e,onEdit:t}){const[n,s]=P.useState(null);P.useEffect(()=>{(async()=>{const{data:a}=await ee.from("profiles").select("name").eq("id",e.user_id).single();let h=null;try{const{data:p}=await ee.storage.from("avatars").list(`${e.user_id}`);if(p&&p.length>0){const{data:x}=ee.storage.from("avatars").getPublicUrl(`${e.user_id}/${p[0].name}`);h=x.publicUrl}}catch{}s({name:(a==null?void 0:a.name)||"Unknown",avatar_url:h})})()},[e.user_id]);const i=`https://cards.relevelup.com/${e.slug}`,o=()=>{navigator.clipboard.writeText(i),ze.success("Link copied!")};return r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:(n==null?void 0:n.avatar_url)||void 0}),r.jsx(di,{children:((n==null?void 0:n.name)||"U")[0]})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold truncate",children:(n==null?void 0:n.name)||"Loading..."}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["/card/",e.slug]})]}),r.jsx(Ft,{variant:e.is_published?"default":"secondary",children:e.is_published?"Live":"Draft"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:t,className:"flex-1",children:[r.jsx(ha,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(J,{variant:"outline",size:"sm",onClick:o,children:r.jsx(jl,{className:"h-3 w-3"})}),r.jsx(J,{variant:"outline",size:"sm",asChild:!0,children:r.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Ls,{className:"h-3 w-3"})})})]})]})})}function wGt({open:e,onOpenChange:t}){const[n,s]=P.useState(""),[i,o]=P.useState(""),[l,a]=P.useState(""),[h,p]=P.useState(!1),x=p6e(),y=l.trim(),{data:w}=Jt({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let T=ee.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(T=T.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:O}=await T;return O||[]},enabled:e}),[j,S]=P.useState(null),C=(w==null?void 0:w.find(T=>T.id===n))||j,A=()=>{if(!n||!i.trim()){ze.error("Select an agent and enter a slug");return}x.mutate({user_id:n,slug:i.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-"),is_published:!0},{onSuccess:()=>{t(!1),s(""),o(""),a("")}})},E=T=>{var z;s(T),p(!1);const O=w==null?void 0:w.find(F=>F.id===T);O&&(S(O),o(((z=O.name)==null?void 0:z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create Agent Card"}),r.jsx(es,{children:"Select an agent and set their card URL slug."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Agent"}),r.jsxs(_h,{open:h,onOpenChange:p,children:[r.jsx(bh,{asChild:!0,children:r.jsxs(J,{variant:"outline",role:"combobox","aria-expanded":h,className:"w-full justify-between font-normal",children:[C?`${C.name} (${C.email})`:"Search for an agent...",r.jsx(a1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Ou,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:r.jsxs($1,{shouldFilter:!1,children:[r.jsx(U1,{placeholder:"Search by name or email...",value:l,onValueChange:a}),r.jsxs(q1,{children:[r.jsx(V1,{children:"No agents found."}),r.jsx(H1,{children:(w||[]).map(T=>r.jsxs(W1,{value:T.id,onSelect:E,children:[r.jsx(Ca,{className:$t("mr-2 h-4 w-4",n===T.id?"opacity-100":"opacity-0")}),T.name," (",T.email,")"]},T.id))})]})]})})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"URL Slug"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"/card/"}),r.jsx(ct,{value:i,onChange:T=>o(T.target.value),placeholder:"john-doe"})]})]}),r.jsx(J,{onClick:A,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function jGt({card:e,open:t,onOpenChange:n}){const s=m6e(),{data:i}=g6e(e.id);Wr();const[o,l]=P.useState(null),[a,h]=P.useState(!1),[p,x]=P.useState({is_published:e.is_published,theme:e.theme,positioning_statement:e.positioning_statement||"",bio:e.bio||"",review_snippet:e.review_snippet||"",review_source_url:e.review_source_url||"",booking_url:e.booking_url||"",custom_cta_label:e.custom_cta_label||"",show_photo:e.show_photo,show_bio:e.show_bio,show_credentials:e.show_credentials,show_social_links:e.show_social_links,show_save_contact:e.show_save_contact,show_leave_review:e.show_leave_review,show_refer_friend:e.show_refer_friend});P.useEffect(()=>{t&&(async()=>{try{const{data:S}=await ee.storage.from("avatars").list(`${e.user_id}`);if(S&&S.length>0){const{data:C}=ee.storage.from("avatars").getPublicUrl(`${e.user_id}/${S[0].name}`);l(`${C.publicUrl}?t=${Date.now()}`)}}catch{}})()},[e.user_id,t]);const y=async j=>{var C;const S=(C=j.target.files)==null?void 0:C[0];if(S){if(!S.type.startsWith("image/")){ze.error("Please select an image file");return}if(S.size>5*1024*1024){ze.error("Image must be under 5MB");return}h(!0);try{const{data:A}=await ee.storage.from("avatars").list(`${e.user_id}`);A&&A.length>0&&await ee.storage.from("avatars").remove(A.map(F=>`${e.user_id}/${F.name}`));const E=S.name.split(".").pop(),T=`${e.user_id}/avatar.${E}`,{error:O}=await ee.storage.from("avatars").upload(T,S,{upsert:!0});if(O)throw O;const{data:z}=ee.storage.from("avatars").getPublicUrl(T);l(`${z.publicUrl}?t=${Date.now()}`),ze.success("Photo updated!")}catch(A){ze.error(A.message||"Upload failed")}finally{h(!1)}}},w=()=>{s.mutate({id:e.id,...p,positioning_statement:p.positioning_statement||null,bio:p.bio||null,review_snippet:p.review_snippet||null,review_source_url:p.review_source_url||null,booking_url:p.booking_url||null,custom_cta_label:p.custom_cta_label||null},{onSuccess:()=>n(!1)})};return r.jsx(Br,{open:t,onOpenChange:n,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Agent Card"}),r.jsxs(es,{children:["/card/",e.slug]})]}),r.jsxs(ba,{defaultValue:"content",children:[r.jsxs(fa,{className:"w-full",children:[r.jsx(ln,{value:"content",className:"flex-1",children:"Content"}),r.jsx(ln,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(ln,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(ln,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(An,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ve,{children:"Published"}),r.jsx($s,{checked:p.is_published,onCheckedChange:j=>x(S=>({...S,is_published:j}))})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Agent Photo"}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs(ci,{className:"h-16 w-16",children:[r.jsx(Wa,{src:o||void 0}),r.jsx(di,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:y,disabled:a}),r.jsx(J,{variant:"outline",size:"sm",asChild:!0,disabled:a,children:r.jsx("span",{children:a?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(go,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Theme"}),r.jsxs(bn,{value:p.theme,onValueChange:j=>x(S=>({...S,theme:j})),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"standard",children:"Standard (Modern Clean)"}),r.jsx(Kt,{value:"luxury",children:"Luxury (Dark & Gold)"}),r.jsx(Kt,{value:"bold",children:"Bold (Vibrant & Punchy)"}),r.jsx(Kt,{value:"classic",children:"Classic (Professional)"})]})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Positioning Statement"}),r.jsx(ct,{value:p.positioning_statement,onChange:j=>x(S=>({...S,positioning_statement:j.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Bio"}),r.jsx(ms,{value:p.bio,onChange:j=>x(S=>({...S,bio:j.target.value})),placeholder:"Short about me...",rows:3})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Review Snippet"}),r.jsx(ct,{value:p.review_snippet,onChange:j=>x(S=>({...S,review_snippet:j.target.value})),placeholder:"Best agent we've ever worked with..."})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Review Source URL"}),r.jsx(ct,{value:p.review_source_url,onChange:j=>x(S=>({...S,review_source_url:j.target.value})),placeholder:"https://g.page/your-business/review"})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Booking URL (optional — if empty, shows lead form)"}),r.jsx(ct,{value:p.booking_url,onChange:j=>x(S=>({...S,booking_url:j.target.value})),placeholder:"https://calendly.com/your-link"})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Custom CTA Label (optional)"}),r.jsx(ct,{value:p.custom_cta_label,onChange:j=>x(S=>({...S,custom_cta_label:j.target.value})),placeholder:"Book a Call"})]})]}),r.jsx(An,{value:"sections",className:"space-y-4 mt-4",children:[{key:"show_photo",label:"Show Photo",hint:"Photo is pulled from the agent's profile."},{key:"show_bio",label:"Show Bio"},{key:"show_credentials",label:"Show Credentials"},{key:"show_social_links",label:"Show Social Links"},{key:"show_save_contact",label:"Save Contact Button"},{key:"show_leave_review",label:"Leave Review Button"},{key:"show_refer_friend",label:"Refer a Friend Button"}].map(({key:j,label:S,hint:C})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:S}),C&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[C," ",j==="show_photo"&&r.jsx("a",{href:"/profile",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:"Update Profile"})]})]}),r.jsx($s,{checked:p[j],onCheckedChange:A=>x(E=>({...E,[j]:A}))})]},j))}),r.jsx(An,{value:"blocks",className:"mt-4",children:r.jsx(z$e,{cardId:e.id})}),r.jsx(An,{value:"analytics",className:"mt-4",children:i?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:i.views}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Views"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:i.clicks}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:i.leads.length}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Leads"})]})})]}),i.leads.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Recent Leads"}),r.jsx("div",{className:"space-y-2",children:i.leads.slice(0,5).map(j=>r.jsxs("div",{className:"text-sm p-2 bg-muted/50 rounded-lg",children:[r.jsx("span",{className:"font-medium",children:j.name}),j.phone&&r.jsxs("span",{className:"text-muted-foreground",children:[" · ",j.phone]}),j.intent&&r.jsx(Ft,{variant:"secondary",className:"ml-2 text-xs",children:j.intent})]},j.id))})]})]}):r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No analytics data yet"})})]}),r.jsx(J,{onClick:w,disabled:s.isPending,className:"w-full mt-4",children:s.isPending?"Saving...":"Save Changes"})]})})}const DS={pending_payment:"Pending Payment",order_submitted:"Order Submitted",awaiting_proof_approval:"Awaiting Proof Approval",proof_approved:"Proof Approved",processing:"Processing",in_production:"In Production",shipped:"Shipped",completed:"Completed",cancelled:"Cancelled",refunded:"Refunded"},P0e={pending_payment:"bg-yellow-100 text-yellow-800",order_submitted:"bg-blue-100 text-blue-800",awaiting_proof_approval:"bg-orange-100 text-orange-800",proof_approved:"bg-green-100 text-green-800",processing:"bg-purple-100 text-purple-800",in_production:"bg-indigo-100 text-indigo-800",shipped:"bg-cyan-100 text-cyan-800",completed:"bg-green-200 text-green-900",cancelled:"bg-red-100 text-red-800",refunded:"bg-gray-100 text-gray-800"};function L0e(e=!0){return Jt({queryKey:["marketplace-categories",e],queryFn:async()=>{let t=ee.from("marketplace_categories").select("*").order("sort_order",{ascending:!0});e&&(t=t.eq("is_active",!0));const{data:n,error:s}=await t;if(s)throw s;return n}})}function kGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("marketplace_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category created successfully")},onError:t=>{ze.error("Failed to create category: "+t.message)}})}function NGt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("marketplace_categories").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category updated successfully")},onError:t=>{ze.error("Failed to update category: "+t.message)}})}function SGt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("marketplace_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category deleted successfully")},onError:t=>{ze.error("Failed to delete category: "+t.message)}})}function eUe(e,t=!0){return Jt({queryKey:["marketplace-products",e,t],queryFn:async()=>{let n=ee.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).order("sort_order",{ascending:!0});e&&(n=n.eq("category_id",e)),t&&(n=n.eq("is_active",!0));const{data:s,error:i}=await n;if(i)throw i;return s}})}function CGt(e){return Jt({queryKey:["marketplace-product",e],queryFn:async()=>{const{data:t,error:n}=await ee.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function MGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("marketplace_products").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product created successfully")},onError:t=>{ze.error("Failed to create product: "+t.message)}})}function TGt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("marketplace_products").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.id]}),ze.success("Product updated successfully")},onError:t=>{ze.error("Failed to update product: "+t.message)}})}function AGt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("marketplace_products").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product deleted successfully")},onError:t=>{ze.error("Failed to delete product: "+t.message)}})}function EGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("marketplace_product_images").insert([t]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.product_id]})}})}function IGt(){const e=Wr();return cr({mutationFn:async({id:t,productId:n})=>{const{error:s}=await ee.from("marketplace_product_images").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),ze.success("Image deleted successfully")},onError:t=>{ze.error("Failed to delete image: "+t.message)}})}function PGt(){const e=Wr();return cr({mutationFn:async({imageId:t,productId:n})=>{const{error:s}=await ee.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:i}=await ee.from("marketplace_product_images").update({is_primary:!0}).eq("id",t);if(i)throw i;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),ze.success("Primary image updated")},onError:t=>{ze.error("Failed to set primary image: "+t.message)}})}function LGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("marketplace_product_variants").insert([t]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.product_id]}),ze.success("Variant added successfully")}})}function OGt(){const e=Wr();return cr({mutationFn:async({id:t,productId:n})=>{const{error:s}=await ee.from("marketplace_product_variants").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),ze.success("Variant deleted successfully")}})}function DGt(){const e=Wr();return cr({mutationFn:async({productId:t,videoUrl:n})=>{await ee.from("marketplace_product_videos").delete().eq("product_id",t);const{data:s,error:i}=await ee.from("marketplace_product_videos").insert({product_id:t,video_url:n}).select().single();if(i)throw i;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.productId]}),ze.success("Video updated successfully")}})}function RGt(e){const{isAdmin:t}=zr();return Jt({queryKey:["marketplace-orders",e,t],queryFn:async()=>{let n=ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:i}=await n;if(i)throw i;if(t&&s){const o=[...new Set(s.map(h=>h.user_id))],{data:l}=await ee.from("profiles").select("id, name, email").in("id",o),a=new Map((l==null?void 0:l.map(h=>[h.id,h]))||[]);return s.map(h=>({...h,user:a.get(h.user_id)}))}return s}})}function FGt(){const{user:e}=zr();return Jt({queryKey:["my-marketplace-orders",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("user_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function zGt(e){return Jt({queryKey:["marketplace-order",e],queryFn:async()=>{const{data:t,error:n}=await ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function BGt(){const e=Wr(),{user:t}=zr();return cr({mutationFn:async({orderId:n,status:s,notes:i,trackingNumber:o,trackingUrl:l,previousStatus:a})=>{const h={status:s};o!==void 0&&(h.tracking_number=o),l!==void 0&&(h.tracking_url=l);const{error:p}=await ee.from("marketplace_orders").update(h).eq("id",n);if(p)throw p;const{error:x}=await ee.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:i,created_by:t==null?void 0:t.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(s)&&s!==a)try{await ee.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:l}})}catch(w){console.error("Failed to send notification email:",w)}},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Order status updated")},onError:n=>{ze.error("Failed to update order: "+n.message)}})}function $Gt(){const e=Wr();return cr({mutationFn:async({itemId:t,proofUrl:n,proofNotes:s,orderId:i})=>{const{error:o}=await ee.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",t);if(o)throw o;await ee.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",i);try{await ee.functions.invoke("marketplace-order-notify",{body:{orderId:i,notificationType:"proof_ready"}})}catch(l){console.error("Failed to send proof notification:",l)}return i},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof uploaded & customer notified")}})}function UGt(){const e=Wr();return cr({mutationFn:async({itemId:t,orderId:n})=>{const{error:s}=await ee.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof approved")}})}function qGt(){const e=Wr();return cr({mutationFn:async({itemId:t,orderId:n,reason:s})=>{const{error:i}=await ee.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",t);if(i)throw i;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof rejected - please upload a new proof")}})}function VGt(){const{data:e,isLoading:t}=L0e(!1),n=kGt(),s=NGt(),i=SGt(),[o,l]=P.useState(!1),[a,h]=P.useState(null),[p,x]=P.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),y=()=>{x({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),h(null)},w=C=>{h(C),x({name:C.name,description:C.description||"",image_url:C.image_url||"",sort_order:C.sort_order,is_active:C.is_active}),l(!0)},j=async C=>{C.preventDefault(),a?await s.mutateAsync({id:a.id,...p}):await n.mutateAsync(p),l(!1),y()},S=async C=>{confirm("Are you sure you want to delete this category?")&&await i.mutateAsync(C)};return t?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Pr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(C=>r.jsx(Pr,{className:"h-12 w-full"},C))})})]}):r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"Categories"}),r.jsxs(Br,{open:o,onOpenChange:C=>{l(C),C||y()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:a?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Name"}),r.jsx(ct,{id:"name",value:p.name,onChange:C=>x({...p,name:C.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",value:p.description,onChange:C=>x({...p,description:C.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"image_url",children:"Image URL"}),r.jsx(ct,{id:"image_url",value:p.image_url,onChange:C=>x({...p,image_url:C.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(ct,{id:"sort_order",type:"number",value:p.sort_order,onChange:C=>x({...p,sort_order:parseInt(C.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"is_active",checked:p.is_active,onCheckedChange:C=>x({...p,is_active:C})}),r.jsx(Ve,{htmlFor:"is_active",children:"Active"})]}),r.jsx(J,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:a?"Update Category":"Create Category"})]})]})]})]}),r.jsx(Xe,{children:e&&e.length>0?r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{children:"Sort Order"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:e.map(C=>r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-medium",children:C.name}),r.jsx(vt,{className:"max-w-xs truncate",children:C.description}),r.jsx(vt,{children:C.sort_order}),r.jsx(vt,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${C.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:C.is_active?"Active":"Inactive"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>w(C),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>S(C.id),disabled:i.isPending,children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},C.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function HGt(){var ke,pe;const{data:e,isLoading:t}=eUe(void 0,!1),{data:n}=L0e(!1),s=MGt(),i=TGt(),o=AGt(),l=EGt(),a=IGt(),h=PGt(),p=LGt(),x=OGt(),y=DGt(),[w,j]=P.useState(!1),[S,C]=P.useState(!1),[A,E]=P.useState(!1),[T,O]=P.useState(null),[z,F]=P.useState(null),[q,H]=P.useState(!1),[K,Z]=P.useState({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),[re,ue]=P.useState({name:"",price_adjustment:0}),[he,be]=P.useState(""),ne=()=>{Z({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),O(null)},ye=ae=>{O(ae),Z({name:ae.name,description:ae.description||"",base_price:Number(ae.base_price),shipping_fee:Number(ae.shipping_fee),category_id:ae.category_id||"",allow_artwork_upload:ae.allow_artwork_upload,requires_proof_approval:ae.requires_proof_approval,is_active:ae.is_active,sort_order:ae.sort_order}),j(!0)},ie=async ae=>{ae.preventDefault();const ge={...K,category_id:K.category_id||null};T?await i.mutateAsync({id:T.id,...ge}):await s.mutateAsync(ge),j(!1),ne()},fe=async ae=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(ae)},de=async ae=>{if(!z||!ae.target.files||ae.target.files.length===0)return;H(!0);const ge=ae.target.files[0],Me=ge.name.split(".").pop(),Ue=`products/${z.id}/${Date.now()}.${Me}`;try{const{error:Ie}=await ee.storage.from("marketplace").upload(Ue,ge);if(Ie)throw Ie;const{data:{publicUrl:Ke}}=ee.storage.from("marketplace").getPublicUrl(Ue);await l.mutateAsync({product_id:z.id,image_url:Ke,is_primary:!z.images||z.images.length===0}),ze.success("Image uploaded successfully")}catch(Ie){ze.error("Failed to upload image: "+Ie.message)}finally{H(!1)}},_e=async ae=>{ae.preventDefault(),z&&(await p.mutateAsync({product_id:z.id,name:re.name,price_adjustment:re.price_adjustment}),ue({name:"",price_adjustment:0}))},Ee=async()=>{!z||!he||(await y.mutateAsync({productId:z.id,videoUrl:he}),be(""))};return t?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Pr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(ae=>r.jsx(Pr,{className:"h-64 w-full"},ae))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"Products"}),r.jsxs(Br,{open:w,onOpenChange:ae=>{j(ae),ae||ne()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(J,{children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"name",children:"Product Name"}),r.jsx(ct,{id:"name",value:K.name,onChange:ae=>Z({...K,name:ae.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"category",children:"Category"}),r.jsxs(bn,{value:K.category_id,onValueChange:ae=>Z({...K,category_id:ae}),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select category"})}),r.jsx(_n,{children:n==null?void 0:n.map(ae=>r.jsx(Kt,{value:ae.id,children:ae.name},ae.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"description",children:"Description"}),r.jsx(ms,{id:"description",value:K.description,onChange:ae=>Z({...K,description:ae.target.value}),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(ct,{id:"base_price",type:"number",step:"0.01",min:"0",value:K.base_price,onChange:ae=>Z({...K,base_price:parseFloat(ae.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(ct,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:K.shipping_fee,onChange:ae=>Z({...K,shipping_fee:parseFloat(ae.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(ct,{id:"sort_order",type:"number",value:K.sort_order,onChange:ae=>Z({...K,sort_order:parseInt(ae.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"allow_artwork_upload",checked:K.allow_artwork_upload,onCheckedChange:ae=>Z({...K,allow_artwork_upload:ae})}),r.jsx(Ve,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"requires_proof_approval",checked:K.requires_proof_approval,onCheckedChange:ae=>Z({...K,requires_proof_approval:ae})}),r.jsx(Ve,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"is_active",checked:K.is_active,onCheckedChange:ae=>Z({...K,is_active:ae})}),r.jsx(Ve,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(J,{type:"submit",className:"w-full",disabled:s.isPending||i.isPending,children:T?"Update Product":"Create Product"})]})]})]})]}),r.jsx(Xe,{children:e&&e.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(ae=>{var ge,Me;return r.jsxs(We,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[ae.images&&ae.images.length>0?r.jsx("img",{src:((ge=ae.images.find(Ue=>Ue.is_primary))==null?void 0:ge.image_url)||ae.images[0].image_url,alt:ae.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No image"}),!ae.is_active&&r.jsx(Ft,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:ae.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Me=ae.category)==null?void 0:Me.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(ae.base_price).toFixed(2)]}),Number(ae.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(ae.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[ae.allow_artwork_upload&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),ae.requires_proof_approval&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Proof Required"}),ae.variants&&ae.variants.length>0&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:[ae.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>ye(ae),children:[r.jsx(ha,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{F(ae),C(!0)},children:[r.jsx(rS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{F(ae),E(!0)},children:[r.jsx(Hx,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>fe(ae.id),children:r.jsx(Zn,{className:"h-3 w-3 text-destructive"})})]})]})]},ae.id)})}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No products yet. Create your first product to get started."})})]}),r.jsx(Br,{open:S,onOpenChange:C,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Manage Images - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(ke=z==null?void 0:z.images)==null?void 0:ke.map(ae=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:ae.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),ae.is_primary&&r.jsx(Ft,{className:"absolute top-2 left-2",variant:"default",children:"Primary"}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!ae.is_primary&&r.jsx(J,{variant:"secondary",size:"icon",onClick:async()=>{var ge;await h.mutateAsync({imageId:ae.id,productId:z.id}),F({...z,images:(ge=z.images)==null?void 0:ge.map(Me=>({...Me,is_primary:Me.id===ae.id}))})},disabled:h.isPending,title:"Set as primary",children:r.jsx(vs,{className:"h-4 w-4"})}),r.jsx(J,{variant:"destructive",size:"icon",onClick:async()=>{var Me;await a.mutateAsync({id:ae.id,productId:z.id});const ge=e==null?void 0:e.find(Ue=>Ue.id===z.id);ge&&F({...ge,images:(Me=ge.images)==null?void 0:Me.filter(Ue=>Ue.id!==ae.id)})},disabled:a.isPending,children:r.jsx(Zn,{className:"h-4 w-4"})})]})]},ae.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:de,className:"hidden",id:"image-upload",disabled:q}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(rS,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:q?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx(Ve,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(ct,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:he,onChange:ae=>be(ae.target.value)}),r.jsxs(J,{onClick:Ee,disabled:!he,children:[r.jsx(Fi,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),(z==null?void 0:z.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",z.video.video_url]})]})]})]})}),r.jsx(Br,{open:A,onOpenChange:E,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Manage Variants - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:_e,className:"flex gap-2",children:[r.jsx(ct,{placeholder:"Variant name (e.g., 500 count)",value:re.name,onChange:ae=>ue({...re,name:ae.target.value}),required:!0}),r.jsx(ct,{type:"number",step:"0.01",placeholder:"Price adj.",value:re.price_adjustment,onChange:ae=>ue({...re,price_adjustment:parseFloat(ae.target.value)||0}),className:"w-32"}),r.jsx(J,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(pe=z==null?void 0:z.variants)==null?void 0:pe.map(ae=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:ae.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(ae.price_adjustment)>=0?"+":"","$",Number(ae.price_adjustment).toFixed(2)]})]}),r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:ae.id,productId:z.id}),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]},ae.id)),(!(z!=null&&z.variants)||z.variants.length===0)&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:'No variants yet. Add variants like "250 count", "500 count", etc.'})]})]})]})})]})}const WGt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function GGt(){var C,A,E;const{data:e,isLoading:t}=RGt(),n=BGt(),s=$Gt(),[i,o]=P.useState(null),[l,a]=P.useState(!1),[h,p]=P.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,y]=P.useState(!1),w=T=>{o(T),p({status:T.status,notes:"",trackingNumber:T.tracking_number||"",trackingUrl:T.tracking_url||""}),a(!0)},j=async()=>{i&&(await n.mutateAsync({orderId:i.id,status:h.status,notes:h.notes,trackingNumber:h.trackingNumber,trackingUrl:h.trackingUrl,previousStatus:i.status}),a(!1))},S=async(T,O)=>{if(!i||!T.target.files||T.target.files.length===0)return;y(!0);const z=T.target.files[0],F=z.name.split(".").pop(),q=`proofs/${i.id}/${O}/${Date.now()}.${F}`;try{const{error:H}=await ee.storage.from("marketplace").upload(q,z);if(H)throw H;const{data:{publicUrl:K}}=ee.storage.from("marketplace").getPublicUrl(q);await s.mutateAsync({itemId:O,proofUrl:K,orderId:i.id}),ze.success("Proof uploaded successfully")}catch(H){ze.error("Failed to upload proof: "+H.message)}finally{y(!1)}};return t?r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Pr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Pr,{className:"h-16 w-full"},T))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Orders"})}),r.jsx(Xe,{children:e&&e.length>0?r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Order #"}),r.jsx(Et,{children:"Customer"}),r.jsx(Et,{children:"Date"}),r.jsx(Et,{children:"Total"}),r.jsx(Et,{children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:e.map(T=>{var O,z;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"font-mono",children:T.order_number}),r.jsx(vt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((O=T.user)==null?void 0:O.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(z=T.user)==null?void 0:z.email})]})}),r.jsx(vt,{children:fn(new Date(T.created_at),"MMM d, yyyy")}),r.jsxs(vt,{className:"font-bold",children:["$",Number(T.total).toFixed(2)]}),r.jsx(vt,{children:r.jsx(Ft,{className:P0e[T.status],children:DS[T.status]})}),r.jsx(vt,{className:"text-right",children:r.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>w(T),children:[r.jsx(Qo,{className:"h-4 w-4 mr-1"}),"View"]})})]},T.id)})})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Order ",i==null?void 0:i.order_number]})}),i&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Customer"}),r.jsx("p",{children:(C=i.user)==null?void 0:C.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(A=i.user)==null?void 0:A.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:i.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.shipping_address,r.jsx("br",{}),i.shipping_city,", ",i.shipping_state," ",i.shipping_zip]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Order Items"}),r.jsx("div",{className:"space-y-3",children:(E=i.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(T.unit_price).toFixed(2)," x ",T.quantity]})]}),T.artwork_url&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),r.jsx("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),r.jsx("div",{className:"mt-3 pt-3 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),r.jsx(Ft,{variant:T.proof_status==="approved"?"default":"secondary",children:T.proof_status||"No proof yet"})]}),T.proof_url?r.jsx("a",{href:T.proof_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Proof"}):r.jsxs("div",{children:[r.jsx("input",{type:"file",accept:"image/*,.pdf",onChange:O=>S(O,T.id),className:"hidden",id:`proof-${T.id}`,disabled:x}),r.jsx("label",{htmlFor:`proof-${T.id}`,children:r.jsx(J,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(go,{className:"h-4 w-4 mr-1"}),x?"Uploading...":"Upload Proof"]})})})]})]})})]},T.id))})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(i.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(i.shipping_total).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between font-bold text-lg mt-2",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(i.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Update Order Status"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Status"}),r.jsxs(bn,{value:h.status,onValueChange:T=>p({...h,status:T}),children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsx(_n,{children:WGt.map(T=>r.jsx(Kt,{value:T,children:DS[T]},T))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Tracking Number"}),r.jsx(ct,{value:h.trackingNumber,onChange:T=>p({...h,trackingNumber:T.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Tracking URL"}),r.jsx(ct,{value:h.trackingUrl,onChange:T=>p({...h,trackingUrl:T.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Notes (optional)"}),r.jsx(ms,{value:h.notes,onChange:T=>p({...h,notes:T.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(J,{onClick:j,disabled:n.isPending,className:"w-full",children:[r.jsx(Ol,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),i.status_history&&i.status_history.length>0&&r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Status History"}),r.jsx("div",{className:"space-y-2",children:i.status_history.map(T=>r.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[r.jsxs("div",{children:[r.jsx(Ft,{variant:"outline",children:DS[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:fn(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function KGt(){const[e,t]=P.useState("products"),n=ns();return r.jsx(Or,{title:"Marketplace Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Marketplace Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage products, categories, and orders"})]}),r.jsxs(J,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(ba,{value:e,onValueChange:t,children:[r.jsxs(fa,{className:"grid w-full grid-cols-3",children:[r.jsxs(ln,{value:"products",className:"flex items-center gap-2",children:[r.jsx(Ol,{className:"h-4 w-4"}),"Products"]}),r.jsxs(ln,{value:"categories",className:"flex items-center gap-2",children:[r.jsx($x,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(ln,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(dh,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(An,{value:"products",children:r.jsx(HGt,{})}),r.jsx(An,{value:"categories",children:r.jsx(VGt,{})}),r.jsx(An,{value:"orders",children:r.jsx(GGt,{})})]})]})})}function tUe(){return Jt({queryKey:["reward-categories"],queryFn:async()=>{const{data:e,error:t}=await ee.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(t)throw t;return e}})}function ZGt(e){return Jt({queryKey:["reward-items",e],queryFn:async()=>{let t=ee.from("reward_store_items").select(` *, category:reward_store_categories(*) `).order("created_at",{ascending:!1});const{data:n,error:s}=await t;if(s)throw s;return n}})}function YGt(e){return Jt({queryKey:["active-reward-items",e],queryFn:async()=>{let t=ee.from("reward_store_items").select(` *, category:reward_store_categories(*) `).eq("is_active",!0).order("created_at",{ascending:!1});e&&(t=t.eq("category_id",e));const{data:n,error:s}=await t;if(s)throw s;return n}})}function XGt(e){return Jt({queryKey:["user-purchases",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await ee.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",e).order("purchased_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function QGt(){return Jt({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:e,error:t}=await ee.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).order("purchased_at",{ascending:!1});if(t)throw t;if(!e||e.length===0)return[];const n=[...new Set(e.map(l=>l.user_id))],{data:s,error:i}=await ee.from("profiles").select("id, name, email").in("id",n);if(i)throw i;const o=new Map((s==null?void 0:s.map(l=>[l.id,l]))||[]);return e.map(l=>({...l,user:o.get(l.user_id)||null}))}})}function JGt(e){return Jt({queryKey:["spendable-points",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:n}=await ee.from("agent_attendance_stats").select("spendable_points").eq("user_id",e).single();if(n&&n.code!=="PGRST116")throw n;return(t==null?void 0:t.spendable_points)||0},enabled:!!e})}function eKt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.rpc("purchase_reward_item",{p_item_id:t});if(s)throw s;const i=n;if(!i.success)throw new Error(i.error||"Purchase failed");return i},onSuccess:()=>{e.invalidateQueries({queryKey:["user-purchases"]}),e.invalidateQueries({queryKey:["spendable-points"]}),e.invalidateQueries({queryKey:["active-reward-items"]}),e.invalidateQueries({queryKey:["reward-items"]})}})}function tKt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("reward_store_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function rKt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("reward_store_categories").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function nKt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("reward_store_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function sKt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await ee.from("reward_store_items").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function iKt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await ee.from("reward_store_items").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function aKt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await ee.from("reward_store_items").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function oKt(e){const t=e.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return t?{bucket:t[1],path:t[2]}:null}async function hde(e,t){const n=oKt(e);if(n)try{const{data:s,error:i}=await ee.storage.from(n.bucket).download(n.path);if(i){console.error("Error downloading file:",i),ze.error("Failed to download file");return}const o=URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=t||n.path.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("Download error:",s),ze.error("Failed to download file")}else try{const i=await(await fetch(e)).blob(),o=URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=t||e.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("External download error:",s),ze.error("Failed to download file")}}function rUe(){return Jt({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:e,error:t}=await ee.from("point_reward_settings").select("*").order("action_name");if(t)throw t;return e}})}function lKt(){const e=Wr();return cr({mutationFn:async({id:t,points:n,is_active:s})=>{const i={points:n};s!==void 0&&(i.is_active=s);const{data:o,error:l}=await ee.from("point_reward_settings").update(i).eq("id",t).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["point-reward-settings"]})}})}function cKt(){const{user:e}=zr(),[t,n]=P.useState("items"),[s,i]=P.useState(!1),[o,l]=P.useState(null),[a,h]=P.useState(""),[p,x]=P.useState(""),[y,w]=P.useState(""),[j,S]=P.useState(null),[C,A]=P.useState(!1),[E,T]=P.useState(null),[O,z]=P.useState(""),[F,q]=P.useState(""),[H,K]=P.useState(null),[Z,re]=P.useState(""),[ue,he]=P.useState("file"),[be,ne]=P.useState(""),[ye,ie]=P.useState(""),[fe,de]=P.useState(""),[_e,Ee]=P.useState(!0),[ke,pe]=P.useState(null),[ae,ge]=P.useState(!1),[Me,Ue]=P.useState(!1),Ie=P.useRef(null),Ke=P.useRef(null),{data:Re,isLoading:Ce}=tUe(),{data:Je,isLoading:Te}=ZGt(),{data:Ye,isLoading:xe}=QGt(),{data:mt,isLoading:et}=rUe(),nt=tKt(),Ae=rKt(),pt=nKt(),Be=sKt(),Qe=iKt(),tt=aKt(),ht=lKt(),[wt,Ct]=P.useState({}),It=fr=>{fr?(l(fr),h(fr.name),x(fr.description||""),w(fr.icon||"")):(l(null),h(""),x(""),w("")),i(!0)},jt=async()=>{if(!a.trim()){ze.error("Please enter a category name");return}try{o?(await Ae.mutateAsync({id:o.id,name:a,description:p||null,icon:y||null}),ze.success("Category updated successfully")):(await nt.mutateAsync({name:a,description:p||null,icon:y||null,sort_order:((Re==null?void 0:Re.length)||0)+1}),ze.success("Category created successfully")),i(!1)}catch(fr){console.error("Error saving category:",fr),ze.error("Failed to save category")}},rr=async()=>{if(j)try{await pt.mutateAsync(j),ze.success("Category deleted successfully"),S(null)}catch(fr){console.error("Error deleting category:",fr),ze.error("Failed to delete category")}},Ar=fr=>{var xs;fr?(T(fr),z(fr.name),q(fr.description||""),K(fr.category_id),re(fr.points_cost.toString()),he(fr.item_type),ne(fr.file_url||""),ie(fr.preview_image_url||""),de(((xs=fr.max_quantity)==null?void 0:xs.toString())||""),Ee(fr.is_active)):(T(null),z(""),q(""),K(null),re(""),he("file"),ne(""),ie(""),de(""),Ee(!0)),A(!0)},gn=async(fr,xs)=>{xs==="file"?ge(!0):Ue(!0);try{const bi=fr.name.split(".").pop(),mi=`${Date.now()}-${Math.random().toString(36).substring(7)}.${bi}`,La=`${xs==="file"?"items":"previews"}/${mi}`,{error:da}=await ee.storage.from("reward-store").upload(La,fr);if(da)throw da;const{data:{publicUrl:tl}}=ee.storage.from("reward-store").getPublicUrl(La);xs==="file"?ne(tl):ie(tl),ze.success("File uploaded successfully")}catch(bi){console.error("Error uploading file:",bi),ze.error("Failed to upload file")}finally{xs==="file"?ge(!1):Ue(!1)}},kn=async()=>{if(!O.trim()){ze.error("Please enter an item name");return}if(!Z||parseInt(Z)<0){ze.error("Please enter a valid points cost");return}try{const fr={name:O,description:F||null,category_id:H,points_cost:parseInt(Z),item_type:ue,file_url:be||null,preview_image_url:ye||null,max_quantity:fe?parseInt(fe):null,current_quantity:fe?parseInt(fe):null,is_active:_e,created_by:e==null?void 0:e.id};E?(await Qe.mutateAsync({id:E.id,...fr,current_quantity:E.max_quantity!==(fe?parseInt(fe):null)?fe?parseInt(fe):null:E.current_quantity}),ze.success("Item updated successfully")):(await Be.mutateAsync(fr),ze.success("Item created successfully")),A(!1)}catch(fr){console.error("Error saving item:",fr),ze.error("Failed to save item")}},Jr=async()=>{if(ke)try{await tt.mutateAsync(ke),ze.success("Item deleted successfully"),pe(null)}catch(fr){console.error("Error deleting item:",fr),ze.error("Failed to delete item")}},zn=async(fr,xs)=>{const bi=wt[fr];if(bi===void 0||bi===xs.toString())return;const mi=parseInt(bi);if(isNaN(mi)||mi<0){ze.error("Please enter a valid positive number");return}try{await ht.mutateAsync({id:fr,points:mi}),ze.success("Points updated successfully"),Ct(La=>{const da={...La};return delete da[fr],da})}catch(La){console.error("Error updating points:",La),ze.error("Failed to update points")}};return Ce||Te||xe||et?r.jsx(Or,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx(Pr,{className:"h-96"})]})}):r.jsxs(Or,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Reward Store Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage store items that agents can purchase with their points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ol,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Items"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Je==null?void 0:Je.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(Je==null?void 0:Je.filter(fr=>fr.is_active).length)||0," active"]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($x,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Re==null?void 0:Re.length)||0})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(vs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg. Cost"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[Je&&Je.length>0?Math.round(Je.reduce((fr,xs)=>fr+xs.points_cost,0)/Je.length):0," pts"]})]})})]}),r.jsxs(ba,{value:t,onValueChange:n,children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"items",children:"Items"}),r.jsx(ln,{value:"categories",children:"Categories"}),r.jsx(ln,{value:"purchases",children:"Purchases"}),r.jsx(ln,{value:"point-settings",children:"Point Settings"})]}),r.jsx(An,{value:"items",className:"mt-4",children:r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Store Items"}),r.jsx(En,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(J,{onClick:()=>Ar(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(Xe,{children:!Je||Je.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Va,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No items yet. Add your first reward item!"})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Item"}),r.jsx(Et,{children:"Category"}),r.jsx(Et,{className:"text-center",children:"Cost"}),r.jsx(Et,{className:"text-center",children:"Type"}),r.jsx(Et,{className:"text-center",children:"Quantity"}),r.jsx(Et,{className:"text-center",children:"Status"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:Je.map(fr=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[fr.preview_image_url?r.jsx("img",{src:fr.preview_image_url,alt:fr.name,className:"h-10 w-10 rounded object-cover"}):r.jsx("div",{className:"h-10 w-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Va,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fr.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:fr.description||"No description"})]})]})}),r.jsx(vt,{children:fr.category?r.jsx(Ft,{variant:"outline",children:fr.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(vt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),fr.points_cost]})}),r.jsx(vt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[fr.item_type==="file"?r.jsx(Ai,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(So,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:fr.item_type})]})}),r.jsx(vt,{className:"text-center",children:fr.max_quantity!==null?r.jsxs("span",{className:fr.current_quantity===0?"text-red-500":"",children:[fr.current_quantity,"/",fr.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(vt,{className:"text-center",children:r.jsx(Ft,{variant:fr.is_active?"default":"secondary",children:fr.is_active?"Active":"Inactive"})}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Ar(fr),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>pe(fr.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},fr.id))})]})})]})}),r.jsx(An,{value:"categories",className:"mt-4",children:r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Categories"}),r.jsx(En,{children:"Organize your store items into categories"})]}),r.jsxs(J,{onClick:()=>It(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Xe,{children:!Re||Re.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx($x,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Name"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{className:"text-center",children:"Items"}),r.jsx(Et,{className:"text-right",children:"Actions"})]})}),r.jsx(Hs,{children:Re.map(fr=>r.jsxs(Ir,{children:[r.jsxs(vt,{className:"font-medium",children:[fr.icon&&r.jsx("span",{className:"mr-2",children:fr.icon}),fr.name]}),r.jsx(vt,{className:"text-muted-foreground",children:fr.description||"—"}),r.jsx(vt,{className:"text-center",children:(Je==null?void 0:Je.filter(xs=>xs.category_id===fr.id).length)||0}),r.jsx(vt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>It(fr),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(J,{variant:"ghost",size:"sm",onClick:()=>S(fr.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},fr.id))})]})})]})}),r.jsx(An,{value:"purchases",className:"mt-4",children:r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(dh,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(En,{children:"View all reward redemptions by agents"})]}),r.jsx(Xe,{children:!Ye||Ye.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(dh,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Date"}),r.jsx(Et,{children:"Agent"}),r.jsx(Et,{children:"Item"}),r.jsx(Et,{className:"text-center",children:"Points Spent"})]})}),r.jsx(Hs,{children:Ye.map(fr=>{var xs,bi,mi,La;return r.jsxs(Ir,{children:[r.jsx(vt,{className:"text-muted-foreground",children:fn(new Date(fr.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center",children:r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((xs=fr.user)==null?void 0:xs.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((bi=fr.user)==null?void 0:bi.email)||"—"})]})]})}),r.jsx(vt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(mi=fr.item)!=null&&mi.preview_image_url?r.jsx("img",{src:fr.item.preview_image_url,alt:fr.item.name,className:"h-8 w-8 rounded object-cover"}):r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center",children:r.jsx(Va,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((La=fr.item)==null?void 0:La.name)||"Deleted item"})]})}),r.jsx(vt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),fr.points_spent]})})]},fr.id)})})]})})]})})]})]}),r.jsx(Br,{open:s,onOpenChange:i,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:o?"Edit Category":"Add Category"}),r.jsx(es,{children:o?"Update the category details":"Create a new category for your store items"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"categoryName",children:"Name"}),r.jsx(ct,{id:"categoryName",value:a,onChange:fr=>h(fr.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(ms,{id:"categoryDescription",value:p,onChange:fr=>x(fr.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(ct,{id:"categoryIcon",value:y,onChange:fr=>w(fr.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(J,{onClick:jt,disabled:nt.isPending||Ae.isPending,children:nt.isPending||Ae.isPending?"Saving...":"Save"})]})]})}),r.jsx(Br,{open:C,onOpenChange:A,children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:E?"Edit Item":"Add Item"}),r.jsx(es,{children:E?"Update the item details":"Create a new reward item for agents to purchase"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"itemName",children:"Name *"}),r.jsx(ct,{id:"itemName",value:O,onChange:fr=>z(fr.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"itemDescription",children:"Description"}),r.jsx(ms,{id:"itemDescription",value:F,onChange:fr=>q(fr.target.value),placeholder:"Describe the item..."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(bn,{value:H||"none",onValueChange:fr=>K(fr==="none"?null:fr),children:[r.jsx(vn,{children:r.jsx(wn,{placeholder:"Select category"})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"none",children:"No category"}),Re==null?void 0:Re.map(fr=>r.jsxs(Kt,{value:fr.id,children:[fr.icon&&`${fr.icon} `,fr.name]},fr.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(ct,{id:"itemPointsCost",type:"number",min:"0",value:Z,onChange:fr=>re(fr.target.value),placeholder:"e.g., 100"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"itemType",children:"Type"}),r.jsxs(bn,{value:ue,onValueChange:he,children:[r.jsx(vn,{children:r.jsx(wn,{})}),r.jsxs(_n,{children:[r.jsx(Kt,{value:"file",children:"File Download"}),r.jsx(Kt,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(ct,{id:"itemMaxQuantity",type:"number",min:"1",value:fe,onChange:fr=>de(fr.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:be,onChange:fr=>ne(fr.target.value),placeholder:ue==="file"?"Upload a file or paste URL":"Paste external link"}),ue==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(J,{type:"button",variant:"outline",size:"icon",onClick:()=>{var fr;return(fr=Ie.current)==null?void 0:fr.click()},disabled:ae,children:r.jsx(go,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ie,type:"file",className:"hidden",onChange:fr=>{var bi;const xs=(bi=fr.target.files)==null?void 0:bi[0];xs&&gn(xs,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ct,{value:ye,onChange:fr=>ie(fr.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(J,{type:"button",variant:"outline",size:"icon",onClick:()=>{var fr;return(fr=Ke.current)==null?void 0:fr.click()},disabled:Me,children:r.jsx(Zo,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ke,type:"file",accept:"image/*",className:"hidden",onChange:fr=>{var bi;const xs=(bi=fr.target.files)==null?void 0:bi[0];xs&&gn(xs,"preview")}})]}),ye&&r.jsx("img",{src:ye,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($s,{id:"itemIsActive",checked:_e,onCheckedChange:Ee}),r.jsx(Ve,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),r.jsx(J,{onClick:kn,disabled:Be.isPending||Qe.isPending,children:Be.isPending||Qe.isPending?"Saving...":"Save"})]})]})}),r.jsx(uh,{open:!!j,onOpenChange:()=>S(null),children:r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Delete Category"}),r.jsx(Su,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:rr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(uh,{open:!!ke,onOpenChange:()=>pe(null),children:r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Delete Item"}),r.jsx(Su,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:Jr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t==="point-settings"&&r.jsxs(We,{className:"mt-4",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hd,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Xt,{children:"Point Reward Settings"}),r.jsx(En,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(Xe,{children:!mt||mt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(hd,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(qs,{children:[r.jsx(Vs,{children:r.jsxs(Ir,{children:[r.jsx(Et,{children:"Action"}),r.jsx(Et,{children:"Description"}),r.jsx(Et,{className:"text-center w-32",children:"Points"}),r.jsx(Et,{className:"text-right w-24",children:"Save"})]})}),r.jsx(Hs,{children:mt.map(fr=>r.jsxs(Ir,{children:[r.jsx(vt,{children:r.jsx("p",{className:"font-medium",children:fr.action_name})}),r.jsx(vt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:fr.description})}),r.jsx(vt,{className:"text-center",children:r.jsx(ct,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:wt[fr.id]??fr.points.toString(),onChange:xs=>Ct(bi=>({...bi,[fr.id]:xs.target.value}))})}),r.jsx(vt,{className:"text-right",children:r.jsx(J,{size:"sm",variant:"outline",disabled:wt[fr.id]===void 0||wt[fr.id]===fr.points.toString()||ht.isPending,onClick:()=>zn(fr.id,fr.points),children:r.jsx(bg,{className:"h-4 w-4"})})})]},fr.id))})]})})]})]})}function dKt(){const e=Wr(),[t,n]=P.useState(!1),{data:s,isLoading:i}=Jt({queryKey:["social-accounts"],queryFn:async()=>{const{data:p,error:x}=await ee.from("social_accounts").select("*").order("created_at",{ascending:!1});if(x)throw x;return p}}),o=cr({mutationFn:async p=>{const{error:x}=await ee.from("social_accounts").delete().eq("id",p);if(x)throw x},onSuccess:()=>{e.invalidateQueries({queryKey:["social-accounts"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),l=async()=>{n(!0);try{const{data:p,error:x}=await ee.functions.invoke("meta-oauth",{body:{action:"get_auth_url"}});if(x)throw x;if(p!=null&&p.authUrl)window.location.href=p.authUrl;else throw new Error("Failed to get authorization URL")}catch(p){console.error("Meta OAuth error:",p),ze.error("Failed to start connection. Make sure Meta App credentials are configured."),n(!1)}},a=(s==null?void 0:s.filter(p=>p.platform==="facebook"))||[],h=(s==null?void 0:s.filter(p=>p.platform==="instagram"))||[];return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx($u,{title:"Integrations",description:"Connect your social media accounts to post directly from the dashboard"}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-2",children:r.jsx(Pd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Facebook"}),r.jsx(En,{children:"Connect Facebook Pages to post content"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[a.length>0?r.jsx("div",{className:"space-y-3",children:a.map(p=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:p.profile_picture_url||""}),r.jsx(di,{children:r.jsx(Pd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:p.page_name||p.platform_username||"Facebook Page"}),r.jsx(Ft,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Disconnect Facebook?"}),r.jsx(Su,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Facebook accounts connected"}),r.jsxs(J,{onClick:l,disabled:t,className:"w-full gap-2",variant:"outline",children:[t?r.jsx(ql,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-2",children:r.jsx(eu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Instagram"}),r.jsx(En,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[h.length>0?r.jsx("div",{className:"space-y-3",children:h.map(p=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:p.profile_picture_url||""}),r.jsx(di,{children:r.jsx(eu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",p.platform_username||"Instagram Account"]}),r.jsx(Ft,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Disconnect Instagram?"}),r.jsx(Su,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Instagram accounts connected"}),r.jsxs(J,{onClick:l,disabled:t,className:"w-full gap-2",variant:"outline",children:[t?r.jsx(ql,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),"Connect Instagram Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Instagram Business accounts must be connected to a Facebook Page"})]})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{className:"text-lg",children:"Setup Instructions"}),r.jsx(En,{children:"Follow these steps to set up Meta integration"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Create a Meta App"}),r.jsx("p",{className:"text-muted-foreground",children:"Go to developers.facebook.com and create a new app"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Add Facebook Login Product"}),r.jsx("p",{className:"text-muted-foreground",children:"Enable Facebook Login and configure OAuth redirect URLs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Configure API Keys"}),r.jsx("p",{className:"text-muted-foreground",children:"Add META_APP_ID and META_APP_SECRET to your environment"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"4"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Request Permissions"}),r.jsx("p",{className:"text-muted-foreground",children:"Request pages_manage_posts, pages_read_engagement, instagram_basic, and instagram_content_publish"})]})]})]}),r.jsx(J,{variant:"outline",className:"gap-2",asChild:!0,children:r.jsxs("a",{href:"https://developers.facebook.com/apps",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ls,{className:"h-4 w-4"}),"Open Meta Developer Console"]})})]})]})]})})}const uKt={new_events:{label:"New Events",icon:"📅"},new_templates:{label:"New Templates",icon:"📄"},new_toolbox:{label:"New Toolbox Resources",icon:"🧰"},new_social_swag:{label:"New Social Swag",icon:"🎨"},new_newsletters:{label:"New Newsletters",icon:"📰"},new_community_posts:{label:"New Community Posts",icon:"💬"}};function eT(e,t=18,n=10){return e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`}function hKt(){var ue,he,be,ne,ye;const e=Wr(),[t,n]=P.useState("Test Push"),[s,i]=P.useState("Testing web push notification"),[o,l]=P.useState("/community"),[a,h]=P.useState(!1),[p,x]=P.useState(!1),[y,w]=P.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[j,S]=P.useState(null),[C,A]=P.useState(null),{data:E,isLoading:T}=Jt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:ie,error:fe}=await ee.from("push_notification_settings").select("*").order("setting_key");if(fe)throw fe;return ie}}),{data:O,isLoading:z}=Jt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:ie,error:fe}=await ee.from("push_subscriptions").select("*",{count:"exact",head:!0});if(fe)throw fe;return{totalSubscriptions:ie||0}}}),F=cr({mutationFn:async({settingKey:ie,isEnabled:fe})=>{const{error:de}=await ee.from("push_notification_settings").update({is_enabled:fe}).eq("setting_key",ie);if(de)throw de},onSuccess:()=>{e.invalidateQueries({queryKey:["push-notification-settings"]}),ze.success("Notification setting updated")},onError:ie=>{ze.error("Failed to update setting: "+ie.message)}}),q=P.useMemo(()=>{var ie,fe;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((ie=y.serviceWorker)==null?void 0:ie.activeState)??"unknown"} · sub=${(fe=y.subscription)!=null&&fe.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);P.useEffect(()=>{let ie=!0;const fe=async()=>{var ke,pe,ae,ge,Me,Ue,Ie;const _e="serviceWorker"in navigator&&"PushManager"in window,Ee={isSupported:_e,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((ke=navigator.serviceWorker)!=null&&ke.controller)};if(!_e){ie&&w(Ee);return}try{const{data:Ke,error:Re}=await ee.functions.invoke("get-vapid-public-key",{body:{}});if(Re)throw Re;Ee.vapidPublicKey=Ke==null?void 0:Ke.vapidPublicKey;const Je=(await navigator.serviceWorker.getRegistrations()).find(Te=>{var xe,mt,et;return(((xe=Te.active)==null?void 0:xe.scriptURL)||((mt=Te.waiting)==null?void 0:mt.scriptURL)||((et=Te.installing)==null?void 0:et.scriptURL)||"").includes("/sw.js")});if(Je){Ee.pushWorkerScriptUrl=((pe=Je.active)==null?void 0:pe.scriptURL)||((ae=Je.waiting)==null?void 0:ae.scriptURL)||((ge=Je.installing)==null?void 0:ge.scriptURL),Ee.serviceWorker={scope:Je.scope,activeState:(Me=Je.active)==null?void 0:Me.state};const Te=await Je.pushManager.getSubscription();if(Te){const Ye=Te.toJSON();Ee.subscription={endpoint:Ye.endpoint,p256dh:(Ue=Ye.keys)==null?void 0:Ue.p256dh,auth:(Ie=Ye.keys)==null?void 0:Ie.auth}}}}catch(Ke){Ee.error=(Ke==null?void 0:Ke.message)||String(Ke)}ie&&w(Ee)};fe();const de=window.setInterval(fe,4e3);return()=>{ie=!1,window.clearInterval(de)}},[]);const H=async()=>{if(typeof Notification>"u"){ze.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){ze.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),ze.success("Triggered a local notification (not push).")}catch(ie){ze.error(`Local notification failed: ${(ie==null?void 0:ie.message)||String(ie)}`)}},K=async()=>{h(!0),S(null);try{const{data:ie,error:fe}=await ee.functions.invoke("send-push-notification",{body:{title:t,body:s,url:o}});if(fe)throw fe;S({sent:ie==null?void 0:ie.sent,failed:ie==null?void 0:ie.failed,expiredCleaned:ie==null?void 0:ie.expiredCleaned,vapidPublicKey:ie==null?void 0:ie.vapidPublicKey}),(ie==null?void 0:ie.sent)>0?ze.success(`Test notification sent to ${ie.sent} subscriber(s)`):(ie==null?void 0:ie.failed)>0?ze.warning(`Notification failed for ${ie.failed} subscriber(s). ${ie.expired||0} expired subscriptions cleaned up.`):ze.info("No active subscriptions to send to")}catch(ie){console.error("Error sending test notification:",ie),S({error:(ie==null?void 0:ie.message)||String(ie)}),ze.error("Failed to send test notification: "+(ie.message||"Unknown error"))}finally{h(!1)}},Z=async()=>{x(!0),A(null);try{const{data:ie,error:fe}=await ee.functions.invoke("generate-vapid-keys",{body:{}});if(fe)throw fe;const de=ie==null?void 0:ie.publicKey,_e=ie==null?void 0:ie.privateKey;if(!de||!_e)throw new Error("generate-vapid-keys did not return keys");A({publicKey:de,privateKey:_e}),ze.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(ie){console.error("Error generating VAPID keys:",ie),ze.error("Failed to generate VAPID keys: "+((ie==null?void 0:ie.message)||"Unknown error"))}finally{x(!1)}},re=cr({mutationFn:async()=>{const{error:ie}=await ee.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(ie)throw ie},onSuccess:()=>{ze.success("All subscriptions cleared. Users will need to re-enable notifications."),e.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:ie=>{ze.error("Failed to clear subscriptions: "+ie.message)}});return r.jsx(Or,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx($u,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(En,{children:"Current active push notification subscriptions"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:z?"...":(O==null?void 0:O.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(hd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(En,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(Xe,{children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:E==null?void 0:E.map(ie=>{const fe=uKt[ie.setting_key]||{label:ie.setting_key,icon:"🔔"};return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-2xl",children:fe.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:fe.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:ie.description})]})]}),r.jsx($s,{checked:ie.is_enabled,onCheckedChange:de=>F.mutate({settingKey:ie.setting_key,isEnabled:de}),disabled:F.isPending})]},ie.id)})})})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(vg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(En,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Client push debug"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:q}),y.error&&r.jsx("div",{className:"mt-2 text-destructive",children:y.error}),r.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Backend VAPID public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:y.vapidPublicKey?eT(y.vapidPublicKey):"(not loaded)"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Service worker"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["scope: ",(ue=y.serviceWorker)!=null&&ue.scope?eT(y.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((he=y.serviceWorker)==null?void 0:he.activeState)??"none"]})]})]}),r.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Current browser subscription"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["endpoint: ",(be=y.subscription)!=null&&be.endpoint?eT(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ne=y.subscription)!=null&&ne.p256dh?eT(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(ye=y.subscription)!=null&&ye.auth?eT(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(J,{variant:"outline",onClick:H,children:"Local notification test"}),r.jsx(J,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(ct,{id:"test-title",value:t,onChange:ie=>n(ie.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(ms,{id:"test-body",value:s,onChange:ie=>i(ie.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(ct,{id:"test-url",value:o,onChange:ie=>l(ie.target.value),placeholder:"/community or full URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Where users will be taken when they click the notification"})]}),r.jsxs(J,{onClick:K,disabled:a||!t||!s,className:"w-full sm:w-auto",children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Test Notification"]}),j&&r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Last send debug"}),j.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",j.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",j.sent??0," sent, ",j.failed??0," failed, ",j.expiredCleaned??0," expired cleaned"]}),j.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:j.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(We,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Zn,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(En,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(J,{variant:"destructive",onClick:()=>re.mutate(),disabled:re.isPending,children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),re.isPending?"Clearing...":"Clear All Subscriptions"]}),r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:"If you suspect the backend public/private keys don’t match, generate a fresh pair, update backend secrets, then clear subscriptions and have users re-enable push."}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.jsx(J,{variant:"outline",onClick:Z,disabled:p,children:p?"Generating…":"Generate VAPID keys"})}),C&&r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"text-muted-foreground",children:["Copy these into backend secrets ",r.jsx("span",{className:"font-mono",children:"VAPID_PUBLIC_KEY"})," and ",r.jsx("span",{className:"font-mono",children:"VAPID_PRIVATE_KEY"}),"."]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:C.publicKey})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Private key (keep secret)"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:C.privateKey})]})]})]})]})]})]})})}function fKt(){const[e]=Fd(),t=ns(),[n,s]=P.useState("loading"),[i,o]=P.useState("Processing connection...");return P.useEffect(()=>{(async()=>{const a=e.get("code"),h=e.get("error"),p=e.get("error_description"),x=e.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Failed to connect: "+(p||h));return}if(!a){s("error"),o("No authorization code received"),ze.error("Failed to connect: No authorization code");return}try{const{data:y,error:w}=await ee.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:x}});if(w)throw w;if(y!=null&&y.success)s("success"),o(y.message||"Accounts connected successfully!"),ze.success(y.message||"Social accounts connected!");else throw new Error((y==null?void 0:y.error)||"Failed to connect accounts")}catch(y){console.error("Callback error:",y),s("error"),o(y.message||"Failed to complete connection"),ze.error(y.message||"Failed to connect accounts")}})()},[e]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(We,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(nn,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(qa,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(zc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Xt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:r.jsx(J,{onClick:()=>t("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function pKt(){const e=ns(),t=Wr(),{isAdmin:n}=zr(),[s,i]=P.useState(!1),[o,l]=P.useState(null),[a,h]=P.useState(null),{data:p,isLoading:x}=Jt({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:F},error:q}=await ee.auth.getUser();if(q)throw q;if(!F)return[];const{data:H,error:K}=await ee.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(K)throw K;return H}}),y=cr({mutationFn:async F=>{const{data:{user:q},error:H}=await ee.auth.getUser();if(H)throw H;if(!q)throw new Error("Not authenticated");const{error:K}=await ee.from("social_accounts").delete().eq("id",F).eq("user_id",q.id);if(K)throw K},onSuccess:()=>{t.invalidateQueries({queryKey:["my-social-accounts"]}),t.invalidateQueries({queryKey:["social-accounts-for-post"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),w=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Meta OAuth error:",F),ze.error("Failed to start connection. Please try again."),i(!1)}},j=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(F){console.error("LinkedIn OAuth error:",F),ze.error("Failed to start LinkedIn connection. Please try again."),i(!1)}},S=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(F){console.error("Google OAuth error:",F),ze.error("Failed to start Google connection. Please try again."),i(!1)}},C=(p==null?void 0:p.filter(F=>F.platform==="facebook"))||[],A=(p==null?void 0:p.filter(F=>F.platform==="instagram"))||[],E=(p==null?void 0:p.filter(F=>F.platform==="linkedin"))||[],T=(p==null?void 0:p.filter(F=>F.platform==="google_business"))||[],O=((p==null?void 0:p.length)||0)>0,z=async(F,q)=>{l(F),h(null);try{const{data:H,error:K}=await ee.functions.invoke("meta-api-test",{body:{testType:"all",accountId:F}});if(K)throw K;h(H.results||[]),ze.success(H.summary||"API tests completed")}catch(H){console.error("Meta API test error:",H),ze.error("Failed to run API tests")}finally{l(null)}};return r.jsx(Or,{title:"Social Connections",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-pink-500 via-purple-500 to-blue-500 p-6 md:p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs(Ft,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),"Post directly from Social Swag"]})}),r.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-2",children:"Connect Your Social Accounts"}),r.jsx("p",{className:"text-white/90 max-w-xl",children:"Link your Facebook Pages and Instagram Business accounts to post content directly from Social Swag with one click."})]})]}),r.jsxs(J,{variant:"ghost",onClick:()=>e("/social-swag-2"),className:"gap-2",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(We,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:r.jsx(Ki,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Ft,{variant:"secondary",className:"mb-3 bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Social Connections Coming Soon!"}),r.jsx("p",{className:"text-muted-foreground max-w-md",children:"We're putting the finishing touches on this feature. Soon you'll be able to connect your social accounts and post directly from Social Swag with one click."})]})}),n&&r.jsxs(r.Fragment,{children:[O&&r.jsx(We,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(Xe,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(qa,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-200",children:"You're all set!"}),r.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"You can now post directly to your connected accounts from Social Swag."})]})]})}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-3",children:r.jsx(Pd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Facebook"}),r.jsx(En,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ql,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):C.length>0?r.jsx("div",{className:"space-y-3",children:C.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(Pd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Facebook Page"}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Disconnect Facebook?"}),r.jsx(Su,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(J,{onClick:w,disabled:s,className:"w-full gap-2",variant:C.length>0?"outline":"default",children:[s?r.jsx(ql,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),C.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-3",children:r.jsx(eu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Instagram"}),r.jsx(En,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ql,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length>0?r.jsx("div",{className:"space-y-3",children:A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(eu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",F.platform_username||"Instagram Account"]}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Disconnect Instagram?"}),r.jsx(Su,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(J,{onClick:w,disabled:s,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[s?r.jsx(ql,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),A.length>0?"Connect Another Account":"Connect Instagram"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Instagram Business accounts must be connected to a Facebook Page"})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-600/10 p-3",children:r.jsx(pm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"LinkedIn"}),r.jsx(En,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ql,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):E.length>0?r.jsx("div",{className:"space-y-3",children:E.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(pm,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.platform_username||"LinkedIn Account"}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Disconnect LinkedIn?"}),r.jsx(Su,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(J,{onClick:j,disabled:s,className:"w-full gap-2",variant:E.length>0?"outline":"default",children:[s?r.jsx(ql,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),E.length>0?"Reconnect LinkedIn":"Connect LinkedIn"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Share content directly to your LinkedIn profile"})]})]}),r.jsxs(We,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Ft,{variant:"secondary",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"})}),n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Ft,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-red-500/10 p-3",children:r.jsx(pl,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Google Business"}),r.jsx(En,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(ql,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Wa,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(pl,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Google Business"}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(uh,{children:[r.jsx(V0,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Disconnect Google Business?"}),r.jsx(Su,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:n?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),r.jsxs(J,{onClick:n?S:void 0,disabled:!n||s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(ql,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),T.length>0?"Reconnect Google Business":"Connect Google Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Post updates directly to your Google Business Profile"})]})]})]}),n&&(C.length>0||A.length>0)&&r.jsxs(We,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-amber-500/10 p-3",children:r.jsx(hj,{className:"h-6 w-6 text-amber-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),r.jsx(En,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',r.jsx("strong",{children:"public_profile"}),", ",r.jsx("strong",{children:"pages_show_list"}),", ",r.jsx("strong",{children:"pages_read_engagement"}),", ",r.jsx("strong",{children:"instagram_basic"}),", ",r.jsx("strong",{children:"pages_manage_posts"}),", and ",r.jsx("strong",{children:"instagram_content_publish"}),"."]}),r.jsxs("div",{className:"space-y-3",children:[C.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Pd,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:F.page_name||"Facebook Page"})]}),r.jsx(J,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(hj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${F.id}`)),A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(eu,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",F.platform_username||"Instagram"]})]}),r.jsx(J,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(hj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${F.id}`))]}),a&&a.length>0&&r.jsxs("div",{className:"mt-4 rounded-lg border bg-background p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Test Results"}),r.jsx("div",{className:"space-y-2",children:a.map((F,q)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[F.status==="success"?r.jsx(Za,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):F.status==="pending"?r.jsx(nn,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(zc,{className:"h-4 w-4 text-red-600 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-mono text-xs bg-muted px-1 rounded",children:F.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:F.details})]})]},q))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Facebook posts are auto-deleted. Instagram posts will remain and should be manually deleted. Allow up to 24 hours for Meta to register the API calls."})]})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"How it works"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Connect your accounts"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link your Facebook, Instagram, or LinkedIn account"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Browse Social Swag"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Find the perfect image and caption for your post"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Post with one click"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:'Click "Create Post" to share directly to your accounts'})]})]})]})})]})]})]})})}function mKt(){const[e]=Fd(),t=ns(),[n,s]=P.useState("loading"),[i,o]=P.useState("Processing your connection...");return P.useEffect(()=>{(async()=>{var y;const a=e.get("code"),h=e.get("error"),p=e.get("error_description"),x=e.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!a){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:w,error:j}=await ee.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:x,callbackPath:"/social-connections/callback"}});if(j)throw j;if(w!=null&&w.success)s("success"),o(`Successfully connected ${((y=w.accounts)==null?void 0:y.length)||0} account(s)!`),ze.success("Social accounts connected successfully!");else throw new Error((w==null?void 0:w.error)||"Unknown error")}catch(w){console.error("OAuth callback error:",w),s("error"),o(w instanceof Error?w.message:"Failed to connect accounts"),ze.error("Failed to connect: "+(w instanceof Error?w.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(We,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(nn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(qa,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(zc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Xt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:n!=="loading"&&r.jsx(J,{onClick:()=>t("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function gKt(){const[e]=Fd(),t=ns(),[n,s]=P.useState("loading"),[i,o]=P.useState("Connecting your Google Business Profile...");return P.useEffect(()=>{(async()=>{const a=e.get("code"),h=e.get("error"),p=e.get("error_description"),x=e.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!a){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:y,error:w}=await ee.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:a,state:x}});if(w)throw w;if(y!=null&&y.success)s("success"),o(y.message||"Successfully connected Google Business Profile!"),ze.success("Google Business Profile connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Google OAuth callback error:",y),s("error"),o(y instanceof Error?y.message:"Failed to connect Google Business Profile"),ze.error("Failed to connect: "+(y instanceof Error?y.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(We,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(nn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(qa,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(zc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Xt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:n!=="loading"&&r.jsx(J,{onClick:()=>t("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function xKt(){const[e]=Fd(),t=ns(),[n,s]=P.useState("loading"),[i,o]=P.useState("Connecting your LinkedIn account...");return P.useEffect(()=>{(async()=>{var y;const a=e.get("code"),h=e.get("state"),p=e.get("error"),x=e.get("error_description");if(p){console.error("LinkedIn OAuth error:",p,x),s("error"),o(x||"Failed to connect LinkedIn account"),ze.error(x||"Failed to connect LinkedIn");return}if(!a){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:w,error:j}=await ee.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:a,state:h,callbackPath:"/social-connections/linkedin-callback"}});if(j)throw j;if(w!=null&&w.success)s("success"),o(`Successfully connected ${((y=w.accounts)==null?void 0:y.length)||1} LinkedIn account`),ze.success("LinkedIn connected successfully!");else throw new Error((w==null?void 0:w.error)||"Failed to connect LinkedIn account")}catch(w){console.error("LinkedIn callback error:",w),s("error"),o(w instanceof Error?w.message:"Failed to connect LinkedIn account"),ze.error("Failed to connect LinkedIn")}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:r.jsxs(We,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[n==="loading"&&r.jsx(nn,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(qa,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(zc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Xt,{className:"flex items-center justify-center gap-2",children:[r.jsx(pm,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:r.jsx(J,{onClick:()=>t("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function yKt(){const e=ns(),[t,n]=P.useState(null),{data:s,isLoading:i}=eUe(t||void 0,!0),{data:o,isLoading:l}=L0e(!0),{cartItems:a}=_se(),h=a.reduce((x,y)=>x+y.quantity,0),p=x=>{e(`/marketplace/${x.id}`)};return i||l?r.jsx(Or,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[1,2,3].map(x=>r.jsx(Pr,{className:"h-10 w-24 flex-shrink-0"},x))}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[1,2,3,4].map(x=>r.jsx(Pr,{className:"h-72 w-full"},x))})]})}):r.jsx(Or,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Marketplace"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Shop exclusive products for LevelUp members"})]}),r.jsxs(J,{variant:"outline",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(dh,{className:"h-4 w-4 mr-2"}),"Cart",h>0&&r.jsx(Ft,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:h})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(J,{variant:t===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(J,{variant:t===x.id?"default":"outline",size:"sm",onClick:()=>n(x.id),children:x.name},x.id))]}),s&&s.length>0?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(x=>{var y;return r.jsxs(We,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>p(x),children:[r.jsxs("div",{className:"aspect-square bg-muted relative",children:[x.images&&x.images.length>0?r.jsx("img",{src:((y=x.images.find(w=>w.is_primary))==null?void 0:y.image_url)||x.images[0].image_url,alt:x.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Ol,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(Ft,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:x.name}),x.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:x.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(x.base_price).toFixed(2)]}),x.variants&&x.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.variants.length," options"]})]})]})]},x.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No products available yet."})]})]})})}const nUe=P.forwardRef(({...e},t)=>r.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));nUe.displayName="Breadcrumb";const sUe=P.forwardRef(({className:e,...t},n)=>r.jsx("ol",{ref:n,className:$t("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));sUe.displayName="BreadcrumbList";const gee=P.forwardRef(({className:e,...t},n)=>r.jsx("li",{ref:n,className:$t("inline-flex items-center gap-1.5",e),...t}));gee.displayName="BreadcrumbItem";const Upe=P.forwardRef(({asChild:e,className:t,...n},s)=>{const i=e?$me:"a";return r.jsx(i,{ref:s,className:$t("transition-colors hover:text-foreground",t),...n})});Upe.displayName="BreadcrumbLink";const iUe=P.forwardRef(({className:e,...t},n)=>r.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:$t("font-normal text-foreground",e),...t}));iUe.displayName="BreadcrumbPage";const qpe=({children:e,className:t,...n})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:$t("[&>svg]:size-3.5",t),...n,children:e??r.jsx(Ga,{})});qpe.displayName="BreadcrumbSeparator";function vKt(){var be,ne;const{productId:e}=Wc(),t=ns(),{data:n,isLoading:s}=CGt(e||""),{addToCart:i,cartItems:o}=_se(),[l,a]=P.useState(null),[h,p]=P.useState(1),[x,y]=P.useState(0),[w,j]=P.useState(null),[S,C]=P.useState(!1),[A,E]=P.useState(!1),T=(be=n==null?void 0:n.variants)==null?void 0:be.find(ye=>ye.id===l),O=((ne=n==null?void 0:n.variants)==null?void 0:ne.filter(ye=>ye.is_active))||[],z=Number((n==null?void 0:n.base_price)||0),F=T?Number(T.price_adjustment):0,q=z+F,H=Number((n==null?void 0:n.shipping_fee)||0),K=o.reduce((ye,ie)=>ye+ie.quantity,0),Z=async ye=>{if(!ye.target.files||ye.target.files.length===0)return;C(!0);const ie=ye.target.files[0],fe=ie.name.split(".").pop(),de=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${fe}`;try{const{error:_e}=await ee.storage.from("marketplace").upload(de,ie);if(_e)throw _e;const{data:{publicUrl:Ee}}=ee.storage.from("marketplace").getPublicUrl(de);j(Ee),ze.success("Artwork uploaded successfully")}catch(_e){ze.error("Failed to upload artwork: "+_e.message)}finally{C(!1)}},re=()=>{if(n){if(O.length>0&&!l){ze.error("Please select an option");return}i(n,T||void 0,h,w||void 0),E(!0),ze.success("Added to cart!"),setTimeout(()=>E(!1),2e3)}},ue=()=>{n!=null&&n.images&&y(ye=>(ye+1)%n.images.length)},he=()=>{n!=null&&n.images&&y(ye=>(ye-1+n.images.length)%n.images.length)};return s?r.jsx(Or,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Pr,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Pr,{className:"h-8 w-3/4"}),r.jsx(Pr,{className:"h-6 w-1/4"}),r.jsx(Pr,{className:"h-24 w-full"}),r.jsx(Pr,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Or,{title:n.name,children:[r.jsx(nUe,{className:"mb-6",children:r.jsxs(sUe,{children:[r.jsx(gee,{children:r.jsx(Upe,{asChild:!0,children:r.jsx(co,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(qpe,{}),r.jsx(gee,{children:r.jsx(Upe,{asChild:!0,children:r.jsx(co,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(qpe,{}),r.jsx(gee,{children:r.jsx(iUe,{children:n.name})})]})}),r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative aspect-square bg-muted rounded-lg overflow-hidden flex items-center justify-center",children:n.images&&n.images.length>0?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:n.images[x].image_url,alt:n.name,className:"max-w-full max-h-full object-contain"}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:he,children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx(J,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ue,children:r.jsx(Ga,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Ol,{className:"h-24 w-24 text-muted-foreground"})})}),n.images&&n.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:n.images.map((ye,ie)=>r.jsx("button",{onClick:()=>y(ie),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${ie===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:ye.image_url,alt:"",className:"w-full h-full object-cover"})},ye.id))}),n.video&&r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),r.jsx("div",{className:"aspect-video",children:r.jsx("iframe",{src:n.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[n.category&&r.jsx(Ft,{variant:"secondary",className:"mb-2",children:n.category.name}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:n.name}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-3xl font-bold",children:["$",q.toFixed(2)]}),H>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",H.toFixed(2)," shipping"]})]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})}),O.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:O.map(ye=>r.jsxs(J,{variant:l===ye.id?"default":"outline",onClick:()=>a(ye.id),children:[ye.name,Number(ye.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(ye.price_adjustment)>0?"+":"","$",Number(ye.price_adjustment).toFixed(2),")"]})]},ye.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{children:"Upload Your Artwork (Optional)"}),w?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:w,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(J,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>j(null),children:"×"})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6",children:[r.jsx("input",{type:"file",accept:"image/*,.pdf,.ai,.eps",onChange:Z,className:"hidden",id:"artwork-upload",disabled:S}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(go,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:S?"Uploading...":"Click to upload artwork"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ve,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{variant:"outline",size:"icon",onClick:()=>p(ye=>Math.max(1,ye-1)),children:"-"}),r.jsx(ct,{type:"number",value:h,onChange:ye=>p(Math.max(1,parseInt(ye.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(J,{variant:"outline",size:"icon",onClick:()=>p(ye=>ye+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(J,{size:"lg",className:"flex-1",onClick:re,disabled:A,children:A?r.jsxs(r.Fragment,{children:[r.jsx(Ca,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(dh,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(J,{variant:"outline",size:"lg",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(dh,{className:"h-5 w-5"}),K>0&&r.jsx(Ft,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:K})]})]}),n.requires_proof_approval&&r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-3 rounded-lg",children:"📋 This product requires proof approval before production. You'll receive a proof to review after your order is placed."})]})]})]}):r.jsx(Or,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Product not found"}),r.jsx(J,{onClick:()=>t("/marketplace"),children:"Back to Marketplace"})]})})}function _Kt(){const e=ns(),{cartItems:t,removeFromCart:n,updateQuantity:s,getItemPrice:i,getSubtotal:o,getShippingTotal:l,getTotal:a,clearCart:h}=_se(),[p,x]=P.useState(!1),[y,w]=P.useState(""),j=async()=>{if(t.length===0){ze.error("Your cart is empty");return}x(!0);try{const{data:S,error:C}=await ee.functions.invoke("marketplace-checkout",{body:{items:t.map(A=>{var E;return{product_id:A.product.id,variant_id:((E=A.variant)==null?void 0:E.id)||null,quantity:A.quantity,artwork_url:A.artworkUrl||null}}),notes:y.trim()||null}});if(C)throw C;if(S!=null&&S.url)h(),window.open(S.url,"_blank");else throw new Error("No checkout URL received")}catch(S){ze.error("Checkout failed: "+S.message)}finally{x(!1)}};return t.length===0?r.jsx(Or,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(wg,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your cart is empty"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Add some products to get started!"}),r.jsx(J,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Or,{title:"Shopping Cart",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[t.map(S=>{var C,A;return r.jsx(We,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:S.product.images&&S.product.images.length>0?r.jsx("img",{src:((C=S.product.images.find(E=>E.is_primary))==null?void 0:C.image_url)||S.product.images[0].image_url,alt:S.product.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(wg,{className:"h-8 w-8 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold line-clamp-1",children:S.product.name}),S.variant&&r.jsx("p",{className:"text-sm text-muted-foreground",children:S.variant.name}),r.jsxs("p",{className:"font-medium mt-1",children:["$",i(S).toFixed(2),Number(S.product.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(S.product.shipping_fee).toFixed(2)," shipping"]})]}),S.artworkUrl&&r.jsx("div",{className:"mt-2",children:r.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return n(S.product.id,(E=S.variant)==null?void 0:E.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(S.product.id,(E=S.variant)==null?void 0:E.id,S.quantity-1)},disabled:S.quantity<=1,children:r.jsx(g1,{className:"h-3 w-3"})}),r.jsx(ct,{type:"number",value:S.quantity,onChange:E=>{var T;return s(S.product.id,(T=S.variant)==null?void 0:T.id,parseInt(E.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(S.product.id,(E=S.variant)==null?void 0:E.id,S.quantity+1)},children:r.jsx(jn,{className:"h-3 w-3"})})]})]})]})})},`${S.product.id}-${((A=S.variant)==null?void 0:A.id)||"base"}`)}),r.jsx(J,{variant:"ghost",className:"text-destructive",onClick:h,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(We,{className:"sticky top-4",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Order Summary"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",t.reduce((S,C)=>S+C.quantity,0)," items)"]}),r.jsxs("span",{children:["$",o().toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",l().toFixed(2)]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",a().toFixed(2)]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ve,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(ms,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:S=>w(S.target.value),rows:3,className:"resize-none"})]}),r.jsx(J,{className:"w-full",size:"lg",onClick:j,disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(Ko,{className:"h-5 w-5 ml-2"})]})}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Secure checkout powered by Stripe"})]})]})})]})})}function bKt(){const e=ns(),{data:t,isLoading:n}=FGt();return n?r.jsx(Or,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Pr,{className:"h-32 w-full"},s))})}):!t||t.length===0?r.jsx(Or,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No orders yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Start shopping to see your orders here!"}),r.jsx(J,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Or,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:t.map(s=>{var i,o,l;return r.jsx(We,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>e(`/marketplace/orders/${s.id}`),children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:s.order_number}),r.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:fn(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Ft,{className:P0e[s.status],children:DS[s.status]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex -space-x-2",children:[(i=s.items)==null?void 0:i.slice(0,3).map((a,h)=>r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",style:{zIndex:3-h},children:[a.quantity,"×"]},a.id)),s.items&&s.items.length>3&&r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",children:["+",s.items.length-3]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:((o=s.items)==null?void 0:o.length)===1?s.items[0].product_name:`${(l=s.items)==null?void 0:l.length} items`}),r.jsxs("p",{className:"font-semibold",children:["$",Number(s.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.tracking_url&&r.jsxs(J,{variant:"outline",size:"sm",onClick:a=>{a.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Ls,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Ga,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const x5e=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function wKt({currentStatus:e,statusHistory:t}){const n=x5e.indexOf(e);return r.jsx("div",{className:"space-y-3",children:x5e.map((s,i)=>{const o=t==null?void 0:t.find(p=>p.status===s),l=in;return r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`mt-0.5 flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center ${l?"bg-green-500 text-white":a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:l?r.jsx(Za,{className:"h-4 w-4"}):a?r.jsx(Ki,{className:"h-4 w-4"}):r.jsx("span",{className:"text-xs",children:i+1})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`font-medium ${h?"text-muted-foreground":""}`,children:DS[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[fn(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function jKt(){var E;const{orderId:e}=Wc(),t=ns(),{data:n,isLoading:s,refetch:i}=zGt(e||""),o=UGt(),l=qGt(),[a,h]=P.useState(!1),[p,x]=P.useState(null),[y,w]=P.useState(""),[j,S]=P.useState(null),C=async T=>{S(T);try{await o.mutateAsync({orderId:e,itemId:T}),ze.success("Proof approved!"),i()}catch{ze.error("Failed to approve proof")}finally{S(null)}},A=async()=>{if(p){S(p);try{await l.mutateAsync({orderId:e,itemId:p,reason:y}),ze.success("Revision requested"),h(!1),w(""),x(null),i()}catch{ze.error("Failed to request revision")}finally{S(null)}}};return s?r.jsx(Or,{title:"Order Details",children:r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsx(Pr,{className:"h-64 w-full"}),r.jsx(Pr,{className:"h-48 w-full"})]}),r.jsx(Pr,{className:"h-96 w-full"})]})}):n?r.jsxs(Or,{title:`Order ${n.order_number}`,children:[r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs(We,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"Order Status"}),r.jsx(Ft,{className:P0e[n.status],children:DS[n.status]})]}),r.jsx(Xe,{children:r.jsx(wKt,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Items"})}),r.jsx(Xe,{className:"space-y-4",children:(E=n.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",T.quantity," × $",Number(T.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(T.unit_price)*T.quantity).toFixed(2)]})]}),T.artwork_url&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),r.jsxs("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(d1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Ls,{className:"h-3 w-3"})]})]}),T.proof_url&&r.jsxs("div",{className:"bg-muted rounded-lg p-3",children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"Proof Ready for Review"}),r.jsxs("a",{href:T.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[r.jsx(d1,{className:"h-4 w-4"}),"View Proof",r.jsx(Ls,{className:"h-3 w-3"})]}),T.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(J,{size:"sm",onClick:()=>C(T.id),disabled:j===T.id,children:[j===T.id?r.jsx(nn,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(Od,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:()=>{x(T.id),h(!0)},disabled:j===T.id,children:[r.jsx(ZT,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),T.proof_status==="approved"&&r.jsxs(Ft,{className:"bg-green-100 text-green-800",children:[r.jsx(Za,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),T.proof_status==="rejected"&&T.proof_notes&&r.jsxs("div",{className:"mt-2",children:[r.jsx(Ft,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.proof_notes})]})]})]},T.id))})]}),n.shipping_name&&r.jsxs(We,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(XT,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-medium",children:n.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[n.shipping_address,r.jsx("br",{}),n.shipping_city,", ",n.shipping_state," ",n.shipping_zip]}),n.tracking_number&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),r.jsx("p",{className:"font-mono font-medium",children:n.tracking_number}),n.tracking_url&&r.jsxs(J,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Ls,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(We,{className:"sticky top-4",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Order Summary"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",fn(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(n.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(n.shipping_total).toFixed(2)]})]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(n.total).toFixed(2)]})]}),n.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-1",children:"Order Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.notes})]})]})]})]})})]}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Request Changes"}),r.jsx(es,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(ms,{placeholder:"Describe the changes needed...",value:y,onChange:T=>w(T.target.value),rows:4}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(J,{onClick:A,disabled:!y.trim()||j!==null,children:[j?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Or,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Order not found"}),r.jsx(J,{onClick:()=>t("/marketplace/orders"),children:"View All Orders"})]})})}function kKt(){const e=ns(),[t]=Fd();return t.get("session_id"),P.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Or,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(We,{children:r.jsxs(Xe,{className:"pt-8 pb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(Za,{className:"h-8 w-8 text-green-600"})}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thank You for Your Order!"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Your order has been confirmed and is being processed. You'll receive an email confirmation shortly."}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 mb-6 text-left",children:[r.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ol,{className:"h-4 w-4"}),"What happens next?"]}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("li",{children:"• We'll review your order and prepare it for production"}),r.jsx("li",{children:"• If your order requires a proof, you'll receive it for approval"}),r.jsx("li",{children:"• Once approved, we'll begin production and ship when ready"}),r.jsx("li",{children:"• You'll receive tracking info when your order ships"})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(J,{className:"flex-1",onClick:()=>e("/marketplace/orders"),children:["View My Orders",r.jsx(Ko,{className:"h-4 w-4 ml-2"})]}),r.jsx(J,{variant:"outline",className:"flex-1",onClick:()=>e("/marketplace"),children:"Continue Shopping"})]})]})})})})}function NKt(){const{user:e}=zr(),[t,n]=P.useState("store"),[s,i]=P.useState(null),[o,l]=P.useState(null),[a,h]=P.useState(!1),[p,x]=P.useState(5),[y,w]=P.useState(""),[j,S]=P.useState(!1),[C,A]=P.useState(!1),[E,T]=P.useState(""),[O,z]=P.useState(null),[F,q]=P.useState(!1),{hasSubmittedReview:H,submitReview:K,markPostedToGoogle:Z}=sOe(),{data:re}=rUe(),{data:ue,isLoading:he}=tUe(),{data:be,isLoading:ne}=YGt(s),{data:ye,isLoading:ie}=XGt(e==null?void 0:e.id),{data:fe=0}=JGt(e==null?void 0:e.id),de=eKt(),_e=new Set((ye==null?void 0:ye.map(Ue=>Ue.item_id))||[]),Ee=async()=>{if(o)try{await de.mutateAsync(o.id),ze.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Ue){ze.error(Ue.message||"Failed to purchase item")}},ke=async()=>{if(!y.trim()){ze.error("Please write a review");return}S(!0);const Ue=await K(p,y);S(!1),Ue.success?(ze.success("Thank you for your review! You earned 25 points!"),T(y),A(!0),w(""),x(5)):ze.error(Ue.error||"Failed to submit review")},pe=()=>{navigator.clipboard.writeText(E),ze.success("Review copied to clipboard!")},ae=()=>{Z(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},ge=()=>{A(!1),h(!1),T("")};return he||ne||ie?r.jsx(Or,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-24 w-full"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(Ue=>r.jsx(Pr,{className:"h-64"},Ue))})]})}):r.jsxs(Or,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Reward Store"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Redeem your points for exclusive rewards"})]}),r.jsx(We,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:r.jsx(vs,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your Spendable Points"}),r.jsx("p",{className:"text-3xl font-bold text-primary",children:fe.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ha,{className:"h-4 w-4"}),r.jsx("span",{children:"Earn points by attending events"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Kh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(kS,{open:F,onOpenChange:q,children:r.jsxs(We,{className:"border-primary/20",children:[r.jsx(NS,{asChild:!0,children:r.jsx(Wt,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Ha,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-base",children:"How to Earn Points"}),r.jsx(En,{children:"See all the ways you can earn spendable points"})]})]}),F?r.jsx(i1,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Iu,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(SS,{children:r.jsx(Xe,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[re==null?void 0:re.filter(Ue=>Ue.is_active).map(Ue=>{const Ie=Ke=>{switch(Ke){case"event_attendance":return r.jsx(Ys,{className:"h-5 w-5"});case"leave_review":return r.jsx(vs,{className:"h-5 w-5"});case"add_listing":return r.jsx(fi,{className:"h-5 w-5"});case"first_contact":return r.jsx(Kn,{className:"h-5 w-5"});case"first_video":return r.jsx(Fi,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Po,{className:"h-5 w-5"});default:return r.jsx(Va,{className:"h-5 w-5"})}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0",children:Ie(Ue.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Ue.action_name}),Ue.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ue.description})]}),r.jsxs(Ft,{variant:"secondary",className:"font-bold shrink-0",children:["+",Ue.points]})]},Ue.id)}),r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/20 flex items-center justify-center text-orange-500 shrink-0",children:r.jsx(Kh,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Streak Bonuses"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Attend consecutive weeks for bonus points!"})]}),r.jsx(Ft,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!H&&r.jsx(We,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/20 flex items-center justify-center",children:r.jsx(Po,{className:"h-6 w-6 text-yellow-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Earn 25 Free Points!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave a quick review and earn 25 spendable points"})]})]}),r.jsxs(J,{onClick:()=>h(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(ba,{value:t,onValueChange:n,children:[r.jsxs(fa,{children:[r.jsxs(ln,{value:"store",className:"flex items-center gap-2",children:[r.jsx(wg,{className:"h-4 w-4"}),"Store"]}),r.jsxs(ln,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(Ol,{className:"h-4 w-4"}),"My Rewards",ye&&ye.length>0&&r.jsx(Ft,{variant:"secondary",className:"ml-1",children:ye.length})]})]}),r.jsxs(An,{value:"store",className:"mt-6",children:[ue&&ue.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(J,{variant:s===null?"default":"outline",size:"sm",onClick:()=>i(null),children:"All"}),ue.map(Ue=>r.jsxs(J,{variant:s===Ue.id?"default":"outline",size:"sm",onClick:()=>i(Ue.id),children:[Ue.icon&&`${Ue.icon} `,Ue.name]},Ue.id))]}),!be||be.length===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Va,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No items available"}),r.jsx("p",{className:"text-sm",children:"Check back later for new rewards!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:be.map(Ue=>{const Ie=_e.has(Ue.id),Ke=Ue.max_quantity!==null&&Ue.current_quantity===0,Re=fe>=Ue.points_cost;return r.jsxs(We,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Ie?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>z(Ue),children:[Ue.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Ue.preview_image_url,alt:Ue.name,className:"w-full h-full object-cover"}),Ie&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx(Za,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Ke&&!Ie&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ft,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(Va,{className:"h-12 w-12 text-muted-foreground/50"}),Ie&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx(Za,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Xt,{className:"text-lg",children:Ue.name}),r.jsxs(Ft,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),Ue.points_cost]})]}),Ue.category&&r.jsxs(Ft,{variant:"outline",className:"w-fit",children:[Ue.category.icon&&`${Ue.category.icon} `,Ue.category.name]})]}),r.jsxs(Xe,{children:[r.jsx(En,{className:"mb-4 line-clamp-2",children:Ue.description||"No description available"}),Ue.max_quantity!==null&&!Ie&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Ue.current_quantity," of ",Ue.max_quantity," remaining"]}),Ie?r.jsx(J,{className:"w-full",onClick:Ce=>{Ce.stopPropagation(),Ue.file_url&&hde(Ue.file_url,Ue.name)},disabled:!Ue.file_url,children:Ue.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(J,{className:"w-full",onClick:Ce=>{Ce.stopPropagation(),l(Ue)},disabled:Ke||!Re,children:Ke?"Sold Out":Re?r.jsxs(r.Fragment,{children:[r.jsx(wg,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Ue.points_cost-fe} more pts`})]})]},Ue.id)})})]}),r.jsx(An,{value:"my-rewards",className:"mt-6",children:!ye||ye.length===0?r.jsx(We,{children:r.jsx(Xe,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No rewards yet"}),r.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ye.map(Ue=>{var Ie,Ke,Re,Ce,Je;return r.jsxs(We,{className:"overflow-hidden",children:[(Ie=Ue.item)!=null&&Ie.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Ue.item.preview_image_url,alt:((Ke=Ue.item)==null?void 0:Ke.name)||"Reward",className:"w-full h-full object-cover"})}):r.jsx("div",{className:"aspect-video bg-muted flex items-center justify-center",children:r.jsx(Va,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Wt,{className:"pb-2",children:[r.jsx(Xt,{className:"text-lg",children:((Re=Ue.item)==null?void 0:Re.name)||"Unknown Item"}),r.jsxs(En,{className:"text-xs",children:["Purchased for ",Ue.points_spent," points • ",new Date(Ue.purchased_at).toLocaleDateString()]})]}),r.jsx(Xe,{children:r.jsx(J,{className:"w-full",onClick:()=>{var Te,Ye;(Te=Ue.item)!=null&&Te.file_url&&hde(Ue.item.file_url,(Ye=Ue.item)==null?void 0:Ye.name)},disabled:!((Ce=Ue.item)!=null&&Ce.file_url),children:((Je=Ue.item)==null?void 0:Je.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Ue.id)})})})]})]}),r.jsx(uh,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(wu,{children:[r.jsxs(ju,{children:[r.jsx(Nu,{children:"Confirm Purchase"}),r.jsxs(Su,{children:['Are you sure you want to purchase "',o==null?void 0:o.name,'" for ',o==null?void 0:o.points_cost," points?",r.jsx("br",{}),r.jsx("br",{}),"You currently have ",r.jsxs("strong",{children:[fe," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[fe-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(ku,{children:[r.jsx(Cu,{children:"Cancel"}),r.jsx(Jd,{onClick:Ee,disabled:de.isPending,children:de.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Br,{open:a,onOpenChange:Ue=>{!Ue&&C?ge():h(Ue)},children:r.jsx(Fr,{children:C?r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Za,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(es,{children:"Would you also share your review on Google? It helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your review:"}),r.jsxs("p",{className:"text-sm italic",children:['"',E,'"']})]}),r.jsxs(J,{variant:"outline",className:"w-full",onClick:pe,children:[r.jsx(jl,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(ri,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(J,{variant:"outline",onClick:ge,children:"Maybe Later"}),r.jsxs(J,{onClick:ae,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Leave a Review"}),r.jsx(es,{children:"Share your experience with LevelUp and earn 25 spendable points!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Rating"}),r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(Ue=>r.jsx("button",{type:"button",onClick:()=>x(Ue),className:"focus:outline-none",children:r.jsx(vs,{className:`h-8 w-8 transition-colors ${p>=Ue?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Ue))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(ms,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:Ue=>w(Ue.target.value),rows:4})]})]}),r.jsxs(ri,{children:[r.jsx(J,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(J,{onClick:ke,disabled:j,className:"bg-yellow-600 hover:bg-yellow-700",children:j?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Br,{open:!!O,onOpenChange:()=>z(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[O==null?void 0:O.name,r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),O==null?void 0:O.points_cost]})]}),(O==null?void 0:O.category)&&r.jsxs(Ft,{variant:"outline",className:"w-fit",children:[O.category.icon&&`${O.category.icon} `,O.category.name]})]}),(O==null?void 0:O.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:O.preview_image_url,alt:O.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(O==null?void 0:O.description)||"No description available"}),(O==null?void 0:O.max_quantity)!==null&&!_e.has((O==null?void 0:O.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[O==null?void 0:O.current_quantity," of ",O==null?void 0:O.max_quantity," remaining"]})]}),r.jsx(ri,{children:O&&_e.has(O.id)?r.jsx(J,{className:"w-full",onClick:()=>{O.file_url&&hde(O.file_url,O.name)},disabled:!O.file_url,children:O.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Access"]})}):O&&r.jsx(J,{className:"w-full",onClick:()=>{z(null),l(O)},disabled:O.max_quantity!==null&&O.current_quantity===0||fe{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function E1(e){const t=[];for(let n=0,s=e.length;nPh||e.height>Ph)&&(e.width>Ph&&e.height>Ph?e.width>e.height?(e.height*=Ph/e.width,e.width=Ph):(e.width*=Ph/e.height,e.height=Ph):e.width>Ph?(e.height*=Ph/e.width,e.width=Ph):(e.width*=Ph/e.height,e.height=Ph))}function une(e){return new Promise((t,n)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=n,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function IKt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function PKt(e,t,n){const s="http://www.w3.org/2000/svg",i=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${t} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(e),IKt(i)}const vh=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||vh(n,t)};function LKt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function OKt(e,t){return aUe(t).map(n=>{const s=e.getPropertyValue(n),i=e.getPropertyPriority(n);return`${n}: ${s}${i?" !important":""};`}).join(" ")}function DKt(e,t,n,s){const i=`.${e}:${t}`,o=n.cssText?LKt(n):OKt(n,s);return document.createTextNode(`${i}{${o}}`)}function y5e(e,t,n,s){const i=window.getComputedStyle(e,n),o=i.getPropertyValue("content");if(o===""||o==="none")return;const l=CKt();try{t.className=`${t.className} ${l}`}catch{return}const a=document.createElement("style");a.appendChild(DKt(l,n,i,s)),t.appendChild(a)}function RKt(e,t,n){y5e(e,t,":before",n),y5e(e,t,":after",n)}const v5e="application/font-woff",_5e="image/jpeg",FKt={woff:v5e,woff2:v5e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:_5e,jpeg:_5e,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function zKt(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function O0e(e){const t=zKt(e).toLowerCase();return FKt[t]||""}function BKt(e){return e.split(/,/)[1]}function Vpe(e){return e.search(/^(data:)/)!==-1}function $Kt(e,t){return`data:${t};base64,${e}`}async function lUe(e,t,n){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const i=await s.blob();return new Promise((o,l)=>{const a=new FileReader;a.onerror=l,a.onloadend=()=>{try{o(n({res:s,result:a.result}))}catch(h){l(h)}},a.readAsDataURL(i)})}const fde={};function UKt(e,t,n){let s=e.replace(/\?.*/,"");return n&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function D0e(e,t,n){const s=UKt(e,t,n.includeQueryParams);if(fde[s]!=null)return fde[s];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const o=await lUe(e,n.fetchRequestInit,({res:l,result:a})=>(t||(t=l.headers.get("Content-Type")||""),BKt(a)));i=$Kt(o,t)}catch(o){i=n.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;o&&(l=typeof o=="string"?o:o.message),l&&console.warn(l)}return fde[s]=i,i}async function qKt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):une(t)}async function VKt(e,t){if(e.currentSrc){const o=document.createElement("canvas"),l=o.getContext("2d");o.width=e.clientWidth,o.height=e.clientHeight,l==null||l.drawImage(e,0,0,o.width,o.height);const a=o.toDataURL();return une(a)}const n=e.poster,s=O0e(n),i=await D0e(n,s,t);return une(i)}async function HKt(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await Vie(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function WKt(e,t){return vh(e,HTMLCanvasElement)?qKt(e):vh(e,HTMLVideoElement)?VKt(e,t):vh(e,HTMLIFrameElement)?HKt(e,t):e.cloneNode(cUe(e))}const GKt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",cUe=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function KKt(e,t,n){var s,i;if(cUe(t))return t;let o=[];return GKt(e)&&e.assignedNodes?o=E1(e.assignedNodes()):vh(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?o=E1(e.contentDocument.body.childNodes):o=E1(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),o.length===0||vh(e,HTMLVideoElement)||await o.reduce((l,a)=>l.then(()=>Vie(a,n)).then(h=>{h&&t.appendChild(h)}),Promise.resolve()),t}function ZKt(e,t,n){const s=t.style;if(!s)return;const i=window.getComputedStyle(e);i.cssText?(s.cssText=i.cssText,s.transformOrigin=i.transformOrigin):aUe(n).forEach(o=>{let l=i.getPropertyValue(o);o==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),vh(e,HTMLIFrameElement)&&o==="display"&&l==="inline"&&(l="block"),o==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),s.setProperty(o,l,i.getPropertyPriority(o))})}function YKt(e,t){vh(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),vh(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function XKt(e,t){if(vh(e,HTMLSelectElement)){const n=t,s=Array.from(n.children).find(i=>e.value===i.getAttribute("value"));s&&s.setAttribute("selected","")}}function QKt(e,t,n){return vh(t,Element)&&(ZKt(e,t,n),RKt(e,t,n),YKt(e,t),XKt(e,t)),t}async function JKt(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const s={};for(let o=0;oWKt(s,t)).then(s=>KKt(e,s,t)).then(s=>QKt(e,s,t)).then(s=>JKt(s,t))}const dUe=/url\((['"]?)([^'"]+?)\1\)/g,eZt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,tZt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function rZt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function nZt(e){const t=[];return e.replace(dUe,(n,s,i)=>(t.push(i),n)),t.filter(n=>!Vpe(n))}async function sZt(e,t,n,s,i){try{const o=n?SKt(t,n):t,l=O0e(t);let a;return i||(a=await D0e(o,l,s)),e.replace(rZt(t),`$1${a}$3`)}catch{}return e}function iZt(e,{preferredFontFormat:t}){return t?e.replace(tZt,n=>{for(;;){const[s,,i]=eZt.exec(n)||[];if(!i)return"";if(i===t)return`src: ${s};`}}):e}function uUe(e){return e.search(dUe)!==-1}async function hUe(e,t,n){if(!uUe(e))return e;const s=iZt(e,n);return nZt(s).reduce((o,l)=>o.then(a=>sZt(a,l,t,n)),Promise.resolve(s))}async function f4(e,t,n){var s;const i=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(i){const o=await hUe(i,null,n);return t.style.setProperty(e,o,t.style.getPropertyPriority(e)),!0}return!1}async function aZt(e,t){await f4("background",e,t)||await f4("background-image",e,t),await f4("mask",e,t)||await f4("-webkit-mask",e,t)||await f4("mask-image",e,t)||await f4("-webkit-mask-image",e,t)}async function oZt(e,t){const n=vh(e,HTMLImageElement);if(!(n&&!Vpe(e.src))&&!(vh(e,SVGImageElement)&&!Vpe(e.href.baseVal)))return;const s=n?e.src:e.href.baseVal,i=await D0e(s,O0e(s),t);await new Promise((o,l)=>{e.onload=o,e.onerror=t.onImageErrorHandler?(...h)=>{try{o(t.onImageErrorHandler(...h))}catch(p){l(p)}}:l;const a=e;a.decode&&(a.decode=o),a.loading==="lazy"&&(a.loading="eager"),n?(e.srcset="",e.src=i):e.href.baseVal=i})}async function lZt(e,t){const s=E1(e.childNodes).map(i=>fUe(i,t));await Promise.all(s).then(()=>e)}async function fUe(e,t){vh(e,Element)&&(await aZt(e,t),await oZt(e,t),await lZt(e,t))}function cZt(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(i=>{n[i]=s[i]}),e}const b5e={};async function w5e(e){let t=b5e[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},b5e[e]=t,t}async function j5e(e,t){let n=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async l=>{let a=l.replace(s,"$1");return a.startsWith("https://")||(a=new URL(a,e.url).href),lUe(a,t.fetchRequestInit,({result:h})=>(n=n.replace(l,`url(${h})`),[l,h]))});return Promise.all(o).then(()=>n)}function k5e(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const h=i.exec(s);if(h===null)break;t.push(h[0])}s=s.replace(i,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(l,"gi");for(;;){let h=o.exec(s);if(h===null){if(h=a.exec(s),h===null)break;o.lastIndex=a.lastIndex}else a.lastIndex=o.lastIndex;t.push(h[0])}return t}async function dZt(e,t){const n=[],s=[];return e.forEach(i=>{if("cssRules"in i)try{E1(i.cssRules||[]).forEach((o,l)=>{if(o.type===CSSRule.IMPORT_RULE){let a=l+1;const h=o.href,p=w5e(h).then(x=>j5e(x,t)).then(x=>k5e(x).forEach(y=>{try{i.insertRule(y,y.startsWith("@import")?a+=1:i.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:y,error:w})}})).catch(x=>{console.error("Error loading remote css",x.toString())});s.push(p)}})}catch(o){const l=e.find(a=>a.href==null)||document.styleSheets[0];i.href!=null&&s.push(w5e(i.href).then(a=>j5e(a,t)).then(a=>k5e(a).forEach(h=>{l.insertRule(h,l.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",o)}}),Promise.all(s).then(()=>(e.forEach(i=>{if("cssRules"in i)try{E1(i.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),n))}function uZt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>uUe(t.style.getPropertyValue("src")))}async function hZt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=E1(e.ownerDocument.styleSheets),s=await dZt(n,t);return uZt(s)}function pUe(e){return e.trim().replace(/["']/g,"")}function fZt(e){const t=new Set;function n(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(o=>{t.add(pUe(o))}),Array.from(s.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(e),t}async function pZt(e,t){const n=await hZt(e,t),s=fZt(e);return(await Promise.all(n.filter(o=>s.has(pUe(o.style.fontFamily))).map(o=>{const l=o.parentStyleSheet?o.parentStyleSheet.href:null;return hUe(o.cssText,l,t)}))).join(` `)}async function mZt(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await pZt(e,t);if(n){const s=document.createElement("style"),i=document.createTextNode(n);s.appendChild(i),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function gZt(e,t={}){const{width:n,height:s}=oUe(e,t),i=await Vie(e,t,!0);return await mZt(i,t),await fUe(i,t),cZt(i,t),await PKt(i,n,s)}async function xZt(e,t={}){const{width:n,height:s}=oUe(e,t),i=await gZt(e,t),o=await une(i),l=document.createElement("canvas"),a=l.getContext("2d"),h=t.pixelRatio||AKt(),p=t.canvasWidth||n,x=t.canvasHeight||s;return l.width=p*h,l.height=x*h,t.skipAutoScale||EKt(l),l.style.width=`${p}`,l.style.height=`${x}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,l.width,l.height)),a.drawImage(o,0,0,l.width,l.height),l}async function yZt(e,t={}){return(await xZt(e,t)).toDataURL()}function vZt(){return Jt({queryKey:["listing-swag-categories"],queryFn:async()=>{const{data:e,error:t}=await ee.from("listing_swag_categories").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}})}function _Zt(){return Jt({queryKey:["listing-swag-styles"],queryFn:async()=>{const{data:e,error:t}=await ee.from("listing_swag_styles").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}})}function bZt(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{error:s}=await ee.from("listing_swag_generations").insert({user_id:e.id,category_id:n.categoryId,style_id:n.styleId,listing_id:n.listingId||null,property_address:n.propertyAddress,property_city:n.propertyCity,property_state:n.propertyState,property_price:n.propertyPrice,bedrooms:n.bedrooms,bathrooms:n.bathrooms,square_feet:n.squareFeet,photo_url:n.photoUrl,formats_downloaded:n.formatsDownloaded});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-swag-generations"]})}})}const wZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function N5e(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function S5e({data:e,format:t}){var w,j;const n=wZt[t],s=.4,i=e.primaryColor||"#1e3a5f",o=e.secondaryColor||"#ffffff",l=N5e(i)?"#0f172a":"#ffffff",a=N5e(o)?"#0f172a":"#ffffff",h=i+"33",p=S=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(S),x=t==="story",y=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"relative",style:{height:x?"38%":y?"35%":"36%"},children:[e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e5e7eb"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:28*s},children:"Add Property Photo"})}),r.jsx("div",{className:"absolute",style:{top:20*s,left:20*s,backgroundColor:i,padding:`${18*s}px ${36*s}px`,borderRadius:6*s},children:r.jsx("span",{style:{color:l,fontSize:28*s,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.1em"},children:e.categoryName})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:o,padding:`${20*s}px ${32*s}px`,borderRadius:6*s,boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,marginBottom:4*s},children:"Listed at"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:i},children:p(e.propertyPrice)})]})]}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:i,padding:`${28*s}px ${36*s}px`,gap:16*s},children:[r.jsx(pl,{style:{width:36*s,height:36*s,color:l,opacity:.8,flexShrink:0}}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:800,color:l,marginBottom:4*s},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:l,opacity:.8,fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{backgroundColor:o},children:[{icon:Vf,value:e.bedrooms,label:"Bedrooms"},{icon:qf,value:e.bathrooms,label:"Bathrooms"},{icon:m1,value:((w=e.squareFeet)==null?void 0:w.toLocaleString())||"—",label:"Sq Ft"}].map((S,C)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,borderRight:C<2?`2px solid ${h}`:"none",backgroundColor:C===1?h:o},children:[r.jsx(S.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:i},children:S.value}),r.jsx("div",{style:{fontSize:18*s,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:S.label})]},C))}),r.jsxs("div",{className:"flex items-center",style:{padding:`${48*s}px`,backgroundColor:o,gap:36*s,flex:1},children:[e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"object-cover",style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:220*s,height:220*s,borderRadius:"50%",backgroundColor:i,color:l,fontSize:88*s,fontWeight:700,flexShrink:0},children:((j=e.agentName)==null?void 0:j.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:i,marginBottom:8*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:28*s,color:"#64748b",marginBottom:24*s,fontWeight:600},children:"Real Estate Professional"}),r.jsxs("div",{className:"flex flex-col",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:28*s,height:28*s,color:l}})}),r.jsx("span",{style:{fontSize:36*s,color:a,fontWeight:800},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Zs,{style:{width:28*s,height:28*s,color:l}})}),r.jsx("span",{style:{fontSize:30*s,color:"#475569",fontWeight:600},children:e.agentEmail})]})]})]})]})]})}const jZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function C5e(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function kZt({data:e,format:t}){var w,j;const n=jZt[t],s=.4,i=e.primaryColor||"#0f766e",o=e.secondaryColor||"#ffffff",l=C5e(i)?"#0f172a":"#ffffff",a=C5e(o)?"#0f172a":"#ffffff",h=i+"22",p=S=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(S),x=t==="story",y=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:o,padding:`${28*s}px ${36*s}px`},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:18*s,color:i,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",marginBottom:4*s},children:"Just"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i,textTransform:"uppercase"},children:e.categoryName})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",marginBottom:4*s},children:"Price"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i},children:p(e.propertyPrice)})]})]}),r.jsx("div",{className:"relative",style:{height:x?"32%":"28%",margin:`0 ${24*s}px`,borderRadius:16*s,overflow:"hidden",border:`6px solid ${o}`},children:e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:h},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})})}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,padding:`${24*s}px ${32*s}px`,borderRadius:16*s,gap:18*s},children:[r.jsx("div",{className:"flex items-center justify-center",style:{width:64*s,height:64*s,backgroundColor:i,borderRadius:"50%",flexShrink:0},children:r.jsx(pl,{style:{width:32*s,height:32*s,color:l}})}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:a},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:"#64748b",fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:20*s,padding:`0 ${24*s}px`},children:[{icon:Vf,value:e.bedrooms,label:"Beds"},{icon:qf,value:e.bathrooms,label:"Baths"},{icon:m1,value:((w=e.squareFeet)==null?void 0:w.toLocaleString())||"—",label:"Sq Ft"}].map((S,C)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center",style:{backgroundColor:o,padding:`${24*s}px`,borderRadius:16*s},children:[r.jsx(S.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:900,color:a},children:S.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:S.label})]},C))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,marginBottom:24*s,padding:`${40*s}px`,borderRadius:20*s,gap:36*s,flex:1},children:[e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:i,color:l,fontSize:80*s,fontWeight:700,flexShrink:0},children:((j=e.agentName)==null?void 0:j.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:900,color:a,marginBottom:8*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:24*s,color:i,fontWeight:700,marginBottom:20*s},children:"Licensed Real Estate Agent"}),r.jsxs("div",{className:"flex flex-col",style:{gap:14*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:26*s,height:26*s,color:l}})}),r.jsx("span",{style:{fontSize:34*s,color:a,fontWeight:800},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Zs,{style:{width:26*s,height:26*s,color:l}})}),r.jsx("span",{style:{fontSize:28*s,color:"#475569",fontWeight:600},children:e.agentEmail})]})]})]})]})]})}const NZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function M5e(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function SZt({data:e,format:t}){var y,w;const n=NZt[t],s=.4,i=e.primaryColor||"#2c3e50",o=e.secondaryColor||"#c9a962",l=M5e(i)?"#0f172a":"#ffffff",a=M5e(o)?"#0f172a":"#ffffff",h=j=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(j),p=t==="story",x=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Georgia', serif",backgroundColor:i},children:[r.jsxs("div",{className:"text-center",style:{backgroundColor:i,padding:`${32*s}px`,borderBottom:`6px solid ${o}`},children:[r.jsx("div",{style:{fontSize:20*s,color:o,textTransform:"uppercase",letterSpacing:"0.3em",marginBottom:8*s},children:"Just"}),r.jsx("div",{style:{fontSize:56*s,fontWeight:400,color:l,textTransform:"uppercase",letterSpacing:"0.15em"},children:e.categoryName})]}),r.jsxs("div",{className:"relative",style:{height:p?"30%":"26%",margin:`${24*s}px`,border:`4px solid ${o}`,borderRadius:6*s,overflow:"hidden"},children:[e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e8e4de"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:i,padding:`${18*s}px ${32*s}px`,borderRadius:6*s,border:`3px solid ${o}`},children:[r.jsx("div",{style:{fontSize:14*s,color:o,textTransform:"uppercase",letterSpacing:"0.1em"},children:"Offered at"}),r.jsx("div",{style:{fontSize:42*s,fontWeight:400,color:l},children:h(e.propertyPrice)})]})]}),r.jsxs("div",{className:"text-center",style:{padding:`${20*s}px ${36*s}px`,backgroundColor:"#faf8f5"},children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:400,color:i,marginBottom:8*s},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:o,letterSpacing:"0.1em",fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:48*s,padding:`${28*s}px`,backgroundColor:"#faf8f5",borderTop:"2px solid #e8e4de",borderBottom:"2px solid #e8e4de"},children:[{icon:Vf,value:e.bedrooms,label:"Bedrooms"},{icon:qf,value:e.bathrooms,label:"Bathrooms"},{icon:m1,value:((y=e.squareFeet)==null?void 0:y.toLocaleString())||"—",label:"Sq Ft"}].map((j,S)=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(j.icon,{style:{width:32*s,height:32*s,color:o,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:400,color:i},children:j.value}),r.jsx("div",{style:{fontSize:16*s,color:"#7c8798",textTransform:"uppercase",letterSpacing:"0.08em"},children:j.label})]},S))}),r.jsxs("div",{className:"flex items-center justify-center",style:{backgroundColor:i,padding:`${48*s}px`,gap:40*s,borderTop:`6px solid ${o}`,flex:1},children:[e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`6px solid ${o}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:o,color:a,fontSize:80*s,fontWeight:400,fontStyle:"italic",flexShrink:0},children:((w=e.agentName)==null?void 0:w.charAt(0))||"A"}),r.jsxs("div",{className:"text-center flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:400,color:l,fontStyle:"italic",marginBottom:10*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:22*s,color:o,textTransform:"uppercase",letterSpacing:"0.2em",marginBottom:24*s},children:"Real Estate Advisor"}),r.jsxs("div",{className:"flex flex-col items-center",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:32*s,color:l,fontWeight:600},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Zs,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:26*s,color:"#94a3b8"},children:e.agentEmail})]})]})]})]})]})}const CZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function MZt(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function TZt({data:e,format:t}){var y,w;const n=CZt[t],s=.4,i=e.primaryColor||"#dc2626",o=e.secondaryColor||"#ffffff",l=MZt(i)?"#0f172a":"#ffffff",a=i+"22",h=j=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(j),p=t==="story",x=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:"#0f172a"},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:i,padding:`${32*s}px ${40*s}px`},children:[r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:l,textTransform:"uppercase",letterSpacing:"0.05em"},children:e.categoryName}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:l,opacity:.8,marginBottom:4*s},children:"Asking"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:l},children:h(e.propertyPrice)})]})]}),r.jsxs("div",{className:"relative",style:{height:p?"30%":x?"28%":"26%"},children:[e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:a},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:0,left:0,right:0,backgroundColor:"rgba(0,0,0,0.9)",padding:`${24*s}px ${32*s}px`},children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:"#ffffff"},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:i,fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{borderBottom:`6px solid ${i}`},children:[{icon:Vf,value:e.bedrooms,label:"Beds"},{icon:qf,value:e.bathrooms,label:"Baths"},{icon:m1,value:((y=e.squareFeet)==null?void 0:y.toLocaleString())||"—",label:"Sq Ft"}].map((j,S)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,backgroundColor:S===1?a:o,borderRight:S<2?`2px solid ${a}`:"none"},children:[r.jsx(j.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:"#0f172a"},children:j.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:j.label})]},S))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:"#0f172a",padding:`${48*s}px`,gap:40*s,flex:1},children:[r.jsx("div",{style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,padding:6*s,backgroundColor:"#1e293b",flexShrink:0},children:e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"w-full h-full object-cover",style:{borderRadius:"50%"},crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{borderRadius:"50%",backgroundColor:i,color:l,fontSize:88*s,fontWeight:700},children:((w=e.agentName)==null?void 0:w.charAt(0))||"A"})}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:"#ffffff",marginBottom:10*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:28*s,color:i,fontWeight:700,marginBottom:24*s},children:"Your Real Estate Expert"}),r.jsxs("div",{className:"flex flex-col",style:{gap:18*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:30*s,height:30*s,color:l}})}),r.jsx("span",{style:{fontSize:38*s,color:"#ffffff",fontWeight:800},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Zs,{style:{width:30*s,height:30*s,color:l}})}),r.jsx("span",{style:{fontSize:30*s,color:"#94a3b8",fontWeight:600},children:e.agentEmail})]})]})]})]})]})}function AZt({templateKey:e,data:t,format:n}){switch(e){case"modern-minimal":return r.jsx(S5e,{data:t,format:n});case"bold-impact":return r.jsx(kZt,{data:t,format:n});case"classic-elegant":return r.jsx(SZt,{data:t,format:n});case"vibrant-energy":return r.jsx(TZt,{data:t,format:n});default:return r.jsx(S5e,{data:t,format:n})}}const EZt={Home:r.jsx(fi,{className:"h-6 w-6"}),DoorOpen:r.jsx(l1,{className:"h-6 w-6"}),TrendingDown:r.jsx(_1,{className:"h-6 w-6"}),CheckCircle:r.jsx(qa,{className:"h-6 w-6"}),FileText:r.jsx(Ai,{className:"h-6 w-6"})},tT={portrait:{label:"Portrait",icon:r.jsx(Zo,{className:"h-5 w-5"}),dimensions:"1080×1350",ratio:"4:5"},square:{label:"Square",icon:r.jsx(xm,{className:"h-5 w-5"}),dimensions:"1080×1080",ratio:"1:1"},story:{label:"Story",icon:r.jsx(gm,{className:"h-5 w-5"}),dimensions:"1080×1920",ratio:"9:16"}};function IZt(){const{user:e}=zr(),{data:t,isLoading:n}=vZt(),{data:s,isLoading:i}=_Zt(),{data:o}=wxe(),{avatarUrl:l}=Ege(e==null?void 0:e.id),a=bZt(),[h,p]=P.useState(null);P.useEffect(()=>{(async()=>{if(!e)return;const{data:ge}=await ee.from("profiles").select("name, phone").eq("id",e.id).single();ge&&p(ge)})()},[e]);const[x,y]=P.useState("category"),[w,j]=P.useState(null),[S,C]=P.useState(null),[A,E]=P.useState("portrait"),[T,O]=P.useState(!1),[z,F]=P.useState(""),[q,H]=P.useState("#1e3a5f"),[K,Z]=P.useState("#ffffff"),[re,ue]=P.useState({propertyAddress:"",propertyCity:"",propertyState:"",propertyPrice:"",bedrooms:"",bathrooms:"",squareFeet:"",openHouseDate:"",openHouseTime:"",originalPrice:""}),he=P.useRef(null),be=ae=>{var Me;const ge=(Me=ae.target.files)==null?void 0:Me[0];if(ge){const Ue=new FileReader;Ue.onloadend=()=>{F(Ue.result)},Ue.readAsDataURL(ge)}},ne=ae=>{var Me,Ue,Ie,Ke,Re,Ce;const ge=o==null?void 0:o.find(Je=>Je.id===ae);ge&&(ue({propertyAddress:ge.property_address||"",propertyCity:ge.city||"",propertyState:ge.state||"",propertyPrice:((Me=ge.price)==null?void 0:Me.toString())||"",bedrooms:((Ue=ge.bedrooms)==null?void 0:Ue.toString())||"",bathrooms:((Ie=ge.bathrooms)==null?void 0:Ie.toString())||"",squareFeet:((Ke=ge.square_footage)==null?void 0:Ke.toString())||"",openHouseDate:"",openHouseTime:"",originalPrice:""}),(Ce=(Re=ge.photos)==null?void 0:Re[0])!=null&&Ce.photo_url&&F(ge.photos[0].photo_url))},ye=()=>({categoryId:(w==null?void 0:w.id)||"",categoryName:(w==null?void 0:w.name)||"",styleId:(S==null?void 0:S.id)||"",templateKey:(S==null?void 0:S.template_key)||"modern-minimal",primaryColor:q,secondaryColor:K,accentColor:q,fontFamily:(S==null?void 0:S.font_family)||"Inter",propertyAddress:re.propertyAddress,propertyCity:re.propertyCity,propertyState:re.propertyState,propertyPrice:parseFloat(re.propertyPrice)||0,bedrooms:parseInt(re.bedrooms)||0,bathrooms:parseFloat(re.bathrooms)||0,squareFeet:parseInt(re.squareFeet)||0,photoUrl:z,agentName:(h==null?void 0:h.name)||"Agent Name",agentPhone:(h==null?void 0:h.phone)||"",agentEmail:(e==null?void 0:e.email)||"",agentPhoto:l||"",brokerageName:"",openHouseDate:re.openHouseDate,openHouseTime:re.openHouseTime,originalPrice:re.originalPrice?parseFloat(re.originalPrice):void 0}),ie=async ae=>{if(he.current){O(!0);try{const ge=he.current.querySelector("[data-template]");if(!ge)throw new Error("Template not found");const Me={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}},Ue=.3,Ie=Me[ae],Ke=await yZt(ge,{width:Ie.width*Ue,height:Ie.height*Ue,pixelRatio:1/Ue,cacheBust:!0}),Re=document.createElement("a");Re.download=`listing-${w==null?void 0:w.slug}-${ae}-${Date.now()}.png`,Re.href=Ke,Re.click(),w&&S&&a.mutate({categoryId:w.id,styleId:S.id,propertyAddress:re.propertyAddress,propertyCity:re.propertyCity,propertyState:re.propertyState,propertyPrice:parseFloat(re.propertyPrice)||void 0,bedrooms:parseInt(re.bedrooms)||void 0,bathrooms:parseFloat(re.bathrooms)||void 0,squareFeet:parseInt(re.squareFeet)||void 0,photoUrl:z,formatsDownloaded:[ae]}),ze.success(`Downloaded ${tT[ae].label} format!`)}catch(ge){console.error("Download error:",ge),ze.error("Failed to download image")}finally{O(!1)}}},fe=async()=>{const ae=["portrait","square","story"];for(const ge of ae)E(ge),await new Promise(Me=>setTimeout(Me,500)),await ie(ge)},de=()=>{switch(x){case"category":return!!w;case"style":return!!S;case"details":return re.propertyAddress&&re.propertyPrice&&z;default:return!0}},_e=()=>{const ae=["category","style","details","preview"],ge=ae.indexOf(x);ge{const ae=["category","style","details","preview"],ge=ae.indexOf(x);ge>0&&y(ae[ge-1])},ke=()=>r.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:["category","style","details","preview"].map((ae,ge)=>r.jsxs(rt.Fragment,{children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ${x===ae?"bg-primary text-primary-foreground":pe.indexOf(x)>ge?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"}`,children:ge+1}),ge<3&&r.jsx("div",{className:`w-12 h-0.5 ${pe.indexOf(x)>ge?"bg-primary":"bg-muted"}`})]},ae))}),pe=["category","style","details","preview"];return n||i?r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64 mx-auto"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[1,2,3,4,5].map(ae=>r.jsx(Pr,{className:"h-32"},ae))})]}):r.jsxs("div",{className:"max-w-4xl mx-auto",children:[ke(),x==="category"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"What type of announcement?"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose the category that matches your listing status"})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:t==null?void 0:t.map(ae=>r.jsx(We,{className:`cursor-pointer transition-all hover:shadow-md ${(w==null?void 0:w.id)===ae.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>j(ae),children:r.jsxs(Xe,{className:"p-6 text-center",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:EZt[ae.icon||"Home"]}),r.jsx("h3",{className:"font-semibold",children:ae.name})]})},ae.id))})]}),x==="style"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Choose your layout & colors"}),r.jsx("p",{className:"text-muted-foreground",children:"Select a layout style and customize your brand colors"})]}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-6",children:[r.jsx("h3",{className:"font-semibold mb-4",children:"Your Brand Colors"}),r.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx(Ve,{className:"mb-2 block",children:"Primary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:q,onChange:ae=>H(ae.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(ct,{value:q,onChange:ae=>H(ae.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for headers, badges, and accents"})]}),r.jsxs("div",{children:[r.jsx(Ve,{className:"mb-2 block",children:"Secondary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:K,onChange:ae=>Z(ae.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(ct,{value:K,onChange:ae=>Z(ae.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for backgrounds and contrast"})]})]}),r.jsxs("div",{className:"mt-4 p-4 rounded-lg border flex items-center gap-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-lg flex items-center justify-center text-sm font-bold",style:{backgroundColor:q,color:K},children:"Preview"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This is how your primary and secondary colors will look together"})]})]})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-4 text-center",children:"Choose Layout Style"}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:s==null?void 0:s.map(ae=>r.jsxs(We,{className:`cursor-pointer transition-all hover:shadow-md overflow-hidden ${(S==null?void 0:S.id)===ae.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>C(ae),children:[r.jsx("div",{className:"h-32 flex items-center justify-center text-white font-bold",style:{background:`linear-gradient(135deg, ${q} 0%, ${q}cc 100%)`},children:r.jsx("span",{className:"text-lg",children:ae.name})}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:ae.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:ae.description})]})]},ae.id))})]})]}),x==="details"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Add listing details"}),r.jsx("p",{className:"text-muted-foreground",children:"Enter the property information and upload a photo"})]}),o&&o.length>0&&r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Ve,{className:"mb-2 block",children:"Quick fill from your listings"}),r.jsxs("select",{className:"w-full p-2 border rounded-md",onChange:ae=>ne(ae.target.value),defaultValue:"",children:[r.jsx("option",{value:"",children:"Select a listing..."}),o.map(ae=>r.jsxs("option",{value:ae.id,children:[ae.property_address,", ",ae.city]},ae.id))]})]})}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsx(We,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Ve,{className:"mb-2 block",children:"Property Photo *"}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center cursor-pointer hover:border-primary transition-colors",onClick:()=>{var ae;return(ae=document.getElementById("photo-upload"))==null?void 0:ae.click()},children:[z?r.jsx("img",{src:z,alt:"Preview",className:"w-full h-48 object-cover rounded"}):r.jsxs("div",{className:"py-8",children:[r.jsx(go,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to upload photo"})]}),r.jsx("input",{id:"photo-upload",type:"file",accept:"image/*",className:"hidden",onChange:be})]})]})}),r.jsx(We,{children:r.jsxs(Xe,{className:"p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Street Address *"}),r.jsx(ct,{value:re.propertyAddress,onChange:ae=>ue({...re,propertyAddress:ae.target.value}),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"City"}),r.jsx(ct,{value:re.propertyCity,onChange:ae=>ue({...re,propertyCity:ae.target.value}),placeholder:"Austin"})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"State"}),r.jsx(ct,{value:re.propertyState,onChange:ae=>ue({...re,propertyState:ae.target.value}),placeholder:"TX"})]})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Price *"}),r.jsx(ct,{type:"number",value:re.propertyPrice,onChange:ae=>ue({...re,propertyPrice:ae.target.value}),placeholder:"450000"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Beds"}),r.jsx(ct,{type:"number",value:re.bedrooms,onChange:ae=>ue({...re,bedrooms:ae.target.value}),placeholder:"3"})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Baths"}),r.jsx(ct,{type:"number",step:"0.5",value:re.bathrooms,onChange:ae=>ue({...re,bathrooms:ae.target.value}),placeholder:"2"})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Sq Ft"}),r.jsx(ct,{type:"number",value:re.squareFeet,onChange:ae=>ue({...re,squareFeet:ae.target.value}),placeholder:"2000"})]})]}),(w==null?void 0:w.slug)==="open-house"&&r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Ve,{children:"Open House Date"}),r.jsx(ct,{type:"date",value:re.openHouseDate,onChange:ae=>ue({...re,openHouseDate:ae.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ve,{children:"Time"}),r.jsx(ct,{value:re.openHouseTime,onChange:ae=>ue({...re,openHouseTime:ae.target.value}),placeholder:"2-4 PM"})]})]}),(w==null?void 0:w.slug)==="price-drop"&&r.jsxs("div",{children:[r.jsx(Ve,{children:"Original Price"}),r.jsx(ct,{type:"number",value:re.originalPrice,onChange:ae=>ue({...re,originalPrice:ae.target.value}),placeholder:"500000"})]})]})})]})]}),x==="preview"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Preview & Download"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose your format and download your listing graphic"})]}),r.jsx(ba,{value:A,onValueChange:ae=>E(ae),className:"w-full",children:r.jsx(fa,{className:"grid w-full grid-cols-4",children:Object.entries(tT).map(([ae,ge])=>r.jsxs(ln,{value:ae,className:"gap-2",children:[ge.icon,r.jsx("span",{className:"hidden sm:inline",children:ge.label})]},ae))})}),r.jsxs("div",{className:"flex justify-center gap-2 mb-4",children:[r.jsx(Ft,{variant:"secondary",children:tT[A].dimensions}),r.jsx(Ft,{variant:"outline",children:tT[A].ratio})]}),r.jsx("div",{className:"flex justify-center",ref:he,children:r.jsx("div",{"data-template":!0,className:"shadow-2xl rounded-lg overflow-hidden",children:r.jsx(AZt,{templateKey:(S==null?void 0:S.template_key)||"modern-minimal",data:ye(),format:A})})}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(J,{size:"lg",onClick:()=>ie(A),disabled:T,children:[T?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download ",tT[A].label]}),r.jsxs(J,{size:"lg",variant:"outline",onClick:fe,disabled:T,children:[r.jsx(Xa,{className:"h-4 w-4 mr-2"}),"Download All Formats"]})]})]}),r.jsxs("div",{className:"flex justify-between mt-8 pt-6 border-t",children:[r.jsxs(J,{variant:"outline",onClick:Ee,disabled:x==="category",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back"]}),x!=="preview"&&r.jsxs(J,{onClick:_e,disabled:!de(),children:["Continue",r.jsx(Ko,{className:"h-4 w-4 ml-2"})]})]})]})}function PZt(){const{isAdmin:e}=zr();return e?r.jsxs(Or,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Listing Swag | LevelUp"}),r.jsx("meta",{name:"description",content:"Create stunning listing graphics for your properties"})]}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/90 to-primary/80 p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('/placeholder.svg')] opacity-5"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Ss,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm font-medium uppercase tracking-wider opacity-90",children:"Marketing Tools"})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Listing Swag"}),r.jsx("p",{className:"text-lg opacity-90 max-w-2xl mb-6",children:"Create beautiful, professional listing graphics in seconds. Choose from stunning templates and download in multiple formats."}),r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Ld,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Unique Styles"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Zo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Export Formats"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Xa,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"Instant Download"})]})]})]})]}),r.jsx(IZt,{})]})]}):r.jsx(tee,{to:"/dashboard",replace:!0})}const LZt=()=>{const e=km();return P.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gray-100",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),r.jsx("p",{className:"mb-4 text-xl text-gray-600",children:"Oops! Page not found"}),r.jsx("a",{href:"/",className:"text-blue-500 underline hover:text-blue-700",children:"Return to Home"})]})})},OZt=new FQe,DZt=()=>{const e=window.location.hostname;return e==="listings.relevelup.com"||e.startsWith("listings.")},RZt=()=>{const e=window.location.hostname;return e==="cards.relevelup.com"||e.startsWith("cards.")},FZt=()=>r.jsx(qQe,{client:OZt,children:r.jsx(HEe,{children:r.jsxs(fI,{children:[r.jsx(sYe,{}),r.jsx(DYe,{}),r.jsx(ret,{children:r.jsx(cnt,{children:r.jsxs(dnt,{children:[r.jsx(unt,{}),r.jsx(yst,{}),RZt()?r.jsx(Xit,{}):DZt()?r.jsx(sit,{}):r.jsxs(KJe,{children:[r.jsx(an,{path:"/",element:r.jsx(lat,{})}),r.jsx(an,{path:"/privacy-policy",element:r.jsx(cat,{})}),r.jsx(an,{path:"/terms-of-service",element:r.jsx(dat,{})}),r.jsx(an,{path:"/data-deletion",element:r.jsx(uat,{})}),r.jsx(an,{path:"/public/listings",element:r.jsx(d6e,{})}),r.jsx(an,{path:"/public/listing/:slugOrId",element:r.jsx(_ft,{})}),r.jsx(an,{path:"/card/:slug",element:r.jsx(bft,{})}),r.jsx(an,{path:"/auth",element:r.jsx($at,{})}),r.jsx(an,{path:"/subscription-success",element:r.jsx(Uat,{})}),r.jsx(an,{path:"/subscription",element:r.jsx(Sn,{children:r.jsx(Mht,{})})}),r.jsx(an,{path:"/share/video",element:r.jsx(gft,{}),children:r.jsx(an,{path:":shareToken",element:r.jsx(mft,{})})}),r.jsx(an,{path:"/og/video/:token",element:r.jsx(xft,{})}),r.jsx(an,{path:"/setup-brokerage",element:r.jsx(Sn,{children:r.jsx(Tht,{})})}),r.jsx(an,{path:"/claim-account",element:r.jsx(pke,{})}),r.jsx(an,{path:"/claim",element:r.jsx(pke,{})}),r.jsx(an,{path:"/join",element:r.jsx(Aht,{})}),r.jsx(an,{path:"/trial",element:r.jsx($ht,{})}),r.jsx(an,{path:"/trial/success",element:r.jsx(Uht,{})}),r.jsx(an,{path:"/dashboard",element:r.jsx(Sn,{children:r.jsx(Npt,{})})}),r.jsx(an,{path:"/profile",element:r.jsx(Sn,{children:r.jsx(amt,{})})}),r.jsx(an,{path:"/apps",element:r.jsx(Sn,{children:r.jsx(vmt,{})})}),r.jsx(an,{path:"/admin",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(xyt,{})})}),r.jsx(an,{path:"/admin/apps",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(_yt,{})})}),r.jsx(an,{path:"/admin/members",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(jyt,{})})}),r.jsx(an,{path:"/admin/invite-codes",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(kyt,{})})}),r.jsx(an,{path:"/admin/events",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ywt,{})})}),r.jsx(an,{path:"/events",element:r.jsx(Sn,{children:r.jsx(gmt,{})})}),r.jsx(an,{path:"/events/:eventId",element:r.jsx(Sn,{children:r.jsx(ymt,{})})}),r.jsx(an,{path:"/templates",element:r.jsx(Sn,{children:r.jsx(_mt,{})})}),r.jsx(an,{path:"/templates/:templateId",element:r.jsx(Sn,{children:r.jsx(kmt,{})})}),r.jsx(an,{path:"/admin/templates",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(vwt,{})})}),r.jsx(an,{path:"/academy",element:r.jsx(Sn,{children:r.jsx(Nmt,{})})}),r.jsx(an,{path:"/academy/:videoId",element:r.jsx(Sn,{children:r.jsx(Cmt,{})})}),r.jsx(an,{path:"/admin/academy",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(bwt,{})})}),r.jsx(an,{path:"/toolbox",element:r.jsx(Sn,{children:r.jsx(Mmt,{})})}),r.jsx(an,{path:"/toolbox/:kitId",element:r.jsx(Sn,{children:r.jsx(Tmt,{})})}),r.jsx(an,{path:"/admin/toolbox",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(wwt,{})})}),r.jsx(an,{path:"/social-swag",element:r.jsx(Sn,{children:r.jsx(Amt,{})})}),r.jsx(an,{path:"/social-swag-2",element:r.jsx(Sn,{children:r.jsx($xt,{})})}),r.jsx(an,{path:"/social-swag/:swagId",element:r.jsx(Sn,{children:r.jsx(Uxt,{})})}),r.jsx(an,{path:"/social-connections",element:r.jsx(Sn,{children:r.jsx(pKt,{})})}),r.jsx(an,{path:"/social-connections/callback",element:r.jsx(Sn,{children:r.jsx(mKt,{})})}),r.jsx(an,{path:"/social-connections/linkedin-callback",element:r.jsx(Sn,{children:r.jsx(xKt,{})})}),r.jsx(an,{path:"/social-connections/google-callback",element:r.jsx(Sn,{children:r.jsx(gKt,{})})}),r.jsx(an,{path:"/admin/social-swag",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(jwt,{})})}),r.jsx(an,{path:"/admin/social-swag-2",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(kwt,{})})}),r.jsx(an,{path:"/community",element:r.jsx(Sn,{children:r.jsx(oyt,{})})}),r.jsx(an,{path:"/support",element:r.jsx(Sn,{children:r.jsx(lyt,{})})}),r.jsx(an,{path:"/admin/community",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Nwt,{})})}),r.jsx(an,{path:"/admin/support-tickets",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Pwt,{})})}),r.jsx(an,{path:"/admin/email-templates",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Dwt,{})})}),r.jsx(an,{path:"/admin/analytics",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Awt,{})})}),r.jsx(an,{path:"/admin/brokerage-resources",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Ewt,{})})}),r.jsx(an,{path:"/admin/dashboard-management",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Iwt,{})})}),r.jsx(an,{path:"/brokerage/dashboard",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(Gwt,{})})}),r.jsx(an,{path:"/my-brokerage",element:r.jsx(Sn,{children:r.jsx(Jwt,{})})}),r.jsx(an,{path:"/brokerage-resources",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(pyt,{})})}),r.jsx(an,{path:"/brokerage-resources/:resourceId",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(myt,{})})}),r.jsx(an,{path:"/newsletters",element:r.jsx(Sn,{children:r.jsx(ejt,{})})}),r.jsx(an,{path:"/newsletters/:id",element:r.jsx(Sn,{children:r.jsx(tjt,{})})}),r.jsx(an,{path:"/wishlist",element:r.jsx(Sn,{children:r.jsx(njt,{})})}),r.jsx(an,{path:"/wishlist/:itemId",element:r.jsx(Sn,{children:r.jsx(sjt,{})})}),r.jsx(an,{path:"/admin/wishlist",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ijt,{})})}),r.jsx(an,{path:"/admin/levelup-brief",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ajt,{})})}),r.jsx(an,{path:"/admin/newsletters",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(rjt,{})})}),r.jsx(an,{path:"/admin/additional-services",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ojt,{})})}),r.jsx(an,{path:"/admin/discounts",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ljt,{})})}),r.jsx(an,{path:"/admin/subscriptions",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(cjt,{})})}),r.jsx(an,{path:"/admin/referrals",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(djt,{})})}),r.jsx(an,{path:"/admin/onboarding-checklist",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(hjt,{})})}),r.jsx(an,{path:"/admin/marketplace",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(KGt,{})})}),r.jsx(an,{path:"/admin/agent-points",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(vGt,{})})}),r.jsx(an,{path:"/admin/reward-store",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(cKt,{})})}),r.jsx(an,{path:"/admin/integrations",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(dKt,{})})}),r.jsx(an,{path:"/admin/integrations/callback",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(fKt,{})})}),r.jsx(an,{path:"/reward-store",element:r.jsx(Sn,{children:r.jsx(NKt,{})})}),r.jsx(an,{path:"/additional-services",element:r.jsx(Sn,{children:r.jsx(jjt,{})})}),r.jsx(an,{path:"/additional-services/:serviceId",element:r.jsx(Sn,{children:r.jsx(kjt,{})})}),r.jsx(an,{path:"/ai-toolkit",element:r.jsx(Sn,{children:r.jsx(Njt,{})})}),r.jsx(an,{path:"/listing-swag",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(PZt,{})})}),r.jsx(an,{path:"/mission-control",element:r.jsx(Sn,{children:r.jsx(Ljt,{})})}),r.jsx(an,{path:"/mission-control/contacts",element:r.jsx(Sn,{children:r.jsx(Gjt,{})})}),r.jsx(an,{path:"/mission-control/contacts/:contactId",element:r.jsx(Sn,{children:r.jsx(lkt,{})})}),r.jsx(an,{path:"/mission-control/plans",element:r.jsx(Sn,{children:r.jsx(ckt,{})})}),r.jsx(an,{path:"/mission-control/popbys",element:r.jsx(Sn,{children:r.jsx(hkt,{})})}),r.jsx(an,{path:"/mission-control/popbys/map",element:r.jsx(Sn,{children:r.jsx(pkt,{})})}),r.jsx(an,{path:"/admin/notification-settings",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(hKt,{})})}),r.jsx(an,{path:"/admin/agent-os",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(pjt,{})})}),r.jsx(an,{path:"/mission-control/listings",element:r.jsx(Sn,{children:r.jsx(XHt,{})})}),r.jsx(an,{path:"/mission-control/listings/new",element:r.jsx(Sn,{children:r.jsx(f5e,{})})}),r.jsx(an,{path:"/mission-control/listings/:listingId",element:r.jsx(Sn,{children:r.jsx(hWt,{})})}),r.jsx(an,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Sn,{children:r.jsx(f5e,{})})}),r.jsx(an,{path:"/admin/listing-exchange",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(fGt,{})})}),r.jsx(an,{path:"/mission-control/pipeline",element:r.jsx(Sn,{children:r.jsx(FWt,{})})}),r.jsx(an,{path:"/mission-control/my-card",element:r.jsx(Sn,{children:r.jsx(sGt,{})})}),r.jsx(an,{path:"/mission-control/scorecard",element:r.jsx(Sn,{children:r.jsx(qHt,{})})}),r.jsx(an,{path:"/admin/scorecard",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(dGt,{})})}),r.jsx(an,{path:"/admin/scorecard/:userId",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(hGt,{})})}),r.jsx(an,{path:"/admin/membership-reviews",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(pGt,{})})}),r.jsx(an,{path:"/admin/weekly-digest",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(xGt,{})})}),r.jsx(an,{path:"/mission-control/video/record",element:r.jsx(Sn,{children:r.jsx(_Wt,{})})}),r.jsx(an,{path:"/mission-control/video-library",element:r.jsx(Sn,{children:r.jsx(kWt,{})})}),r.jsx(an,{path:"/marketplace",element:r.jsx(Sn,{children:r.jsx(yKt,{})})}),r.jsx(an,{path:"/marketplace/:productId",element:r.jsx(Sn,{children:r.jsx(vKt,{})})}),r.jsx(an,{path:"/marketplace/cart",element:r.jsx(Sn,{children:r.jsx(_Kt,{})})}),r.jsx(an,{path:"/marketplace/orders",element:r.jsx(Sn,{children:r.jsx(bKt,{})})}),r.jsx(an,{path:"/marketplace/orders/:orderId",element:r.jsx(Sn,{children:r.jsx(jKt,{})})}),r.jsx(an,{path:"/marketplace/success",element:r.jsx(Sn,{children:r.jsx(kKt,{})})}),r.jsx(an,{path:"/admin/agent-cards",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(_Gt,{})})}),r.jsx(an,{path:"*",element:r.jsx(LZt,{})})]}),")"]})})})]})})});QTe(document.getElementById("root")).render(r.jsx(FZt,{}));