@gauravrathod674/super-customizable-chatbot 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +216 -83
- package/dist/super-customizable-chatbot.es.js +752 -0
- package/dist/super-customizable-chatbot.umd.js +21 -0
- package/package.json +44 -23
- package/dist/custom-chatbot.es.js +0 -6614
- package/dist/custom-chatbot.umd.js +0 -261
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
(function(nt,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("@fortawesome/react-fontawesome"),require("@fortawesome/free-solid-svg-icons"),require("react-markdown")):typeof define=="function"&&define.amd?define(["exports","react","@fortawesome/react-fontawesome","@fortawesome/free-solid-svg-icons","react-markdown"],y):(nt=typeof globalThis<"u"?globalThis:nt||self,y(nt.CustomChatBot={},nt.React,nt.ReactFontAwesome,nt.FontAwesomeIcons,nt.ReactMarkdown))})(this,function(nt,y,yr,vr,br){"use strict";function xr(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Ie=xr(y);var ke={exports:{}},jt={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Xn;function wr(){if(Xn)return jt;Xn=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,i,r){var o=null;if(r!==void 0&&(o=""+r),i.key!==void 0&&(o=""+i.key),"key"in i){r={};for(var a in i)a!=="key"&&(r[a]=i[a])}else r=i;return i=r.ref,{$$typeof:t,type:s,key:o,ref:i!==void 0?i:null,props:r}}return jt.Fragment=e,jt.jsx=n,jt.jsxs=n,jt}var Ft={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Zn;function Tr(){return Zn||(Zn=1,process.env.NODE_ENV!=="production"&&function(){function t(p){if(p==null)return null;if(typeof p=="function")return p.$$typeof===B?null:p.displayName||p.name||null;if(typeof p=="string")return p;switch(p){case v:return"Fragment";case g:return"Profiler";case b:return"StrictMode";case x:return"Suspense";case A:return"SuspenseList";case L:return"Activity"}if(typeof p=="object")switch(typeof p.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),p.$$typeof){case m:return"Portal";case w:return(p.displayName||"Context")+".Provider";case E:return(p._context.displayName||"Context")+".Consumer";case D:var R=p.render;return p=p.displayName,p||(p=R.displayName||R.name||"",p=p!==""?"ForwardRef("+p+")":"ForwardRef"),p;case O:return R=p.displayName||null,R!==null?R:t(p.type)||"Memo";case P:R=p._payload,p=p._init;try{return t(p(R))}catch{}}return null}function e(p){return""+p}function n(p){try{e(p);var R=!1}catch{R=!0}if(R){R=console;var T=R.error,V=typeof Symbol=="function"&&Symbol.toStringTag&&p[Symbol.toStringTag]||p.constructor.name||"Object";return T.call(R,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",V),e(p)}}function s(p){if(p===v)return"<>";if(typeof p=="object"&&p!==null&&p.$$typeof===P)return"<...>";try{var R=t(p);return R?"<"+R+">":"<...>"}catch{return"<...>"}}function i(){var p=Q.A;return p===null?null:p.getOwner()}function r(){return Error("react-stack-top-frame")}function o(p){if(lt.call(p,"key")){var R=Object.getOwnPropertyDescriptor(p,"key").get;if(R&&R.isReactWarning)return!1}return p.key!==void 0}function a(p,R){function T(){At||(At=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",R))}T.isReactWarning=!0,Object.defineProperty(p,"key",{get:T,configurable:!0})}function l(){var p=t(this.type);return he[p]||(he[p]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),p=this.props.ref,p!==void 0?p:null}function u(p,R,T,V,$,G,ut,z){return T=G.ref,p={$$typeof:f,type:p,key:R,props:G,_owner:$},(T!==void 0?T:null)!==null?Object.defineProperty(p,"ref",{enumerable:!1,get:l}):Object.defineProperty(p,"ref",{enumerable:!1,value:null}),p._store={},Object.defineProperty(p._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(p,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(p,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ut}),Object.defineProperty(p,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.freeze&&(Object.freeze(p.props),Object.freeze(p)),p}function c(p,R,T,V,$,G,ut,z){var j=R.children;if(j!==void 0)if(V)if(M(j)){for(V=0;V<j.length;V++)h(j[V]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(j);if(lt.call(R,"key")){j=t(p);var rt=Object.keys(R).filter(function(gr){return gr!=="key"});V=0<rt.length?"{key: someKey, "+rt.join(": ..., ")+": ...}":"{key: someKey}",ct[j+V]||(rt=0<rt.length?"{"+rt.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
-
let props = %s;
|
|
19
|
-
<%s {...props} />
|
|
20
|
-
React keys must be passed directly to JSX without using spread:
|
|
21
|
-
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,V,j,rt,j),ct[j+V]=!0)}if(j=null,T!==void 0&&(n(T),j=""+T),o(R)&&(n(R.key),j=""+R.key),"key"in R){T={};for(var Oe in R)Oe!=="key"&&(T[Oe]=R[Oe])}else T=R;return j&&a(T,typeof p=="function"?p.displayName||p.name||"Unknown":p),u(p,j,G,$,i(),T,ut,z)}function h(p){typeof p=="object"&&p!==null&&p.$$typeof===f&&p._store&&(p._store.validated=1)}var d=y,f=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),w=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),B=Symbol.for("react.client.reference"),Q=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,lt=Object.prototype.hasOwnProperty,M=Array.isArray,vt=console.createTask?console.createTask:function(){return null};d={"react-stack-bottom-frame":function(p){return p()}};var At,he={},N=d["react-stack-bottom-frame"].bind(d,r)(),Y=vt(s(r)),ct={};Ft.Fragment=v,Ft.jsx=function(p,R,T,V,$){var G=1e4>Q.recentlyCreatedOwnerStacks++;return c(p,R,T,!1,V,$,G?Error("react-stack-top-frame"):N,G?vt(s(p)):Y)},Ft.jsxs=function(p,R,T,V,$){var G=1e4>Q.recentlyCreatedOwnerStacks++;return c(p,R,T,!0,V,$,G?Error("react-stack-top-frame"):N,G?vt(s(p)):Y)}}()),Ft}process.env.NODE_ENV==="production"?ke.exports=wr():ke.exports=Tr();var C=ke.exports;const _e=y.createContext({});function Le(t){const e=y.useRef(null);return e.current===null&&(e.current=t()),e.current}const Ne=typeof window<"u",Jn=Ne?y.useLayoutEffect:y.useEffect,de=y.createContext(null),je=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class Cr extends Ie.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=n.offsetParent,i=s instanceof HTMLElement&&s.offsetWidth||0,r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft,r.right=i-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}}function Er({children:t,isPresent:e,anchorX:n}){const s=y.useId(),i=y.useRef(null),r=y.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:o}=y.useContext(je);return y.useInsertionEffect(()=>{const{width:a,height:l,top:u,left:c,right:h}=r.current;if(e||!i.current||!a||!l)return;const d=n==="left"?`left: ${c}`:`right: ${h}`;i.current.dataset.motionPopId=s;const f=document.createElement("style");return o&&(f.nonce=o),document.head.appendChild(f),f.sheet&&f.sheet.insertRule(`
|
|
23
|
-
[data-motion-pop-id="${s}"] {
|
|
24
|
-
position: absolute !important;
|
|
25
|
-
width: ${a}px !important;
|
|
26
|
-
height: ${l}px !important;
|
|
27
|
-
${d}px !important;
|
|
28
|
-
top: ${u}px !important;
|
|
29
|
-
}
|
|
30
|
-
`),()=>{document.head.removeChild(f)}},[e]),C.jsx(Cr,{isPresent:e,childRef:i,sizeRef:r,children:Ie.cloneElement(t,{ref:i})})}const Sr=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:o,anchorX:a})=>{const l=Le(Ar),u=y.useId();let c=!0,h=y.useMemo(()=>(c=!1,{id:u,initial:e,isPresent:n,custom:i,onExitComplete:d=>{l.set(d,!0);for(const f of l.values())if(!f)return;s&&s()},register:d=>(l.set(d,!1),()=>l.delete(d))}),[n,l,s]);return r&&c&&(h={...h}),y.useMemo(()=>{l.forEach((d,f)=>l.set(f,!1))},[n]),Ie.useEffect(()=>{!n&&!l.size&&s&&s()},[n]),o==="popLayout"&&(t=C.jsx(Er,{isPresent:n,anchorX:a,children:t})),C.jsx(de.Provider,{value:h,children:t})};function Ar(){return new Map}function Qn(t=!0){const e=y.useContext(de);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=e,r=y.useId();y.useEffect(()=>{if(t)return i(r)},[t]);const o=y.useCallback(()=>t&&s&&s(r),[r,s,t]);return!n&&s?[!1,o]:[!0]}const fe=t=>t.key||"";function ts(t){const e=[];return y.Children.forEach(t,n=>{y.isValidElement(n)&&e.push(n)}),e}const es=({children:t,custom:e,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:r="sync",propagate:o=!1,anchorX:a="left"})=>{const[l,u]=Qn(o),c=y.useMemo(()=>ts(t),[t]),h=o&&!l?[]:c.map(fe),d=y.useRef(!0),f=y.useRef(c),m=Le(()=>new Map),[v,b]=y.useState(c),[g,E]=y.useState(c);Jn(()=>{d.current=!1,f.current=c;for(let x=0;x<g.length;x++){const A=fe(g[x]);h.includes(A)?m.delete(A):m.get(A)!==!0&&m.set(A,!1)}},[g,h.length,h.join("-")]);const w=[];if(c!==v){let x=[...c];for(let A=0;A<g.length;A++){const O=g[A],P=fe(O);h.includes(P)||(x.splice(A,0,O),w.push(O))}return r==="wait"&&w.length&&(x=w),E(ts(x)),b(c),null}process.env.NODE_ENV!=="production"&&r==="wait"&&g.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:D}=y.useContext(_e);return C.jsx(C.Fragment,{children:g.map(x=>{const A=fe(x),O=o&&!l?!1:c===g||h.includes(A),P=()=>{if(m.has(A))m.set(A,!0);else return;let L=!0;m.forEach(B=>{B||(L=!1)}),L&&(D==null||D(),E(f.current),o&&(u==null||u()),s&&s())};return C.jsx(Sr,{isPresent:O,initial:!d.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:r,onExitComplete:O?void 0:P,anchorX:a,children:x},A)})})};function Fe(t,e){t.indexOf(e)===-1&&t.push(e)}function Be(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}let Pt=()=>{},ht=()=>{};process.env.NODE_ENV!=="production"&&(Pt=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},ht=(t,e)=>{if(!t)throw new Error(e)});const Ue={useManualTiming:!1};function $e(t){let e;return()=>(e===void 0&&(e=t()),e)}const X=t=>t,Bt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s};class Ge{constructor(){this.subscriptions=[]}add(e){return Fe(this.subscriptions,e),()=>Be(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r<i;r++){const o=this.subscriptions[r];o&&o(e,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const tt=t=>t*1e3,st=t=>t/1e3;function ns(t,e){return e?t*(1e3/e):0}const ss=new Set;function me(t,e,n){t||ss.has(e)||(console.warn(e),ss.add(e))}const Pr=$e(()=>window.ScrollTimeline!==void 0);class Mr{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let s=0;s<this.animations.length;s++)this.animations[s][e]=n}attachTimeline(e,n){const s=this.animations.map(i=>{if(Pr()&&i.attachTimeline)return i.attachTimeline(e);if(typeof n=="function")return n(i)});return()=>{s.forEach((i,r)=>{i&&i(),this.animations[r].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Rr extends Mr{then(e,n){return this.finished.finally(e).then(()=>{})}}const is={value:null},Ke=t=>Array.isArray(t)&&typeof t[0]=="number",Dr={};function Vr(t,e){const n=$e(t);return()=>Dr[e]??n()}const Ut=Vr(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),os=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let r=0;r<i;r++)s+=t(r/(i-1))+", ";return`linear(${s.substring(0,s.length-2)})`},$t=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,He={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:$t([0,.65,.55,1]),circOut:$t([.55,0,1,.45]),backIn:$t([.31,.01,.66,-.59]),backOut:$t([.33,1.53,.69,.99])};function rs(t,e){if(t)return typeof t=="function"&&Ut()?os(t,e):Ke(t)?$t(t):Array.isArray(t)?t.map(n=>rs(n,e)||He.easeOut):He[t]}function Or(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:o="loop",ease:a="easeInOut",times:l}={},u=void 0){const c={[e]:n};l&&(c.offset=l);const h=rs(a,i);return Array.isArray(h)&&(c.easing=h),t.animate(c,{delay:s,duration:i,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal",pseudoElement:u})}function We(t){return typeof t=="function"&&"applyToOptions"in t}function Ye(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const pe=2e4;function ze(t){let e=0;const n=50;let s=t.next(e);for(;!s.done&&e<pe;)e+=n,s=t.next(e);return e>=pe?1/0:e}function Ir(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(ze(s),pe);return{type:"keyframes",ease:r=>s.next(i*r).value/e,duration:st(i)}}function as(t){return!!(typeof t=="function"&&Ut()||!t||typeof t=="string"&&(t in He||Ut())||Ke(t)||Array.isArray(t)&&t.every(as))}function ls(t,e){t.timeline=e,t.onfinish=null}const ge=["read","resolveKeyframes","update","preRender","render","postRender"];function kr(t,e){let n=new Set,s=new Set,i=!1,r=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function u(h){o.has(h)&&(c.schedule(h),t()),l++,h(a)}const c={schedule:(h,d=!1,f=!1)=>{const v=f&&i?n:s;return d&&o.add(h),v.has(h)||v.add(h),h},cancel:h=>{s.delete(h),o.delete(h)},process:h=>{if(a=h,i){r=!0;return}i=!0,[n,s]=[s,n],n.forEach(u),e&&is.value&&is.value.frameloop[e].push(l),l=0,n.clear(),i=!1,r&&(r=!1,c.process(h))}};return c}const _r=40;function cs(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=ge.reduce((g,E)=>(g[E]=kr(r,e?E:void 0),g),{}),{read:a,resolveKeyframes:l,update:u,preRender:c,render:h,postRender:d}=o,f=()=>{const g=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(g-i.timestamp,_r),1),i.timestamp=g,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),h.process(i),d.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(f))},m=()=>{n=!0,s=!0,i.isProcessing||t(f)};return{schedule:ge.reduce((g,E)=>{const w=o[E];return g[E]=(D,x=!1,A=!1)=>(n||m(),w.schedule(D,x,A)),g},{}),cancel:g=>{for(let E=0;E<ge.length;E++)o[ge[E]].cancel(g)},state:i,steps:o}}const{schedule:qe}=cs(queueMicrotask,!1),{schedule:I,cancel:dt,state:U,steps:Xe}=cs(typeof requestAnimationFrame<"u"?requestAnimationFrame:X,!0);let ye;function Lr(){ye=void 0}const it={now:()=>(ye===void 0&&it.set(U.isProcessing||Ue.useManualTiming?U.timestamp:performance.now()),ye),set:t=>{ye=t,queueMicrotask(Lr)}},et={x:!1,y:!1};function us(){return et.x||et.y}function Nr(t){return t==="x"||t==="y"?et[t]?null:(et[t]=!0,()=>{et[t]=!1}):et.x||et.y?null:(et.x=et.y=!0,()=>{et.x=et.y=!1})}function jr(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const i=(n==null?void 0:n[t])??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}function hs(t,e){const n=jr(t),s=new AbortController,i={passive:!0,...e,signal:s.signal};return[n,i,()=>s.abort()]}function ds(t){return!(t.pointerType==="touch"||us())}function Fr(t,e,n={}){const[s,i,r]=hs(t,n),o=a=>{if(!ds(a))return;const{target:l}=a,u=e(l,a);if(typeof u!="function"||!l)return;const c=h=>{ds(h)&&(u(h),l.removeEventListener("pointerleave",c))};l.addEventListener("pointerleave",c,i)};return s.forEach(a=>{a.addEventListener("pointerenter",o,i)}),r}const fs=(t,e)=>e?t===e?!0:fs(t,e.parentElement):!1,Ze=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Br=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ur(t){return Br.has(t.tagName)||t.tabIndex!==-1}const Gt=new WeakSet;function ms(t){return e=>{e.key==="Enter"&&t(e)}}function Je(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const $r=(t,e)=>{const n=t.currentTarget;if(!n)return;const s=ms(()=>{if(Gt.has(n))return;Je(n,"down");const i=ms(()=>{Je(n,"up")}),r=()=>Je(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",r,e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)};function ps(t){return Ze(t)&&!us()}function Gr(t,e,n={}){const[s,i,r]=hs(t,n),o=a=>{const l=a.currentTarget;if(!ps(a)||Gt.has(l))return;Gt.add(l);const u=e(l,a),c=(f,m)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",d),!(!ps(f)||!Gt.has(l))&&(Gt.delete(l),typeof u=="function"&&u(f,{success:m}))},h=f=>{c(f,l===window||l===document||n.useGlobalTarget||fs(l,f.target))},d=f=>{c(f,!1)};window.addEventListener("pointerup",h,i),window.addEventListener("pointercancel",d,i)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),a instanceof HTMLElement&&(a.addEventListener("focus",u=>$r(u,i)),!Ur(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),r}const gs=30,Kr=t=>!isNaN(parseFloat(t));class Hr{constructor(e,n={}){this.version="12.7.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{const r=it.now();this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=it.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Kr(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&me(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Ge);const s=this.events[e].add(n);return e==="change"?()=>{s(),I.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=it.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>gs)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,gs);return ns(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Kt(t,e){return new Hr(t,e)}const ys=y.createContext({strict:!1}),vs={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Mt={};for(const t in vs)Mt[t]={isEnabled:e=>vs[t].some(n=>!!e[n])};function Wr(t){for(const e in t)Mt[e]={...Mt[e],...t[e]}}const Yr=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ve(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Yr.has(t)}let bs=t=>!ve(t);function zr(t){t&&(bs=e=>e.startsWith("on")?!ve(e):t(e))}try{zr(require("@emotion/is-prop-valid").default)}catch{}function qr(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(bs(i)||n===!0&&ve(i)||!e&&!ve(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}function Xr(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...s)=>(process.env.NODE_ENV!=="production"&&me(!1,"motion() is deprecated. Use motion.create() instead."),t(...s));return new Proxy(n,{get:(s,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}const be=y.createContext({});function xe(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Ht(t){return typeof t=="string"||Array.isArray(t)}const Qe=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tn=["initial",...Qe];function we(t){return xe(t.animate)||tn.some(e=>Ht(t[e]))}function xs(t){return!!(we(t)||t.variants)}function Zr(t,e){if(we(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Ht(n)?n:void 0,animate:Ht(s)?s:void 0}}return t.inherit!==!1?e:{}}function Jr(t){const{initial:e,animate:n}=Zr(t,y.useContext(be));return y.useMemo(()=>({initial:e,animate:n}),[ws(e),ws(n)])}function ws(t){return Array.isArray(t)?t.join(" "):t}const Qr=Symbol.for("motionComponentSymbol");function Rt(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function ta(t,e,n){return y.useCallback(s=>{s&&t.onMount&&t.onMount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):Rt(n)&&(n.current=s))},[e])}const en=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ts="data-"+en("framerAppearId"),Cs=y.createContext({});function ea(t,e,n,s,i){var v,b;const{visualElement:r}=y.useContext(be),o=y.useContext(ys),a=y.useContext(de),l=y.useContext(je).reducedMotion,u=y.useRef(null);s=s||o.renderer,!u.current&&s&&(u.current=s(t,{visualState:e,parent:r,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const c=u.current,h=y.useContext(Cs);c&&!c.projection&&i&&(c.type==="html"||c.type==="svg")&&na(u.current,n,i,h);const d=y.useRef(!1);y.useInsertionEffect(()=>{c&&d.current&&c.update(n,a)});const f=n[Ts],m=y.useRef(!!f&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,f))&&((b=window.MotionHasOptimisedAnimation)==null?void 0:b.call(window,f)));return Jn(()=>{c&&(d.current=!0,window.MotionIsMounted=!0,c.updateFeatures(),qe.render(c.render),m.current&&c.animationState&&c.animationState.animateChanges())}),y.useEffect(()=>{c&&(!m.current&&c.animationState&&c.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)==null||g.call(window,f)}),m.current=!1))}),c}function na(t,e,n,s){const{layoutId:i,layout:r,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u,layoutCrossfade:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Es(t.parent)),t.projection.setOptions({layoutId:i,layout:r,alwaysMeasureLayout:!!o||a&&Rt(a),visualElement:t,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,crossfade:c,layoutScroll:l,layoutRoot:u})}function Es(t){if(t)return t.options.allowProjection!==!1?t.projection:Es(t.parent)}function sa({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:i}){t&&Wr(t);function r(a,l){let u;const c={...y.useContext(je),...a,layoutId:ia(a)},{isStatic:h}=c,d=Jr(a),f=s(a,h);if(!h&&Ne){oa(c,t);const m=ra(c);u=m.MeasureLayout,d.visualElement=ea(i,f,c,e,m.ProjectionNode)}return C.jsxs(be.Provider,{value:d,children:[u&&d.visualElement?C.jsx(u,{visualElement:d.visualElement,...c}):null,n(i,a,ta(f,d.visualElement,l),f,h,d.visualElement)]})}r.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const o=y.forwardRef(r);return o[Qr]=i,o}function ia({layoutId:t}){const e=y.useContext(_e).id;return e&&t!==void 0?e+"-"+t:t}function oa(t,e){const n=y.useContext(ys).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?Pt(!1,s):ht(!1,s)}}function ra(t){const{drag:e,layout:n}=Mt;if(!e&&!n)return{};const s={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const Ss=t=>e=>typeof e=="string"&&e.startsWith(t),nn=Ss("--"),aa=Ss("var(--"),sn=t=>aa(t)?la.test(t.split("/*")[0].trim()):!1,la=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Wt={};function ca(t){for(const e in t)Wt[e]=t[e],nn(e)&&(Wt[e].isCSSVariable=!0)}const Dt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bt=new Set(Dt);function As(t,{layout:e,layoutId:n}){return bt.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Wt[t]||t==="opacity")}const K=t=>!!(t&&t.getVelocity),Ps=(t,e)=>e&&typeof t=="number"?e.transform(t):t,at=(t,e,n)=>n>e?e:n<t?t:n,Vt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Yt={...Vt,transform:t=>at(0,1,t)},Te={...Vt,default:1},zt=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ft=zt("deg"),ot=zt("%"),S=zt("px"),ua=zt("vh"),ha=zt("vw"),Ms={...ot,parse:t=>ot.parse(t)/100,transform:t=>ot.transform(t*100)},da={borderWidth:S,borderTopWidth:S,borderRightWidth:S,borderBottomWidth:S,borderLeftWidth:S,borderRadius:S,radius:S,borderTopLeftRadius:S,borderTopRightRadius:S,borderBottomRightRadius:S,borderBottomLeftRadius:S,width:S,maxWidth:S,height:S,maxHeight:S,top:S,right:S,bottom:S,left:S,padding:S,paddingTop:S,paddingRight:S,paddingBottom:S,paddingLeft:S,margin:S,marginTop:S,marginRight:S,marginBottom:S,marginLeft:S,backgroundPositionX:S,backgroundPositionY:S},fa={rotate:ft,rotateX:ft,rotateY:ft,rotateZ:ft,scale:Te,scaleX:Te,scaleY:Te,scaleZ:Te,skew:ft,skewX:ft,skewY:ft,distance:S,translateX:S,translateY:S,translateZ:S,x:S,y:S,z:S,perspective:S,transformPerspective:S,opacity:Yt,originX:Ms,originY:Ms,originZ:S},Rs={...Vt,transform:Math.round},on={...da,...fa,zIndex:Rs,size:S,fillOpacity:Yt,strokeOpacity:Yt,numOctaves:Rs},ma={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},pa=Dt.length;function ga(t,e,n){let s="",i=!0;for(let r=0;r<pa;r++){const o=Dt[r],a=t[o];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(o.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||n){const u=Ps(a,on[o]);if(!l){i=!1;const c=ma[o]||o;s+=`${c}(${u}) `}n&&(e[o]=u)}}return s=s.trim(),n?s=n(e,i?"":s):i&&(s="none"),s}function rn(t,e,n){const{style:s,vars:i,transformOrigin:r}=t;let o=!1,a=!1;for(const l in e){const u=e[l];if(bt.has(l)){o=!0;continue}else if(nn(l)){i[l]=u;continue}else{const c=Ps(u,on[l]);l.startsWith("origin")?(a=!0,r[l]=c):s[l]=c}}if(e.transform||(o||n?s.transform=ga(e,t.transform,n):s.transform&&(s.transform="none")),a){const{originX:l="50%",originY:u="50%",originZ:c=0}=r;s.transformOrigin=`${l} ${u} ${c}`}}const an=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ds(t,e,n){for(const s in e)!K(e[s])&&!As(s,n)&&(t[s]=e[s])}function ya({transformTemplate:t},e){return y.useMemo(()=>{const n=an();return rn(n,e,t),Object.assign({},n.vars,n.style)},[e])}function va(t,e){const n=t.style||{},s={};return Ds(s,n,t),Object.assign(s,ya(t,e)),s}function ba(t,e){const n={},s=va(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=s,n}const xa=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ln(t){return typeof t!="string"||t.includes("-")?!1:!!(xa.indexOf(t)>-1||/[A-Z]/u.test(t))}const wa={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ta={offset:"strokeDashoffset",array:"strokeDasharray"};function Ca(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?wa:Ta;t[r.offset]=S.transform(-s);const o=S.transform(e),a=S.transform(n);t[r.array]=`${o} ${a}`}function Vs(t,e,n){return typeof t=="string"?t:S.transform(e+n*t)}function Ea(t,e,n){const s=Vs(e,t.x,t.width),i=Vs(n,t.y,t.height);return`${s} ${i}`}function cn(t,{attrX:e,attrY:n,attrScale:s,originX:i,originY:r,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},c,h){if(rn(t,u,h),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:d,style:f,dimensions:m}=t;d.transform&&(m&&(f.transform=d.transform),delete d.transform),m&&(i!==void 0||r!==void 0||f.transform)&&(f.transformOrigin=Ea(m,i!==void 0?i:.5,r!==void 0?r:.5)),e!==void 0&&(d.x=e),n!==void 0&&(d.y=n),s!==void 0&&(d.scale=s),o!==void 0&&Ca(d,o,a,l,!1)}const Os=()=>({...an(),attrs:{}}),un=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Sa(t,e,n,s){const i=y.useMemo(()=>{const r=Os();return cn(r,e,un(s),t.transformTemplate),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};Ds(r,t.style,t),i.style={...r,...i.style}}return i}function Aa(t=!1){return(n,s,i,{latestValues:r},o)=>{const l=(ln(n)?Sa:ba)(s,r,o,n),u=qr(s,typeof n=="string",t),c=n!==y.Fragment?{...u,...l,ref:i}:{},{children:h}=s,d=y.useMemo(()=>K(h)?h.get():h,[h]);return y.createElement(n,{...c,children:d})}}function Is(t){const e=[{},{}];return t==null||t.values.forEach((n,s)=>{e[0][s]=n.get(),e[1][s]=n.getVelocity()}),e}function hn(t,e,n,s){if(typeof e=="function"){const[i,r]=Is(s);e=e(n!==void 0?n:t.custom,i,r)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,r]=Is(s);e=e(n!==void 0?n:t.custom,i,r)}return e}const dn=t=>Array.isArray(t),Pa=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),Ma=t=>dn(t)?t[t.length-1]||0:t;function Ce(t){const e=K(t)?t.get():t;return Pa(e)?e.toValue():e}function Ra({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},s,i,r){const o={latestValues:Da(s,i,r,t),renderState:e()};return n&&(o.onMount=a=>n({props:s,current:a,...o}),o.onUpdate=a=>n(a)),o}const ks=t=>(e,n)=>{const s=y.useContext(be),i=y.useContext(de),r=()=>Ra(t,e,s,i);return n?r():Le(r)};function Da(t,e,n,s){const i={},r=s(t,{});for(const d in r)i[d]=Ce(r[d]);let{initial:o,animate:a}=t;const l=we(t),u=xs(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const h=c?a:o;if(h&&typeof h!="boolean"&&!xe(h)){const d=Array.isArray(h)?h:[h];for(let f=0;f<d.length;f++){const m=hn(t,d[f]);if(m){const{transitionEnd:v,transition:b,...g}=m;for(const E in g){let w=g[E];if(Array.isArray(w)){const D=c?w.length-1:0;w=w[D]}w!==null&&(i[E]=w)}for(const E in v)i[E]=v[E]}}}return i}function fn(t,e,n){var r;const{style:s}=t,i={};for(const o in s)(K(s[o])||e.style&&K(e.style[o])||As(o,t)||((r=n==null?void 0:n.getValue(o))==null?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}const Va={useVisualState:ks({scrapeMotionValuesFromProps:fn,createRenderState:an})};function _s(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}function Ls(t,{style:e,vars:n},s,i){Object.assign(t.style,e,i&&i.getProjectionStyles(s));for(const r in n)t.style.setProperty(r,n[r])}const Ns=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function js(t,e,n,s){Ls(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(Ns.has(i)?i:en(i),e.attrs[i])}function Fs(t,e,n){const s=fn(t,e,n);for(const i in t)if(K(t[i])||K(e[i])){const r=Dt.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[r]=t[i]}return s}const Bs=["x","y","width","height","cx","cy","r"],Oa={useVisualState:ks({scrapeMotionValuesFromProps:Fs,createRenderState:Os,onUpdate:({props:t,prevProps:e,current:n,renderState:s,latestValues:i})=>{if(!n)return;let r=!!t.drag;if(!r){for(const a in i)if(bt.has(a)){r=!0;break}}if(!r)return;let o=!e;if(e)for(let a=0;a<Bs.length;a++){const l=Bs[a];t[l]!==e[l]&&(o=!0)}o&&I.read(()=>{_s(n,s),I.render(()=>{cn(s,i,un(n.tagName),t.transformTemplate),js(n,s)})})}})};function Ia(t,e){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...ln(s)?Oa:Va,preloadedFeatures:t,useRender:Aa(i),createVisualElement:e,Component:s};return sa(o)}}function qt(t,e,n){const s=t.getProps();return hn(s,e,n!==void 0?n:s.custom,t)}const Us=new Set(["width","height","top","left","right","bottom",...Dt]);function ka(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Kt(n))}function _a(t,e){const n=qt(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const o in r){const a=Ma(r[o]);ka(t,o,a)}}function La(t){return!!(K(t)&&t.add)}function mn(t,e){const n=t.getValue("willChange");if(La(n))return n.add(e);if(!n&&Ue.WillChange){const s=new Ue.WillChange("auto");t.addValue("willChange",s),s.add(e)}}function $s(t){return t.props[Ts]}const Gs=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Na=1e-7,ja=12;function Fa(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=Gs(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>Na&&++a<ja);return o}function Xt(t,e,n,s){if(t===e&&n===s)return X;const i=r=>Fa(r,0,1,t,n);return r=>r===0||r===1?r:Gs(i(r),e,s)}const Ks=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Hs=t=>e=>1-t(1-e),Ws=Xt(.33,1.53,.69,.99),pn=Hs(Ws),Ys=Ks(pn),zs=t=>(t*=2)<1?.5*pn(t):.5*(2-Math.pow(2,-10*(t-1))),gn=t=>1-Math.sin(Math.acos(t)),qs=Hs(gn),Xs=Ks(gn),Zs=t=>/^0[^.\s]+$/u.test(t);function Ba(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Zs(t):!0}const Zt=t=>Math.round(t*1e5)/1e5,yn=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ua(t){return t==null}const $a=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,vn=(t,e)=>n=>!!(typeof n=="string"&&$a.test(n)&&n.startsWith(t)||e&&!Ua(n)&&Object.prototype.hasOwnProperty.call(n,e)),Js=(t,e,n)=>s=>{if(typeof s!="string")return s;const[i,r,o,a]=s.match(yn);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Ga=t=>at(0,255,t),bn={...Vt,transform:t=>Math.round(Ga(t))},xt={test:vn("rgb","red"),parse:Js("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+bn.transform(t)+", "+bn.transform(e)+", "+bn.transform(n)+", "+Zt(Yt.transform(s))+")"};function Ka(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const xn={test:vn("#"),parse:Ka,transform:xt.transform},Ot={test:vn("hsl","hue"),parse:Js("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+ot.transform(Zt(e))+", "+ot.transform(Zt(n))+", "+Zt(Yt.transform(s))+")"},H={test:t=>xt.test(t)||xn.test(t)||Ot.test(t),parse:t=>xt.test(t)?xt.parse(t):Ot.test(t)?Ot.parse(t):xn.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?xt.transform(t):Ot.transform(t)},Ha=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Wa(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(yn))==null?void 0:e.length)||0)+(((n=t.match(Ha))==null?void 0:n.length)||0)>0}const Qs="number",ti="color",Ya="var",za="var(",ei="${}",qa=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Jt(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(qa,l=>(H.test(l)?(s.color.push(r),i.push(ti),n.push(H.parse(l))):l.startsWith(za)?(s.var.push(r),i.push(Ya),n.push(l)):(s.number.push(r),i.push(Qs),n.push(parseFloat(l))),++r,ei)).split(ei);return{values:n,split:a,indexes:s,types:i}}function ni(t){return Jt(t).values}function si(t){const{split:e,types:n}=Jt(t),s=e.length;return i=>{let r="";for(let o=0;o<s;o++)if(r+=e[o],i[o]!==void 0){const a=n[o];a===Qs?r+=Zt(i[o]):a===ti?r+=H.transform(i[o]):r+=i[o]}return r}}const Xa=t=>typeof t=="number"?0:t;function Za(t){const e=ni(t);return si(t)(e.map(Xa))}const mt={test:Wa,parse:ni,createTransformer:si,getAnimatableNone:Za},Ja=new Set(["brightness","contrast","saturate","opacity"]);function Qa(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(yn)||[];if(!s)return t;const i=n.replace(s,"");let r=Ja.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const tl=/\b([a-z-]*)\(.*?\)/gu,wn={...mt,getAnimatableNone:t=>{const e=t.match(tl);return e?e.map(Qa).join(" "):t}},el={...on,color:H,backgroundColor:H,outlineColor:H,fill:H,stroke:H,borderColor:H,borderTopColor:H,borderRightColor:H,borderBottomColor:H,borderLeftColor:H,filter:wn,WebkitFilter:wn},ii=t=>el[t];function oi(t,e){let n=ii(t);return n!==wn&&(n=mt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const nl=new Set(["auto","none","0"]);function sl(t,e,n){let s=0,i;for(;s<t.length&&!i;){const r=t[s];typeof r=="string"&&!nl.has(r)&&Jt(r).values.length&&(i=t[s]),s++}if(i&&n)for(const r of e)t[r]=oi(n,i)}const wt=t=>t*180/Math.PI,Tn=t=>{const e=wt(Math.atan2(t[1],t[0]));return Cn(e)},il={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Tn,rotateZ:Tn,skewX:t=>wt(Math.atan(t[1])),skewY:t=>wt(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Cn=t=>(t=t%360,t<0&&(t+=360),t),ri=Tn,ai=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),li=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),ol={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ai,scaleY:li,scale:t=>(ai(t)+li(t))/2,rotateX:t=>Cn(wt(Math.atan2(t[6],t[5]))),rotateY:t=>Cn(wt(Math.atan2(-t[2],t[0]))),rotateZ:ri,rotate:ri,skewX:t=>wt(Math.atan(t[4])),skewY:t=>wt(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function ci(t){return t.includes("scale")?1:0}function En(t,e){if(!t||t==="none")return ci(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=ol,i=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=il,i=a}if(!i)return ci(e);const r=s[e],o=i[1].split(",").map(al);return typeof r=="function"?r(o):o[r]}const rl=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return En(n,e)};function al(t){return parseFloat(t.trim())}const ui=t=>t===Vt||t===S,ll=new Set(["x","y","z"]),cl=Dt.filter(t=>!ll.has(t));function ul(t){const e=[];return cl.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}const It={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>En(e,"x"),y:(t,{transform:e})=>En(e,"y")};It.translateX=It.x,It.translateY=It.y;const Tt=new Set;let Sn=!1,An=!1;function hi(){if(An){const t=Array.from(Tt).filter(s=>s.needsMeasurement),e=new Set(t.map(s=>s.element)),n=new Map;e.forEach(s=>{const i=ul(s);i.length&&(n.set(s,i),s.render())}),t.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([r,o])=>{var a;(a=s.getValue(r))==null||a.set(o)})}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}An=!1,Sn=!1,Tt.forEach(t=>t.complete()),Tt.clear()}function di(){Tt.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(An=!0)})}function hl(){di(),hi()}class Pn{constructor(e,n,s,i,r,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=s,this.motionValue=i,this.element=r,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Tt.add(this),Sn||(Sn=!0,I.read(di),I.resolveKeyframes(hi))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:s,motionValue:i}=this;for(let r=0;r<e.length;r++)if(e[r]===null)if(r===0){const o=i==null?void 0:i.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(s&&n){const l=s.readValue(n,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),i&&o===void 0&&i.set(e[0])}else e[r]=e[r-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Tt.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Tt.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const fi=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),dl=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fl(t){const e=dl.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}const ml=4;function mi(t,e,n=1){ht(n<=ml,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[s,i]=fl(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const o=r.trim();return fi(o)?parseFloat(o):o}return sn(i)?mi(i,e,n+1):i}const pi=t=>e=>e.test(t),gi=[Vt,S,ot,ft,ha,ua,{test:t=>t==="auto",parse:t=>t}],yi=t=>gi.find(pi(t));class vi extends Pn{constructor(e,n,s,i,r){super(e,n,s,i,r,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let u=e[l];if(typeof u=="string"&&(u=u.trim(),sn(u))){const c=mi(u,n.current);c!==void 0&&(e[l]=c),l===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Us.has(s)||e.length!==2)return;const[i,r]=e,o=yi(i),a=yi(r);if(o!==a)if(ui(o)&&ui(a))for(let l=0;l<e.length;l++){const u=e[l];typeof u=="string"&&(e[l]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,s=[];for(let i=0;i<e.length;i++)Ba(e[i])&&s.push(i);s.length&&sl(e,s,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=It[s](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(s,i).jump(i,!1)}measureEndState(){var a;const{element:e,name:n,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const r=s.length-1,o=s[r];s[r]=It[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,u])=>{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const bi=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(mt.test(t)||t==="0")&&!t.startsWith("url("));function pl(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function gl(t,e,n,s){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const r=t[t.length-1],o=bi(i,e),a=bi(r,e);return Pt(o===a,`You are trying to animate ${e} from "${i}" to "${r}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${r} via the \`style\` property.`),!o||!a?!1:pl(t)||(n==="spring"||We(n))&&s}const yl=t=>t!==null;function Ee(t,{repeat:e,repeatType:n="loop"},s){const i=t.filter(yl),r=e&&n!=="loop"&&e%2===1?0:i.length-1;return!r||s===void 0?i[r]:s}const vl=40;class xi{constructor({autoplay:e=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=it.now(),this.options={autoplay:e,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:o,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>vl?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&hl(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=it.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:r,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!gl(e,s,i,r))if(o)this.options.duration=0;else{l&&l(Ee(e,this.options,n)),a&&a(),this.resolveFinishedPromise();return}const c=this.initPlayback(e,n);c!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const k=(t,e,n)=>t+(e-t)*n;function Mn(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function bl({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;i=Mn(l,a,t+1/3),r=Mn(l,a,t),o=Mn(l,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}function Se(t,e){return n=>n>0?e:t}const Rn=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},xl=[xn,xt,Ot],wl=t=>xl.find(e=>e.test(t));function wi(t){const e=wl(t);if(Pt(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let n=e.parse(t);return e===Ot&&(n=bl(n)),n}const Ti=(t,e)=>{const n=wi(t),s=wi(e);if(!n||!s)return Se(t,e);const i={...n};return r=>(i.red=Rn(n.red,s.red,r),i.green=Rn(n.green,s.green,r),i.blue=Rn(n.blue,s.blue,r),i.alpha=k(n.alpha,s.alpha,r),xt.transform(i))},Tl=(t,e)=>n=>e(t(n)),Qt=(...t)=>t.reduce(Tl),Dn=new Set(["none","hidden"]);function Cl(t,e){return Dn.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function El(t,e){return n=>k(t,e,n)}function Vn(t){return typeof t=="number"?El:typeof t=="string"?sn(t)?Se:H.test(t)?Ti:Pl:Array.isArray(t)?Ci:typeof t=="object"?H.test(t)?Ti:Sl:Se}function Ci(t,e){const n=[...t],s=n.length,i=t.map((r,o)=>Vn(r)(r,e[o]));return r=>{for(let o=0;o<s;o++)n[o]=i[o](r);return n}}function Sl(t,e){const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=Vn(t[i])(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}}function Al(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],o=t.indexes[r][s[r]],a=t.values[o]??0;n[i]=a,s[r]++}return n}const Pl=(t,e)=>{const n=mt.createTransformer(e),s=Jt(t),i=Jt(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?Dn.has(t)&&!i.values.length||Dn.has(e)&&!s.values.length?Cl(t,e):Qt(Ci(Al(s,i),i.values),n):(Pt(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Se(t,e))};function Ei(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?k(t,e,n):Vn(t)(t,e)}const Ml=5;function Si(t,e,n){const s=Math.max(e-Ml,0);return ns(n-t(s),e-s)}const _={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},On=.001;function Rl({duration:t=_.duration,bounce:e=_.bounce,velocity:n=_.velocity,mass:s=_.mass}){let i,r;Pt(t<=tt(_.maxDuration),"Spring duration must be 10 seconds or less");let o=1-e;o=at(_.minDamping,_.maxDamping,o),t=at(_.minDuration,_.maxDuration,st(t)),o<1?(i=u=>{const c=u*o,h=c*t,d=c-n,f=In(u,o),m=Math.exp(-h);return On-d/f*m},r=u=>{const h=u*o*t,d=h*n+n,f=Math.pow(o,2)*Math.pow(u,2)*t,m=Math.exp(-h),v=In(Math.pow(u,2),o);return(-i(u)+On>0?-1:1)*((d-f)*m)/v}):(i=u=>{const c=Math.exp(-u*t),h=(u-n)*t+1;return-On+c*h},r=u=>{const c=Math.exp(-u*t),h=(n-u)*(t*t);return c*h});const a=5/t,l=Vl(i,r,a);if(t=tt(t),isNaN(l))return{stiffness:_.stiffness,damping:_.damping,duration:t};{const u=Math.pow(l,2)*s;return{stiffness:u,damping:o*2*Math.sqrt(s*u),duration:t}}}const Dl=12;function Vl(t,e,n){let s=n;for(let i=1;i<Dl;i++)s=s-t(s)/e(s);return s}function In(t,e){return t*Math.sqrt(1-e*e)}const Ol=["duration","bounce"],Il=["stiffness","damping","mass"];function Ai(t,e){return e.some(n=>t[n]!==void 0)}function kl(t){let e={velocity:_.velocity,stiffness:_.stiffness,damping:_.damping,mass:_.mass,isResolvedFromDuration:!1,...t};if(!Ai(t,Il)&&Ai(t,Ol))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*at(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:_.mass,stiffness:i,damping:r}}else{const n=Rl(t);e={...e,...n,mass:_.mass},e.isResolvedFromDuration=!0}return e}function Ae(t=_.visualDuration,e=_.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:l,damping:u,mass:c,duration:h,velocity:d,isResolvedFromDuration:f}=kl({...n,velocity:-st(n.velocity||0)}),m=d||0,v=u/(2*Math.sqrt(l*c)),b=o-r,g=st(Math.sqrt(l/c)),E=Math.abs(b)<5;s||(s=E?_.restSpeed.granular:_.restSpeed.default),i||(i=E?_.restDelta.granular:_.restDelta.default);let w;if(v<1){const x=In(g,v);w=A=>{const O=Math.exp(-v*g*A);return o-O*((m+v*g*b)/x*Math.sin(x*A)+b*Math.cos(x*A))}}else if(v===1)w=x=>o-Math.exp(-g*x)*(b+(m+g*b)*x);else{const x=g*Math.sqrt(v*v-1);w=A=>{const O=Math.exp(-v*g*A),P=Math.min(x*A,300);return o-O*((m+v*g*b)*Math.sinh(P)+x*b*Math.cosh(P))/x}}const D={calculatedDuration:f&&h||null,next:x=>{const A=w(x);if(f)a.done=x>=h;else{let O=0;v<1&&(O=x===0?tt(m):Si(w,x,A));const P=Math.abs(O)<=s,L=Math.abs(o-A)<=i;a.done=P&&L}return a.value=a.done?o:A,a},toString:()=>{const x=Math.min(ze(D),pe),A=os(O=>D.next(x*O).value,x,30);return x+"ms "+A},toTransition:()=>{}};return D}Ae.applyToOptions=t=>{const e=Ir(t,100,Ae);return t.ease=Ut()?e.ease:"easeOut",t.duration=tt(e.duration),t.type="keyframes",t};function Pi({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},f=P=>a!==void 0&&P<a||l!==void 0&&P>l,m=P=>a===void 0?l:l===void 0||Math.abs(a-P)<Math.abs(l-P)?a:l;let v=n*e;const b=h+v,g=o===void 0?b:o(b);g!==b&&(v=g-h);const E=P=>-v*Math.exp(-P/s),w=P=>g+E(P),D=P=>{const L=E(P),B=w(P);d.done=Math.abs(L)<=u,d.value=d.done?g:B};let x,A;const O=P=>{f(d.value)&&(x=P,A=Ae({keyframes:[d.value,m(d.value)],velocity:Si(w,P,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:c}))};return O(0),{calculatedDuration:null,next:P=>{let L=!1;return!A&&x===void 0&&(L=!0,D(P),O(P)),x!==void 0&&P>=x?A.next(P-x):(!L&&D(P),d)}}}const _l=Xt(.42,0,1,1),Ll=Xt(0,0,.58,1),Mi=Xt(.42,0,.58,1),Nl=t=>Array.isArray(t)&&typeof t[0]!="number",Ri={linear:X,easeIn:_l,easeInOut:Mi,easeOut:Ll,circIn:gn,circInOut:Xs,circOut:qs,backIn:pn,backInOut:Ys,backOut:Ws,anticipate:zs},Di=t=>{if(Ke(t)){ht(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,n,s,i]=t;return Xt(e,n,s,i)}else if(typeof t=="string")return ht(Ri[t]!==void 0,`Invalid easing type '${t}'`),Ri[t];return t};function jl(t,e,n){const s=[],i=n||Ei,r=t.length-1;for(let o=0;o<r;o++){let a=i(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||X:e;a=Qt(l,a)}s.push(a)}return s}function Fl(t,e,{clamp:n=!0,ease:s,mixer:i}={}){const r=t.length;if(ht(r===e.length,"Both input and output ranges must be the same length"),r===1)return()=>e[0];if(r===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=jl(e,s,i),l=a.length,u=c=>{if(o&&c<t[0])return e[0];let h=0;if(l>1)for(;h<t.length-2&&!(c<t[h+1]);h++);const d=Bt(t[h],t[h+1],c);return a[h](d)};return n?c=>u(at(t[0],t[r-1],c)):u}function Bl(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=Bt(0,e,s);t.push(k(n,1,i))}}function Ul(t){const e=[0];return Bl(e,t.length-1),e}function $l(t,e){return t.map(n=>n*e)}function Gl(t,e){return t.map(()=>e||Mi).splice(0,t.length-1)}function te({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=Nl(s)?s.map(Di):Di(s),r={done:!1,value:e[0]},o=$l(n&&n.length===e.length?n:Ul(e),t),a=Fl(o,e,{ease:Array.isArray(i)?i:Gl(e,i)});return{calculatedDuration:t,next:l=>(r.value=a(l),r.done=l>=t,r)}}const Kl=t=>{const e=({timestamp:n})=>t(n);return{start:()=>I.update(e,!0),stop:()=>dt(e),now:()=>U.isProcessing?U.timestamp:it.now()}},Hl={decay:Pi,inertia:Pi,tween:te,keyframes:te,spring:Ae},Wl=t=>t/100;class kn extends xi{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:s,element:i,keyframes:r}=this.options,o=(i==null?void 0:i.KeyframeResolver)||Pn,a=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new o(r,a,n,s,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:o=0}=this.options,a=We(n)?n:Hl[n]||te;let l,u;process.env.NODE_ENV!=="production"&&a!==te&&ht(e.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),a!==te&&typeof e[0]!="number"&&(l=Qt(Wl,Ei(e[0],e[1])),e=[0,100]);const c=a({...this.options,keyframes:e});r==="mirror"&&(u=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=ze(c));const{calculatedDuration:h}=c,d=h+i,f=d*(s+1)-i;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:h,resolvedDuration:d,totalDuration:f}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:s}=this;if(!s){const{keyframes:P}=this.options;return{done:!0,value:P[P.length-1]}}const{finalKeyframe:i,generator:r,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:h}=s;if(this.startTime===null)return r.next(0);const{delay:d,repeat:f,repeatType:m,repeatDelay:v,onUpdate:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const g=this.currentTime-d*(this.speed>=0?1:-1),E=this.speed>=0?g<0:g>c;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let w=this.currentTime,D=r;if(f){const P=Math.min(this.currentTime,c)/h;let L=Math.floor(P),B=P%1;!B&&P>=1&&(B=1),B===1&&L--,L=Math.min(L,f+1),!!(L%2)&&(m==="reverse"?(B=1-B,v&&(B-=v/h)):m==="mirror"&&(D=o)),w=at(0,1,B)*h}const x=E?{done:!1,value:l[0]}:D.next(w);a&&(x.value=a(x.value));let{done:A}=x;!E&&u!==null&&(A=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return O&&i!==void 0&&(x.value=Ee(l,this.options,i)),b&&b(x.value),O&&this.finish(),x}get duration(){const{resolved:e}=this;return e?st(e.calculatedDuration):0}get time(){return st(this.currentTime)}set time(e){e=tt(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=st(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Kl,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=e(r=>this.tick(r))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=s??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=this.currentTime??0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}get finished(){return this.currentFinishedPromise}}const Yl=new Set(["opacity","clipPath","filter","transform"]),zl=$e(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Pe=10,ql=2e4;function Xl(t){return We(t.type)||t.type==="spring"||!as(t.ease)}function Zl(t,e){const n=new kn({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const i=[];let r=0;for(;!s.done&&r<ql;)s=n.sample(r),i.push(s.value),r+=Pe;return{times:void 0,keyframes:i,duration:r-Pe,ease:"linear"}}const Vi={anticipate:zs,backInOut:Ys,circInOut:Xs};function Jl(t){return t in Vi}class Oi extends xi{constructor(e){super(e);const{name:n,motionValue:s,element:i,keyframes:r}=this.options;this.resolver=new vi(r,(o,a)=>this.onKeyframesResolved(o,a),n,s,i),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:s=300,times:i,ease:r,type:o,motionValue:a,name:l,startTime:u}=this.options;if(!a.owner||!a.owner.current)return!1;if(typeof r=="string"&&Ut()&&Jl(r)&&(r=Vi[r]),Xl(this.options)){const{onComplete:h,onUpdate:d,motionValue:f,element:m,...v}=this.options,b=Zl(e,v);e=b.keyframes,e.length===1&&(e[1]=e[0]),s=b.duration,i=b.times,r=b.ease,o="keyframes"}const c=Or(a.owner.current,l,e,{...this.options,duration:s,times:i,ease:r});return c.startTime=u??this.calcStartTime(),this.pendingTimeline?(ls(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:h}=this.options;a.set(Ee(e,this.options,n)),h&&h(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:s,times:i,type:o,ease:r,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return st(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return st(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=tt(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}get finished(){return this.resolved.animation.finished}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return X;const{animation:s}=n;ls(s,e)}return X}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:s,duration:i,type:r,ease:o,times:a}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:c,onComplete:h,element:d,...f}=this.options,m=new kn({...f,keyframes:s,duration:i,type:r,ease:o,times:a,isGenerator:!0}),v=tt(this.time);u.setWithVelocity(m.sample(v-Pe).value,m.sample(v).value,Pe)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:s,repeatDelay:i,repeatType:r,damping:o,type:a}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=n.owner.getProps();return zl()&&s&&Yl.has(s)&&(s!=="transform"||!u)&&!l&&!i&&r!=="mirror"&&o!==0&&a!=="inertia"}}const Ql={type:"spring",stiffness:500,damping:25,restSpeed:10},tc=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),ec={type:"keyframes",duration:.8},nc={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sc=(t,{keyframes:e})=>e.length>2?ec:bt.has(t)?t.startsWith("scale")?tc(e[1]):Ql:nc;function ic({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}const _n=(t,e,n,s={},i,r)=>o=>{const a=Ye(s,t)||{},l=a.delay||s.delay||0;let{elapsed:u=0}=s;u=u-tt(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:i};ic(a)||(c={...c,...sc(t,c)}),c.duration&&(c.duration=tt(c.duration)),c.repeatDelay&&(c.repeatDelay=tt(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let h=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(h=!0)),c.allowFlatten=!a.type&&!a.ease,h&&!r&&e.get()!==void 0){const d=Ee(c.keyframes,a);if(d!==void 0)return I.update(()=>{c.onUpdate(d),c.onComplete()}),new Rr([])}return!r&&Oi.supports(c)?new Oi(c):new kn(c)};function oc({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}function Ii(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=e;s&&(r=s);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const c in a){const h=t.getValue(c,t.latestValues[c]??null),d=a[c];if(d===void 0||u&&oc(u,c))continue;const f={delay:n,...Ye(r||{},c)};let m=!1;if(window.MotionHandoffAnimation){const b=$s(t);if(b){const g=window.MotionHandoffAnimation(b,c,I);g!==null&&(f.startTime=g,m=!0)}}mn(t,c),h.start(_n(c,h,d,t.shouldReduceMotion&&Us.has(c)?{type:!1}:f,t,m));const v=h.animation;v&&l.push(v)}return o&&Promise.all(l).then(()=>{I.update(()=>{o&&_a(t,o)})}),l}function Ln(t,e,n={}){var l;const s=qt(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Promise.all(Ii(t,s,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:h,staggerDirection:d}=i;return rc(t,e,c+u,h,d,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[u,c]=a==="beforeChildren"?[r,o]:[o,r];return u().then(()=>c())}else return Promise.all([r(),o(n.delay)])}function rc(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,l=i===1?(u=0)=>u*s:(u=0)=>a-u*s;return Array.from(t.variantChildren).sort(ac).forEach((u,c)=>{u.notify("AnimationStart",e),o.push(Ln(u,e,{...r,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function ac(t,e){return t.sortNodePosition(e)}function lc(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>Ln(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=Ln(t,e,n);else{const i=typeof e=="function"?qt(t,e,n.custom):e;s=Promise.all(Ii(t,i,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}function ki(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const cc=tn.length;function _i(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?_i(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<cc;n++){const s=tn[n],i=t.props[s];(Ht(i)||i===!1)&&(e[s]=i)}return e}const uc=[...Qe].reverse(),hc=Qe.length;function dc(t){return e=>Promise.all(e.map(({animation:n,options:s})=>lc(t,n,s)))}function fc(t){let e=dc(t),n=Li(),s=!0;const i=l=>(u,c)=>{var d;const h=qt(t,c,l==="exit"?(d=t.presenceContext)==null?void 0:d.custom:void 0);if(h){const{transition:f,transitionEnd:m,...v}=h;u={...u,...v,...m}}return u};function r(l){e=l(t)}function o(l){const{props:u}=t,c=_i(t.parent)||{},h=[],d=new Set;let f={},m=1/0;for(let b=0;b<hc;b++){const g=uc[b],E=n[g],w=u[g]!==void 0?u[g]:c[g],D=Ht(w),x=g===l?E.isActive:null;x===!1&&(m=b);let A=w===c[g]&&w!==u[g]&&D;if(A&&s&&t.manuallyAnimateOnMount&&(A=!1),E.protectedKeys={...f},!E.isActive&&x===null||!w&&!E.prevProp||xe(w)||typeof w=="boolean")continue;const O=mc(E.prevProp,w);let P=O||g===l&&E.isActive&&!A&&D||b>m&&D,L=!1;const B=Array.isArray(w)?w:[w];let Q=B.reduce(i(g),{});x===!1&&(Q={});const{prevResolvedValues:lt={}}=E,M={...lt,...Q},vt=N=>{P=!0,d.has(N)&&(L=!0,d.delete(N)),E.needsAnimating[N]=!0;const Y=t.getValue(N);Y&&(Y.liveStyle=!1)};for(const N in M){const Y=Q[N],ct=lt[N];if(f.hasOwnProperty(N))continue;let p=!1;dn(Y)&&dn(ct)?p=!ki(Y,ct):p=Y!==ct,p?Y!=null?vt(N):d.add(N):Y!==void 0&&d.has(N)?vt(N):E.protectedKeys[N]=!0}E.prevProp=w,E.prevResolvedValues=Q,E.isActive&&(f={...f,...Q}),s&&t.blockInitialAnimation&&(P=!1),P&&(!(A&&O)||L)&&h.push(...B.map(N=>({animation:N,options:{type:g}})))}if(d.size){const b={};if(typeof u.initial!="boolean"){const g=qt(t,Array.isArray(u.initial)?u.initial[0]:u.initial);g&&g.transition&&(b.transition=g.transition)}d.forEach(g=>{const E=t.getBaseTarget(g),w=t.getValue(g);w&&(w.liveStyle=!0),b[g]=E??null}),h.push({animation:b})}let v=!!h.length;return s&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(v=!1),s=!1,v?e(h):Promise.resolve()}function a(l,u){var h;if(n[l].isActive===u)return Promise.resolve();(h=t.variantChildren)==null||h.forEach(d=>{var f;return(f=d.animationState)==null?void 0:f.setActive(l,u)}),n[l].isActive=u;const c=o(l);for(const d in n)n[d].protectedKeys={};return c}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n,reset:()=>{n=Li(),s=!0}}}function mc(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!ki(e,t):!1}function Ct(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Li(){return{animate:Ct(!0),whileInView:Ct(),whileHover:Ct(),whileTap:Ct(),whileDrag:Ct(),whileFocus:Ct(),exit:Ct()}}class pt{constructor(e){this.isMounted=!1,this.node=e}update(){}}class pc extends pt{constructor(e){super(e),e.animationState||(e.animationState=fc(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();xe(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let gc=0;class yc extends pt{constructor(){super(...arguments),this.id=gc++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const vc={animation:{Feature:pc},exit:{Feature:yc}};function ee(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}function ne(t){return{point:{x:t.pageX,y:t.pageY}}}const bc=t=>e=>Ze(e)&&t(e,ne(e));function se(t,e,n,s){return ee(t,e,bc(n),s)}function Ni({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function xc({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function wc(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}const ji=1e-4,Tc=1-ji,Cc=1+ji,Fi=.01,Ec=0-Fi,Sc=0+Fi;function q(t){return t.max-t.min}function Ac(t,e,n){return Math.abs(t-e)<=n}function Bi(t,e,n,s=.5){t.origin=s,t.originPoint=k(e.min,e.max,t.origin),t.scale=q(n)/q(e),t.translate=k(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Tc&&t.scale<=Cc||isNaN(t.scale))&&(t.scale=1),(t.translate>=Ec&&t.translate<=Sc||isNaN(t.translate))&&(t.translate=0)}function ie(t,e,n,s){Bi(t.x,e.x,n.x,s?s.originX:void 0),Bi(t.y,e.y,n.y,s?s.originY:void 0)}function Ui(t,e,n){t.min=n.min+e.min,t.max=t.min+q(e)}function Pc(t,e,n){Ui(t.x,e.x,n.x),Ui(t.y,e.y,n.y)}function $i(t,e,n){t.min=e.min-n.min,t.max=t.min+q(e)}function oe(t,e,n){$i(t.x,e.x,n.x),$i(t.y,e.y,n.y)}const Gi=()=>({translate:0,scale:1,origin:0,originPoint:0}),kt=()=>({x:Gi(),y:Gi()}),Ki=()=>({min:0,max:0}),F=()=>({x:Ki(),y:Ki()});function Z(t){return[t("x"),t("y")]}function Nn(t){return t===void 0||t===1}function jn({scale:t,scaleX:e,scaleY:n}){return!Nn(t)||!Nn(e)||!Nn(n)}function Et(t){return jn(t)||Hi(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Hi(t){return Wi(t.x)||Wi(t.y)}function Wi(t){return t&&t!=="0%"}function Me(t,e,n){const s=t-n,i=e*s;return n+i}function Yi(t,e,n,s,i){return i!==void 0&&(t=Me(t,i,s)),Me(t,n,s)+e}function Fn(t,e=0,n=1,s,i){t.min=Yi(t.min,e,n,s,i),t.max=Yi(t.max,e,n,s,i)}function zi(t,{x:e,y:n}){Fn(t.x,e.translate,e.scale,e.originPoint),Fn(t.y,n.translate,n.scale,n.originPoint)}const qi=.999999999999,Xi=1.0000000000001;function Mc(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a<i;a++){r=n[a],o=r.projectionDelta;const{visualElement:l}=r.options;l&&l.props.style&&l.props.style.display==="contents"||(s&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Lt(t,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,zi(t,o)),s&&Et(r.latestValues)&&Lt(t,r.latestValues))}e.x<Xi&&e.x>qi&&(e.x=1),e.y<Xi&&e.y>qi&&(e.y=1)}function _t(t,e){t.min=t.min+e,t.max=t.max+e}function Zi(t,e,n,s,i=.5){const r=k(t.min,t.max,i);Fn(t,e,n,r,s)}function Lt(t,e){Zi(t.x,e.x,e.scaleX,e.scale,e.originX),Zi(t.y,e.y,e.scaleY,e.scale,e.originY)}function Ji(t,e){return Ni(wc(t.getBoundingClientRect(),e))}function Rc(t,e,n){const s=Ji(t,n),{scroll:i}=e;return i&&(_t(s.x,i.offset.x),_t(s.y,i.offset.y)),s}const Qi=({current:t})=>t?t.ownerDocument.defaultView:null,to=(t,e)=>Math.abs(t-e);function Dc(t,e){const n=to(t.x,e.x),s=to(t.y,e.y);return Math.sqrt(n**2+s**2)}class eo{constructor(e,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:r=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Un(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,f=Dc(h.offset,{x:0,y:0})>=3;if(!d&&!f)return;const{point:m}=h,{timestamp:v}=U;this.history.push({...m,timestamp:v});const{onStart:b,onMove:g}=this.handlers;d||(b&&b(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,h)},this.handlePointerMove=(h,d)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=Bn(d,this.transformPagePoint),I.update(this.updatePoint,!0)},this.handlePointerUp=(h,d)=>{this.end();const{onEnd:f,onSessionEnd:m,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Un(h.type==="pointercancel"?this.lastMoveEventInfo:Bn(d,this.transformPagePoint),this.history);this.startEvent&&f&&f(h,b),m&&m(h,b)},!Ze(e))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const o=ne(e),a=Bn(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=U;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(e,Un(a,this.history)),this.removeListeners=Qt(se(this.contextWindow,"pointermove",this.handlePointerMove),se(this.contextWindow,"pointerup",this.handlePointerUp),se(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),dt(this.updatePoint)}}function Bn(t,e){return e?{point:e(t.point)}:t}function no(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Un({point:t},e){return{point:t,delta:no(t,so(e)),offset:no(t,Vc(e)),velocity:Oc(e,.1)}}function Vc(t){return t[0]}function so(t){return t[t.length-1]}function Oc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=so(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>tt(e)));)n--;if(!s)return{x:0,y:0};const r=st(i.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Ic(t,{min:e,max:n},s){return e!==void 0&&t<e?t=s?k(e,t,s.min):Math.max(t,e):n!==void 0&&t>n&&(t=s?k(n,t,s.max):Math.min(t,n)),t}function io(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function kc(t,{top:e,left:n,bottom:s,right:i}){return{x:io(t.x,n,i),y:io(t.y,e,s)}}function oo(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}function _c(t,e){return{x:oo(t.x,e.x),y:oo(t.y,e.y)}}function Lc(t,e){let n=.5;const s=q(t),i=q(e);return i>s?n=Bt(e.min,e.max-s,t.min):s>i&&(n=Bt(t.min,t.max-i,e.min)),at(0,1,n)}function Nc(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const $n=.35;function jc(t=$n){return t===!1?t=0:t===!0&&(t=$n),{x:ro(t,"left","right"),y:ro(t,"top","bottom")}}function ro(t,e,n){return{min:ao(t,e),max:ao(t,n)}}function ao(t,e){return typeof t=="number"?t:t[e]||0}const Fc=new WeakMap;class Bc{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=F(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=c=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ne(c).point)},r=(c,h)=>{const{drag:d,dragPropagation:f,onDragStart:m}=this.getProps();if(d&&!f&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Nr(d),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Z(b=>{let g=this.getAxisMotionValue(b).get()||0;if(ot.test(g)){const{projection:E}=this.visualElement;if(E&&E.layout){const w=E.layout.layoutBox[b];w&&(g=q(w)*(parseFloat(g)/100))}}this.originPoint[b]=g}),m&&I.postRender(()=>m(c,h)),mn(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(c,h)=>{const{dragPropagation:d,dragDirectionLock:f,onDirectionLock:m,onDrag:v}=this.getProps();if(!d&&!this.openDragLock)return;const{offset:b}=h;if(f&&this.currentDirection===null){this.currentDirection=Uc(b),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",h.point,b),this.updateAxis("y",h.point,b),this.visualElement.render(),v&&v(c,h)},a=(c,h)=>this.stop(c,h),l=()=>Z(c=>{var h;return this.getAnimationState(c)==="paused"&&((h=this.getAxisMotionValue(c).animation)==null?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new eo(e,{onSessionStart:i,onStart:r,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Qi(this.visualElement)})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&I.postRender(()=>r(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Re(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=Ic(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){var r;const{dragConstraints:e,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(r=this.visualElement.projection)==null?void 0:r.layout,i=this.constraints;e&&Rt(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=kc(s.layoutBox,e):this.constraints=!1,this.elastic=jc(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Z(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Nc(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Rt(e))return!1;const s=e.current;ht(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=Rc(s,i.root,this.visualElement.getTransformPagePoint());let o=_c(i.layout.layoutBox,r);if(n){const a=n(xc(o));this.hasMutatedConstraints=!!a,a&&(o=Ni(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Z(c=>{if(!Re(c,n,this.currentDirection))return;let h=l&&l[c]||{};o&&(h={min:0,max:0});const d=i?200:1e6,f=i?40:1e7,m={type:"inertia",velocity:s?e[c]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...r,...h};return this.startAxisValueAnimation(c,m)});return Promise.all(u).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return mn(this.visualElement,e),s.start(_n(e,s,0,n,this.visualElement,!1))}stopAnimation(){Z(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Z(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){Z(n=>{const{drag:s}=this.getProps();if(!Re(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];r.set(e[n]-k(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Rt(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Z(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();i[o]=Lc({min:l,max:l},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Z(o=>{if(!Re(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(k(l,u,i[o]))})}addListeners(){if(!this.visualElement.current)return;Fc.set(this.visualElement,this);const e=this.visualElement.current,n=se(e,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),s=()=>{const{dragConstraints:l}=this.getProps();Rt(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),I.read(s);const o=ee(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Z(c=>{const h=this.getAxisMotionValue(c);h&&(this.originPoint[c]+=l[c].translate,h.set(h.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=$n,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Re(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Uc(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class $c extends pt{constructor(e){super(e),this.removeGroupControls=X,this.removeListeners=X,this.controls=new Bc(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||X}unmount(){this.removeGroupControls(),this.removeListeners()}}const lo=t=>(e,n)=>{t&&I.postRender(()=>t(e,n))};class Gc extends pt{constructor(){super(...arguments),this.removePointerDownListener=X}onPointerDown(e){this.session=new eo(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qi(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:lo(e),onStart:lo(n),onMove:s,onEnd:(r,o)=>{delete this.session,i&&I.postRender(()=>i(r,o))}}}mount(){this.removePointerDownListener=se(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const De={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function co(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const re={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(S.test(t))t=parseFloat(t);else return t;const n=co(t,e.target.x),s=co(t,e.target.y);return`${n}% ${s}%`}},Kc={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=mt.parse(t);if(i.length>5)return s;const r=mt.createTransformer(t),o=typeof i[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;i[0+o]/=a,i[1+o]/=l;const u=k(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=u),typeof i[3+o]=="number"&&(i[3+o]/=u),r(i)}};class Hc extends y.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;ca(Wc),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),De.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,o=s.projection;return o&&(o.isPresent=r,i||e.layoutDependency!==n||n===void 0||e.isPresent!==r?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||I.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),qe.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function uo(t){const[e,n]=Qn(),s=y.useContext(_e);return C.jsx(Hc,{...t,layoutGroup:s,switchLayoutGroup:y.useContext(Cs),isPresent:e,safeToRemove:n})}const Wc={borderRadius:{...re,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:re,borderTopRightRadius:re,borderBottomLeftRadius:re,borderBottomRightRadius:re,boxShadow:Kc};function Yc(t,e,n){const s=K(t)?t:Kt(t);return s.start(_n("",s,e,n)),s.animation}function zc(t){return t instanceof SVGElement&&t.tagName!=="svg"}const qc=(t,e)=>t.depth-e.depth;class Xc{constructor(){this.children=[],this.isDirty=!1}add(e){Fe(this.children,e),this.isDirty=!0}remove(e){Be(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(qc),this.isDirty=!1,this.children.forEach(e)}}function Zc(t,e){const n=it.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(dt(s),t(r-e))};return I.read(s,!0),()=>dt(s)}const ho=["TopLeft","TopRight","BottomLeft","BottomRight"],Jc=ho.length,fo=t=>typeof t=="string"?parseFloat(t):t,mo=t=>typeof t=="number"||S.test(t);function Qc(t,e,n,s,i,r){i?(t.opacity=k(0,n.opacity??1,tu(s)),t.opacityExit=k(e.opacity??1,0,eu(s))):r&&(t.opacity=k(e.opacity??1,n.opacity??1,s));for(let o=0;o<Jc;o++){const a=`border${ho[o]}Radius`;let l=po(e,a),u=po(n,a);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||mo(l)===mo(u)?(t[a]=Math.max(k(fo(l),fo(u),s),0),(ot.test(u)||ot.test(l))&&(t[a]+="%")):t[a]=u}(e.rotate||n.rotate)&&(t.rotate=k(e.rotate||0,n.rotate||0,s))}function po(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const tu=go(0,.5,qs),eu=go(.5,.95,X);function go(t,e,n){return s=>s<t?0:s>e?1:n(Bt(t,e,s))}function yo(t,e){t.min=e.min,t.max=e.max}function J(t,e){yo(t.x,e.x),yo(t.y,e.y)}function vo(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function bo(t,e,n,s,i){return t-=e,t=Me(t,1/n,s),i!==void 0&&(t=Me(t,1/i,s)),t}function nu(t,e=0,n=1,s=.5,i,r=t,o=t){if(ot.test(e)&&(e=parseFloat(e),e=k(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=k(r.min,r.max,s);t===r&&(a-=e),t.min=bo(t.min,e,n,a,i),t.max=bo(t.max,e,n,a,i)}function xo(t,e,[n,s,i],r,o){nu(t,e[n],e[s],e[i],e.scale,r,o)}const su=["x","scaleX","originX"],iu=["y","scaleY","originY"];function wo(t,e,n,s){xo(t.x,e,su,n?n.x:void 0,s?s.x:void 0),xo(t.y,e,iu,n?n.y:void 0,s?s.y:void 0)}function To(t){return t.translate===0&&t.scale===1}function Co(t){return To(t.x)&&To(t.y)}function Eo(t,e){return t.min===e.min&&t.max===e.max}function ou(t,e){return Eo(t.x,e.x)&&Eo(t.y,e.y)}function So(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Ao(t,e){return So(t.x,e.x)&&So(t.y,e.y)}function Po(t){return q(t.x)/q(t.y)}function Mo(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class ru{constructor(){this.members=[]}add(e){Fe(this.members,e),e.scheduleRender()}remove(e){if(Be(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function au(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((i||r||o)&&(s=`translate3d(${i}px, ${r}px, ${o}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:h,rotateY:d,skewX:f,skewY:m}=n;u&&(s=`perspective(${u}px) ${s}`),c&&(s+=`rotate(${c}deg) `),h&&(s+=`rotateX(${h}deg) `),d&&(s+=`rotateY(${d}deg) `),f&&(s+=`skewX(${f}deg) `),m&&(s+=`skewY(${m}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(s+=`scale(${a}, ${l})`),s||"none"}const Gn=["","X","Y","Z"],lu={visibility:"hidden"},Ro=1e3;let cu=0;function Kn(t,e,n,s){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),s&&(s[t]=0))}function Do(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=$s(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",I,!(i||r))}const{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&Do(s)}function Vo({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=cu++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(du),this.nodes.forEach(yu),this.nodes.forEach(vu),this.nodes.forEach(fu)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new Xc)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Ge),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,a=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=zc(o),this.instance=o;const{layoutId:l,layout:u,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(u||l)&&(this.isLayoutDirty=!0),t){let h;const d=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=Zc(d,250),De.hasAnimatedSinceResize&&(De.hasAnimatedSinceResize=!1,this.nodes.forEach(Io))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:d,hasRelativeLayoutChanged:f,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||c.getDefaultTransition()||Cu,{onLayoutAnimationStart:b,onLayoutAnimationComplete:g}=c.getProps(),E=!this.targetLayout||!Ao(this.targetLayout,m),w=!d&&f;if(this.options.layoutRoot||this.resumeFrom||w||d&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,w);const D={...Ye(v,"layout"),onPlay:b,onComplete:g};(c.shouldReduceMotion||this.options.layoutRoot)&&(D.delay=0,D.type=!1),this.startAnimation(D)}else d||Io(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,dt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(bu),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Do(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const h=this.path[c];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Oo);return}this.isUpdating||this.nodes.forEach(pu),this.isUpdating=!1,this.nodes.forEach(gu),this.nodes.forEach(uu),this.nodes.forEach(hu),this.clearAllSnapshots();const a=it.now();U.delta=at(0,1e3/60,a-U.timestamp),U.timestamp=a,U.isProcessing=!0,Xe.update.process(U),Xe.preRender.process(U),Xe.render.process(U),U.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,qe.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(mu),this.sharedNodes.forEach(xu)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,I.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){I.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!q(this.snapshot.measuredBox.x)&&!q(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=F(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a){const l=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!Co(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,c=u!==this.prevTransformTemplateValue;o&&(a||Et(this.latestValues)||c)&&(i(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),Eu(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return F();const a=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(Su))){const{scroll:c}=this.root;c&&(_t(a.x,c.offset.x),_t(a.y,c.offset.y))}return a}removeElementScroll(o){var l;const a=F();if(J(a,o),(l=this.scroll)!=null&&l.wasRoot)return a;for(let u=0;u<this.path.length;u++){const c=this.path[u],{scroll:h,options:d}=c;c!==this.root&&h&&d.layoutScroll&&(h.wasRoot&&J(a,o),_t(a.x,h.offset.x),_t(a.y,h.offset.y))}return a}applyTransform(o,a=!1){const l=F();J(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];!a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&Lt(l,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),Et(c.latestValues)&&Lt(l,c.latestValues)}return Et(this.latestValues)&&Lt(l,this.latestValues),l}removeTransform(o){const a=F();J(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!Et(u.latestValues))continue;jn(u.latestValues)&&u.updateSnapshot();const c=F(),h=u.measurePageBox();J(c,h),wo(a,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,c)}return Et(this.latestValues)&&wo(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==U.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var d;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(d=this.parent)!=null&&d.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:c,layoutId:h}=this.options;if(!(!this.layout||!(c||h))){if(this.resolvedRelativeTargetAt=U.timestamp,!this.targetDelta&&!this.relativeTarget){const f=this.getClosestProjectingParent();f&&f.layout&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=F(),this.relativeTargetOrigin=F(),oe(this.relativeTargetOrigin,this.layout.layoutBox,f.layout.layoutBox),J(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=F(),this.targetWithTransforms=F()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Pc(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):J(this.target,this.layout.layoutBox),zi(this.target,this.targetDelta)):J(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const f=this.getClosestProjectingParent();f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=F(),this.relativeTargetOrigin=F(),oe(this.relativeTargetOrigin,this.target,f.target),J(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||jn(this.parent.latestValues)||Hi(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var m;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===U.timestamp&&(l=!1),l)return;const{layout:u,layoutId:c}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||c))return;J(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,d=this.treeScale.y;Mc(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=F());const{target:f}=o;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(vo(this.prevProjectionDelta.x,this.projectionDelta.x),vo(this.prevProjectionDelta.y,this.projectionDelta.y)),ie(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==d||!Mo(this.projectionDelta.x,this.prevProjectionDelta.x)||!Mo(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=kt(),this.projectionDelta=kt(),this.projectionDeltaWithTransform=kt()}setAnimationOrigin(o,a=!1){const l=this.snapshot,u=l?l.latestValues:{},c={...this.latestValues},h=kt();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=F(),f=l?l.source:void 0,m=this.layout?this.layout.source:void 0,v=f!==m,b=this.getStack(),g=!b||b.members.length<=1,E=!!(v&&!g&&this.options.crossfade===!0&&!this.path.some(Tu));this.animationProgress=0;let w;this.mixTargetDelta=D=>{const x=D/1e3;ko(h.x,o.x,x),ko(h.y,o.y,x),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oe(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),wu(this.relativeTarget,this.relativeTargetOrigin,d,x),w&&ou(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=F()),J(w,this.relativeTarget)),v&&(this.animationValues=c,Qc(c,u,this.latestValues,x,E,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=x},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(dt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=I.update(()=>{De.hasAnimatedSinceResize=!0,this.currentAnimation=Yc(0,Ro,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Ro),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&Fo(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||F();const h=q(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const d=q(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}J(a,l),Lt(a,c),ie(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new ru),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Kn("z",o,u,this.animationValues);for(let c=0;c<Gn.length;c++)Kn(`rotate${Gn[c]}`,o,u,this.animationValues),Kn(`skew${Gn[c]}`,o,u,this.animationValues);o.render();for(const c in u)o.setStaticValue(c,u[c]),this.animationValues&&(this.animationValues[c]=u[c]);o.scheduleRender()}getProjectionStyles(o){if(!this.instance||this.isSVG)return;if(!this.isVisible)return lu;const a={visibility:""},l=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,a.opacity="",a.pointerEvents=Ce(o==null?void 0:o.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none",a;const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){const f={};return this.options.layoutId&&(f.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,f.pointerEvents=Ce(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Et(this.latestValues)&&(f.transform=l?l({},""):"none",this.hasProjected=!1),f}const c=u.animationValues||u.latestValues;this.applyTransformsToTarget(),a.transform=au(this.projectionDeltaWithTransform,this.treeScale,c),l&&(a.transform=l(c,a.transform));const{x:h,y:d}=this.projectionDelta;a.transformOrigin=`${h.origin*100}% ${d.origin*100}% 0`,u.animationValues?a.opacity=u===this?c.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:c.opacityExit:a.opacity=u===this?c.opacity!==void 0?c.opacity:"":c.opacityExit!==void 0?c.opacityExit:0;for(const f in Wt){if(c[f]===void 0)continue;const{correct:m,applyTo:v,isCSSVariable:b}=Wt[f],g=a.transform==="none"?c[f]:m(c[f],u);if(v){const E=v.length;for(let w=0;w<E;w++)a[v[w]]=g}else b?this.options.visualElement.renderState.vars[f]=g:a[f]=g}return this.options.layoutId&&(a.pointerEvents=u===this?Ce(o==null?void 0:o.pointerEvents)||"":"none"),a}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(Oo),this.root.sharedNodes.clear()}}}function uu(t){t.updateLayout()}function hu(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=t.layout,{animationType:r}=t.options,o=e.source!==t.layout.source;r==="size"?Z(h=>{const d=o?e.measuredBox[h]:e.layoutBox[h],f=q(d);d.min=s[h].min,d.max=d.min+f}):Fo(r,e.layoutBox,s)&&Z(h=>{const d=o?e.measuredBox[h]:e.layoutBox[h],f=q(s[h]);d.max=d.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+f)});const a=kt();ie(a,s,e.layoutBox);const l=kt();o?ie(l,t.applyTransform(i,!0),e.measuredBox):ie(l,s,e.layoutBox);const u=!Co(a);let c=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:d,layout:f}=h;if(d&&f){const m=F();oe(m,e.layoutBox,d.layoutBox);const v=F();oe(v,s,f.layoutBox),Ao(m,v)||(c=!0),h.options.layoutRoot&&(t.relativeTarget=v,t.relativeTargetOrigin=m,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:c})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function du(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function fu(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function mu(t){t.clearSnapshot()}function Oo(t){t.clearMeasurements()}function pu(t){t.isLayoutDirty=!1}function gu(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Io(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function yu(t){t.resolveTargetDelta()}function vu(t){t.calcProjection()}function bu(t){t.resetSkewAndRotation()}function xu(t){t.removeLeadSnapshot()}function ko(t,e,n){t.translate=k(e.translate,0,n),t.scale=k(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function _o(t,e,n,s){t.min=k(e.min,n.min,s),t.max=k(e.max,n.max,s)}function wu(t,e,n,s){_o(t.x,e.x,n.x,s),_o(t.y,e.y,n.y,s)}function Tu(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Cu={duration:.45,ease:[.4,0,.1,1]},Lo=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),No=Lo("applewebkit/")&&!Lo("chrome/")?Math.round:X;function jo(t){t.min=No(t.min),t.max=No(t.max)}function Eu(t){jo(t.x),jo(t.y)}function Fo(t,e,n){return t==="position"||t==="preserve-aspect"&&!Ac(Po(e),Po(n),.2)}function Su(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Au=Vo({attachResizeListener:(t,e)=>ee(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Hn={current:void 0},Bo=Vo({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Hn.current){const t=new Au({});t.mount(window),t.setOptions({layoutScroll:!0}),Hn.current=t}return Hn.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Pu={pan:{Feature:Gc},drag:{Feature:$c,ProjectionNode:Bo,MeasureLayout:uo}};function Uo(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&I.postRender(()=>r(e,ne(e)))}class Mu extends pt{mount(){const{current:e}=this.node;e&&(this.unmount=Fr(e,(n,s)=>(Uo(this.node,s,"Start"),i=>Uo(this.node,i,"End"))))}unmount(){}}class Ru extends pt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Qt(ee(this.node.current,"focus",()=>this.onFocus()),ee(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function $o(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&I.postRender(()=>r(e,ne(e)))}class Du extends pt{mount(){const{current:e}=this.node;e&&(this.unmount=Gr(e,(n,s)=>($o(this.node,s,"Start"),(i,{success:r})=>$o(this.node,i,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Wn=new WeakMap,Yn=new WeakMap,Vu=t=>{const e=Wn.get(t.target);e&&e(t)},Ou=t=>{t.forEach(Vu)};function Iu({root:t,...e}){const n=t||document;Yn.has(n)||Yn.set(n,{});const s=Yn.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(Ou,{root:t,...e})),s[i]}function ku(t,e,n){const s=Iu(e);return Wn.set(t,n),s.observe(t),()=>{Wn.delete(t),s.unobserve(t)}}const _u={some:0,all:1};class Lu extends pt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=e,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:_u[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:h}=this.node.getProps(),d=u?c:h;d&&d(l)};return ku(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Nu(e,n))&&this.startObserver()}unmount(){}}function Nu({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const ju={inView:{Feature:Lu},tap:{Feature:Du},focus:{Feature:Ru},hover:{Feature:Mu}},Fu={layout:{ProjectionNode:Bo,MeasureLayout:uo}},zn={current:null},Go={current:!1};function Bu(){if(Go.current=!0,!!Ne)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>zn.current=t.matches;t.addListener(e),e()}else zn.current=!1}const Uu=[...gi,H,mt],$u=t=>Uu.find(pi(t)),Gu=new WeakMap;function Ku(t,e,n){for(const s in e){const i=e[s],r=n[s];if(K(i))t.addValue(s,i),process.env.NODE_ENV==="development"&&me(i.version==="12.7.4",`Attempting to mix Motion versions ${i.version} with 12.7.4 may not work as expected.`);else if(K(r))t.addValue(s,Kt(i,{owner:t}));else if(r!==i)if(t.hasValue(s)){const o=t.getValue(s);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(s);t.addValue(s,Kt(o!==void 0?o:i,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const Ko=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Hu{scrapeMotionValuesFromProps(e,n,s){return{}}constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:r,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Pn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=it.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,I.render(this.render,!1,!0))};const{latestValues:l,renderState:u,onUpdate:c}=o;this.onUpdate=c,this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.blockInitialAnimation=!!r,this.isControllingVariants=we(n),this.isVariantNode=xs(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...d}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in d){const m=d[f];l[f]!==void 0&&K(m)&&m.set(l[f],!1)}}mount(e){this.current=e,Gu.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Go.current||Bu(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:zn.current,process.env.NODE_ENV!=="production"&&me(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),dt(this.notifyUpdate),dt(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const s=bt.has(e);s&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&I.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{i(),r(),o&&o(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Mt){const n=Mt[e];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[e]&&i&&s(this.props)&&(this.features[e]=new i(this)),this.features[e]){const r=this.features[e];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):F()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<Ko.length;s++){const i=Ko[s];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const r="on"+i,o=e[r];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=Ku(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const s=this.values.get(e);n!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=Kt(n===null?void 0:n,{owner:this}),this.addValue(e,s)),s}readValue(e,n){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(fi(s)||Zs(s))?s=parseFloat(s):!$u(s)&&mt.test(n)&&(s=oi(e,n)),this.setBaseTarget(e,K(s)?s.get():s)),K(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var r;const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const o=hn(this.props,n,(r=this.presenceContext)==null?void 0:r.custom);o&&(s=o[e])}if(n&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!K(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Ge),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class Ho extends Hu{constructor(){super(...arguments),this.KeyframeResolver=vi}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;K(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Wu(t){return window.getComputedStyle(t)}class Yu extends Ho{constructor(){super(...arguments),this.type="html",this.renderInstance=Ls}readValueFromInstance(e,n){if(bt.has(n))return rl(e,n);{const s=Wu(e),i=(nn(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Ji(e,n)}build(e,n,s){rn(e,n,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,s){return fn(e,n,s)}}class zu extends Ho{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=F,this.updateDimensions=()=>{this.current&&!this.renderState.dimensions&&_s(this.current,this.renderState)}}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(bt.has(n)){const s=ii(n);return s&&s.default||0}return n=Ns.has(n)?n:en(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,s){return Fs(e,n,s)}onBindTransform(){this.current&&!this.renderState.dimensions&&I.postRender(this.updateDimensions)}build(e,n,s){cn(e,n,this.isSVGTag,s.transformTemplate)}renderInstance(e,n,s,i){js(e,n,s,i)}mount(e){this.isSVGTag=un(e.tagName),super.mount(e)}}const qu=(t,e)=>ln(t)?new zu(e):new Yu(e,{allowProjection:t!==y.Fragment}),Xu=Ia({...vc,...ju,...Pu,...Fu},qu),Wo=Xr(Xu);var Yo;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(Yo||(Yo={}));/**
|
|
31
|
-
* @license
|
|
32
|
-
* Copyright 2024 Google LLC
|
|
33
|
-
*
|
|
34
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
35
|
-
* you may not use this file except in compliance with the License.
|
|
36
|
-
* You may obtain a copy of the License at
|
|
37
|
-
*
|
|
38
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
39
|
-
*
|
|
40
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
41
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
42
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
43
|
-
* See the License for the specific language governing permissions and
|
|
44
|
-
* limitations under the License.
|
|
45
|
-
*/var zo;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(zo||(zo={}));var qo;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(qo||(qo={}));/**
|
|
46
|
-
* @license
|
|
47
|
-
* Copyright 2024 Google LLC
|
|
48
|
-
*
|
|
49
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
50
|
-
* you may not use this file except in compliance with the License.
|
|
51
|
-
* You may obtain a copy of the License at
|
|
52
|
-
*
|
|
53
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
54
|
-
*
|
|
55
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
56
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
57
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
58
|
-
* See the License for the specific language governing permissions and
|
|
59
|
-
* limitations under the License.
|
|
60
|
-
*/const Xo=["user","model","function","system"];var Zo;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(Zo||(Zo={}));var Jo;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(Jo||(Jo={}));var Qo;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(Qo||(Qo={}));var tr;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(tr||(tr={}));var ae;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.OTHER="OTHER"})(ae||(ae={}));var er;(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(er||(er={}));var nr;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(nr||(nr={}));var sr;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(sr||(sr={}));/**
|
|
61
|
-
* @license
|
|
62
|
-
* Copyright 2024 Google LLC
|
|
63
|
-
*
|
|
64
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
65
|
-
* you may not use this file except in compliance with the License.
|
|
66
|
-
* You may obtain a copy of the License at
|
|
67
|
-
*
|
|
68
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
69
|
-
*
|
|
70
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
71
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
72
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
73
|
-
* See the License for the specific language governing permissions and
|
|
74
|
-
* limitations under the License.
|
|
75
|
-
*/class W extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}}class Nt extends W{constructor(e,n){super(e),this.response=n}}class ir extends W{constructor(e,n,s,i){super(e),this.status=n,this.statusText=s,this.errorDetails=i}}class gt extends W{}class or extends W{}/**
|
|
76
|
-
* @license
|
|
77
|
-
* Copyright 2024 Google LLC
|
|
78
|
-
*
|
|
79
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
80
|
-
* you may not use this file except in compliance with the License.
|
|
81
|
-
* You may obtain a copy of the License at
|
|
82
|
-
*
|
|
83
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
84
|
-
*
|
|
85
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
86
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
87
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
88
|
-
* See the License for the specific language governing permissions and
|
|
89
|
-
* limitations under the License.
|
|
90
|
-
*/const Zu="https://generativelanguage.googleapis.com",Ju="v1beta",Qu="0.24.1",th="genai-js";var St;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(St||(St={}));class eh{constructor(e,n,s,i,r){this.model=e,this.task=n,this.apiKey=s,this.stream=i,this.requestOptions=r}toString(){var e,n;const s=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||Ju;let r=`${((n=this.requestOptions)===null||n===void 0?void 0:n.baseUrl)||Zu}/${s}/${this.model}:${this.task}`;return this.stream&&(r+="?alt=sse"),r}}function nh(t){const e=[];return t!=null&&t.apiClient&&e.push(t.apiClient),e.push(`${th}/${Qu}`),e.join(" ")}async function sh(t){var e;const n=new Headers;n.append("Content-Type","application/json"),n.append("x-goog-api-client",nh(t.requestOptions)),n.append("x-goog-api-key",t.apiKey);let s=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(s){if(!(s instanceof Headers))try{s=new Headers(s)}catch(i){throw new gt(`unable to convert customHeaders value ${JSON.stringify(s)} to Headers: ${i.message}`)}for(const[i,r]of s.entries()){if(i==="x-goog-api-key")throw new gt(`Cannot set reserved header name ${i}`);if(i==="x-goog-api-client")throw new gt(`Header name ${i} can only be set using the apiClient field`);n.append(i,r)}}return n}async function ih(t,e,n,s,i,r){const o=new eh(t,e,n,s,r);return{url:o.toString(),fetchOptions:Object.assign(Object.assign({},lh(r)),{method:"POST",headers:await sh(o),body:i})}}async function le(t,e,n,s,i,r={},o=fetch){const{url:a,fetchOptions:l}=await ih(t,e,n,s,i,r);return oh(a,l,o)}async function oh(t,e,n=fetch){let s;try{s=await n(t,e)}catch(i){rh(i,t)}return s.ok||await ah(s,t),s}function rh(t,e){let n=t;throw n.name==="AbortError"?(n=new or(`Request aborted when fetching ${e.toString()}: ${t.message}`),n.stack=t.stack):t instanceof ir||t instanceof gt||(n=new W(`Error fetching from ${e.toString()}: ${t.message}`),n.stack=t.stack),n}async function ah(t,e){let n="",s;try{const i=await t.json();n=i.error.message,i.error.details&&(n+=` ${JSON.stringify(i.error.details)}`,s=i.error.details)}catch{}throw new ir(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${n}`,t.status,t.statusText,s)}function lh(t){const e={};if((t==null?void 0:t.signal)!==void 0||(t==null?void 0:t.timeout)>=0){const n=new AbortController;(t==null?void 0:t.timeout)>=0&&setTimeout(()=>n.abort(),t.timeout),t!=null&&t.signal&&t.signal.addEventListener("abort",()=>{n.abort()}),e.signal=n.signal}return e}/**
|
|
91
|
-
* @license
|
|
92
|
-
* Copyright 2024 Google LLC
|
|
93
|
-
*
|
|
94
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
95
|
-
* you may not use this file except in compliance with the License.
|
|
96
|
-
* You may obtain a copy of the License at
|
|
97
|
-
*
|
|
98
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
99
|
-
*
|
|
100
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
101
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
102
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
103
|
-
* See the License for the specific language governing permissions and
|
|
104
|
-
* limitations under the License.
|
|
105
|
-
*/function qn(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),Ve(t.candidates[0]))throw new Nt(`${yt(t)}`,t);return ch(t)}else if(t.promptFeedback)throw new Nt(`Text not available. ${yt(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),Ve(t.candidates[0]))throw new Nt(`${yt(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),rr(t)[0]}else if(t.promptFeedback)throw new Nt(`Function call not available. ${yt(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),Ve(t.candidates[0]))throw new Nt(`${yt(t)}`,t);return rr(t)}else if(t.promptFeedback)throw new Nt(`Function call not available. ${yt(t)}`,t)},t}function ch(t){var e,n,s,i;const r=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const o of(i=(s=t.candidates)===null||s===void 0?void 0:s[0].content)===null||i===void 0?void 0:i.parts)o.text&&r.push(o.text),o.executableCode&&r.push("\n```"+o.executableCode.language+`
|
|
106
|
-
`+o.executableCode.code+"\n```\n"),o.codeExecutionResult&&r.push("\n```\n"+o.codeExecutionResult.output+"\n```\n");return r.length>0?r.join(""):""}function rr(t){var e,n,s,i;const r=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const o of(i=(s=t.candidates)===null||s===void 0?void 0:s[0].content)===null||i===void 0?void 0:i.parts)o.functionCall&&r.push(o.functionCall);if(r.length>0)return r}const uh=[ae.RECITATION,ae.SAFETY,ae.LANGUAGE];function Ve(t){return!!t.finishReason&&uh.includes(t.finishReason)}function yt(t){var e,n,s;let i="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)i+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(i+=` due to ${t.promptFeedback.blockReason}`),!((n=t.promptFeedback)===null||n===void 0)&&n.blockReasonMessage&&(i+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((s=t.candidates)===null||s===void 0)&&s[0]){const r=t.candidates[0];Ve(r)&&(i+=`Candidate was blocked due to ${r.finishReason}`,r.finishMessage&&(i+=`: ${r.finishMessage}`))}return i}function ce(t){return this instanceof ce?(this.v=t,this):new ce(t)}function hh(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=n.apply(t,e||[]),i,r=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){s[d]&&(i[d]=function(f){return new Promise(function(m,v){r.push([d,f,m,v])>1||a(d,f)})})}function a(d,f){try{l(s[d](f))}catch(m){h(r[0][3],m)}}function l(d){d.value instanceof ce?Promise.resolve(d.value.v).then(u,c):h(r[0][2],d)}function u(d){a("next",d)}function c(d){a("throw",d)}function h(d,f){d(f),r.shift(),r.length&&a(r[0][0],r[0][1])}}typeof SuppressedError=="function"&&SuppressedError;/**
|
|
107
|
-
* @license
|
|
108
|
-
* Copyright 2024 Google LLC
|
|
109
|
-
*
|
|
110
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
-
* you may not use this file except in compliance with the License.
|
|
112
|
-
* You may obtain a copy of the License at
|
|
113
|
-
*
|
|
114
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
-
*
|
|
116
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
-
* See the License for the specific language governing permissions and
|
|
120
|
-
* limitations under the License.
|
|
121
|
-
*/const ar=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function dh(t){const e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),n=ph(e),[s,i]=n.tee();return{stream:mh(s),response:fh(i)}}async function fh(t){const e=[],n=t.getReader();for(;;){const{done:s,value:i}=await n.read();if(s)return qn(gh(e));e.push(i)}}function mh(t){return hh(this,arguments,function*(){const n=t.getReader();for(;;){const{value:s,done:i}=yield ce(n.read());if(i)break;yield yield ce(qn(s))}})}function ph(t){const e=t.getReader();return new ReadableStream({start(s){let i="";return r();function r(){return e.read().then(({value:o,done:a})=>{if(a){if(i.trim()){s.error(new W("Failed to parse stream"));return}s.close();return}i+=o;let l=i.match(ar),u;for(;l;){try{u=JSON.parse(l[1])}catch{s.error(new W(`Error parsing JSON response: "${l[1]}"`));return}s.enqueue(u),i=i.substring(l[0].length),l=i.match(ar)}return r()}).catch(o=>{let a=o;throw a.stack=o.stack,a.name==="AbortError"?a=new or("Request aborted when reading from the stream"):a=new W("Error reading from the stream"),a})}}})}function gh(t){const e=t[t.length-1],n={promptFeedback:e==null?void 0:e.promptFeedback};for(const s of t){if(s.candidates){let i=0;for(const r of s.candidates)if(n.candidates||(n.candidates=[]),n.candidates[i]||(n.candidates[i]={index:i}),n.candidates[i].citationMetadata=r.citationMetadata,n.candidates[i].groundingMetadata=r.groundingMetadata,n.candidates[i].finishReason=r.finishReason,n.candidates[i].finishMessage=r.finishMessage,n.candidates[i].safetyRatings=r.safetyRatings,r.content&&r.content.parts){n.candidates[i].content||(n.candidates[i].content={role:r.content.role||"user",parts:[]});const o={};for(const a of r.content.parts)a.text&&(o.text=a.text),a.functionCall&&(o.functionCall=a.functionCall),a.executableCode&&(o.executableCode=a.executableCode),a.codeExecutionResult&&(o.codeExecutionResult=a.codeExecutionResult),Object.keys(o).length===0&&(o.text=""),n.candidates[i].content.parts.push(o)}i++}s.usageMetadata&&(n.usageMetadata=s.usageMetadata)}return n}/**
|
|
122
|
-
* @license
|
|
123
|
-
* Copyright 2024 Google LLC
|
|
124
|
-
*
|
|
125
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
126
|
-
* you may not use this file except in compliance with the License.
|
|
127
|
-
* You may obtain a copy of the License at
|
|
128
|
-
*
|
|
129
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
130
|
-
*
|
|
131
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
132
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
133
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
|
-
* See the License for the specific language governing permissions and
|
|
135
|
-
* limitations under the License.
|
|
136
|
-
*/async function lr(t,e,n,s){const i=await le(e,St.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(n),s);return dh(i)}async function cr(t,e,n,s){const r=await(await le(e,St.GENERATE_CONTENT,t,!1,JSON.stringify(n),s)).json();return{response:qn(r)}}/**
|
|
137
|
-
* @license
|
|
138
|
-
* Copyright 2024 Google LLC
|
|
139
|
-
*
|
|
140
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
-
* you may not use this file except in compliance with the License.
|
|
142
|
-
* You may obtain a copy of the License at
|
|
143
|
-
*
|
|
144
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
-
*
|
|
146
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
-
* See the License for the specific language governing permissions and
|
|
150
|
-
* limitations under the License.
|
|
151
|
-
*/function ur(t){if(t!=null){if(typeof t=="string")return{role:"system",parts:[{text:t}]};if(t.text)return{role:"system",parts:[t]};if(t.parts)return t.role?t:{role:"system",parts:t.parts}}}function ue(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(const n of t)typeof n=="string"?e.push({text:n}):e.push(n);return yh(e)}function yh(t){const e={role:"user",parts:[]},n={role:"function",parts:[]};let s=!1,i=!1;for(const r of t)"functionResponse"in r?(n.parts.push(r),i=!0):(e.parts.push(r),s=!0);if(s&&i)throw new W("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!s&&!i)throw new W("No content is provided for sending chat message.");return s?e:n}function vh(t,e){var n;let s={model:e==null?void 0:e.model,generationConfig:e==null?void 0:e.generationConfig,safetySettings:e==null?void 0:e.safetySettings,tools:e==null?void 0:e.tools,toolConfig:e==null?void 0:e.toolConfig,systemInstruction:e==null?void 0:e.systemInstruction,cachedContent:(n=e==null?void 0:e.cachedContent)===null||n===void 0?void 0:n.name,contents:[]};const i=t.generateContentRequest!=null;if(t.contents){if(i)throw new gt("CountTokensRequest must have one of contents or generateContentRequest, not both.");s.contents=t.contents}else if(i)s=Object.assign(Object.assign({},s),t.generateContentRequest);else{const r=ue(t);s.contents=[r]}return{generateContentRequest:s}}function hr(t){let e;return t.contents?e=t:e={contents:[ue(t)]},t.systemInstruction&&(e.systemInstruction=ur(t.systemInstruction)),e}function bh(t){return typeof t=="string"||Array.isArray(t)?{content:ue(t)}:t}/**
|
|
152
|
-
* @license
|
|
153
|
-
* Copyright 2024 Google LLC
|
|
154
|
-
*
|
|
155
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
156
|
-
* you may not use this file except in compliance with the License.
|
|
157
|
-
* You may obtain a copy of the License at
|
|
158
|
-
*
|
|
159
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
160
|
-
*
|
|
161
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
162
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
163
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
-
* See the License for the specific language governing permissions and
|
|
165
|
-
* limitations under the License.
|
|
166
|
-
*/const dr=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],xh={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function wh(t){let e=!1;for(const n of t){const{role:s,parts:i}=n;if(!e&&s!=="user")throw new W(`First content should be with role 'user', got ${s}`);if(!Xo.includes(s))throw new W(`Each item should include role field. Got ${s} but valid roles are: ${JSON.stringify(Xo)}`);if(!Array.isArray(i))throw new W("Content should have 'parts' property with an array of Parts");if(i.length===0)throw new W("Each Content should have at least one part");const r={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(const a of i)for(const l of dr)l in a&&(r[l]+=1);const o=xh[s];for(const a of dr)if(!o.includes(a)&&r[a]>0)throw new W(`Content with role '${s}' can't contain '${a}' part`);e=!0}}function fr(t){var e;if(t.candidates===void 0||t.candidates.length===0)return!1;const n=(e=t.candidates[0])===null||e===void 0?void 0:e.content;if(n===void 0||n.parts===void 0||n.parts.length===0)return!1;for(const s of n.parts)if(s===void 0||Object.keys(s).length===0||s.text!==void 0&&s.text==="")return!1;return!0}/**
|
|
167
|
-
* @license
|
|
168
|
-
* Copyright 2024 Google LLC
|
|
169
|
-
*
|
|
170
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
|
-
* you may not use this file except in compliance with the License.
|
|
172
|
-
* You may obtain a copy of the License at
|
|
173
|
-
*
|
|
174
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
175
|
-
*
|
|
176
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
177
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
178
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
|
-
* See the License for the specific language governing permissions and
|
|
180
|
-
* limitations under the License.
|
|
181
|
-
*/const mr="SILENT_ERROR";class Th{constructor(e,n,s,i={}){this.model=n,this.params=s,this._requestOptions=i,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,s!=null&&s.history&&(wh(s.history),this._history=s.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,n={}){var s,i,r,o,a,l;await this._sendPromise;const u=ue(e),c={safetySettings:(s=this.params)===null||s===void 0?void 0:s.safetySettings,generationConfig:(i=this.params)===null||i===void 0?void 0:i.generationConfig,tools:(r=this.params)===null||r===void 0?void 0:r.tools,toolConfig:(o=this.params)===null||o===void 0?void 0:o.toolConfig,systemInstruction:(a=this.params)===null||a===void 0?void 0:a.systemInstruction,cachedContent:(l=this.params)===null||l===void 0?void 0:l.cachedContent,contents:[...this._history,u]},h=Object.assign(Object.assign({},this._requestOptions),n);let d;return this._sendPromise=this._sendPromise.then(()=>cr(this._apiKey,this.model,c,h)).then(f=>{var m;if(fr(f.response)){this._history.push(u);const v=Object.assign({parts:[],role:"model"},(m=f.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(v)}else{const v=yt(f.response);v&&console.warn(`sendMessage() was unsuccessful. ${v}. Inspect response object for details.`)}d=f}).catch(f=>{throw this._sendPromise=Promise.resolve(),f}),await this._sendPromise,d}async sendMessageStream(e,n={}){var s,i,r,o,a,l;await this._sendPromise;const u=ue(e),c={safetySettings:(s=this.params)===null||s===void 0?void 0:s.safetySettings,generationConfig:(i=this.params)===null||i===void 0?void 0:i.generationConfig,tools:(r=this.params)===null||r===void 0?void 0:r.tools,toolConfig:(o=this.params)===null||o===void 0?void 0:o.toolConfig,systemInstruction:(a=this.params)===null||a===void 0?void 0:a.systemInstruction,cachedContent:(l=this.params)===null||l===void 0?void 0:l.cachedContent,contents:[...this._history,u]},h=Object.assign(Object.assign({},this._requestOptions),n),d=lr(this._apiKey,this.model,c,h);return this._sendPromise=this._sendPromise.then(()=>d).catch(f=>{throw new Error(mr)}).then(f=>f.response).then(f=>{if(fr(f)){this._history.push(u);const m=Object.assign({},f.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{const m=yt(f);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(f=>{f.message!==mr&&console.error(f)}),d}}/**
|
|
182
|
-
* @license
|
|
183
|
-
* Copyright 2024 Google LLC
|
|
184
|
-
*
|
|
185
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
186
|
-
* you may not use this file except in compliance with the License.
|
|
187
|
-
* You may obtain a copy of the License at
|
|
188
|
-
*
|
|
189
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
190
|
-
*
|
|
191
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
192
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
193
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
194
|
-
* See the License for the specific language governing permissions and
|
|
195
|
-
* limitations under the License.
|
|
196
|
-
*/async function Ch(t,e,n,s){return(await le(e,St.COUNT_TOKENS,t,!1,JSON.stringify(n),s)).json()}/**
|
|
197
|
-
* @license
|
|
198
|
-
* Copyright 2024 Google LLC
|
|
199
|
-
*
|
|
200
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
201
|
-
* you may not use this file except in compliance with the License.
|
|
202
|
-
* You may obtain a copy of the License at
|
|
203
|
-
*
|
|
204
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
205
|
-
*
|
|
206
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
207
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
208
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
|
-
* See the License for the specific language governing permissions and
|
|
210
|
-
* limitations under the License.
|
|
211
|
-
*/async function Eh(t,e,n,s){return(await le(e,St.EMBED_CONTENT,t,!1,JSON.stringify(n),s)).json()}async function Sh(t,e,n,s){const i=n.requests.map(o=>Object.assign(Object.assign({},o),{model:e}));return(await le(e,St.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:i}),s)).json()}/**
|
|
212
|
-
* @license
|
|
213
|
-
* Copyright 2024 Google LLC
|
|
214
|
-
*
|
|
215
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
216
|
-
* you may not use this file except in compliance with the License.
|
|
217
|
-
* You may obtain a copy of the License at
|
|
218
|
-
*
|
|
219
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
220
|
-
*
|
|
221
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
222
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
223
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
|
-
* See the License for the specific language governing permissions and
|
|
225
|
-
* limitations under the License.
|
|
226
|
-
*/class pr{constructor(e,n,s={}){this.apiKey=e,this._requestOptions=s,n.model.includes("/")?this.model=n.model:this.model=`models/${n.model}`,this.generationConfig=n.generationConfig||{},this.safetySettings=n.safetySettings||[],this.tools=n.tools,this.toolConfig=n.toolConfig,this.systemInstruction=ur(n.systemInstruction),this.cachedContent=n.cachedContent}async generateContent(e,n={}){var s;const i=hr(e),r=Object.assign(Object.assign({},this._requestOptions),n);return cr(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(s=this.cachedContent)===null||s===void 0?void 0:s.name},i),r)}async generateContentStream(e,n={}){var s;const i=hr(e),r=Object.assign(Object.assign({},this._requestOptions),n);return lr(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(s=this.cachedContent)===null||s===void 0?void 0:s.name},i),r)}startChat(e){var n;return new Th(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},e),this._requestOptions)}async countTokens(e,n={}){const s=vh(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),i=Object.assign(Object.assign({},this._requestOptions),n);return Ch(this.apiKey,this.model,s,i)}async embedContent(e,n={}){const s=bh(e),i=Object.assign(Object.assign({},this._requestOptions),n);return Eh(this.apiKey,this.model,s,i)}async batchEmbedContents(e,n={}){const s=Object.assign(Object.assign({},this._requestOptions),n);return Sh(this.apiKey,this.model,e,s)}}/**
|
|
227
|
-
* @license
|
|
228
|
-
* Copyright 2024 Google LLC
|
|
229
|
-
*
|
|
230
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
231
|
-
* you may not use this file except in compliance with the License.
|
|
232
|
-
* You may obtain a copy of the License at
|
|
233
|
-
*
|
|
234
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
235
|
-
*
|
|
236
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
237
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
238
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
239
|
-
* See the License for the specific language governing permissions and
|
|
240
|
-
* limitations under the License.
|
|
241
|
-
*/class Ah{constructor(e){this.apiKey=e}getGenerativeModel(e,n){if(!e.model)throw new W("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new pr(this.apiKey,e,n)}getGenerativeModelFromCachedContent(e,n,s){if(!e.name)throw new gt("Cached content must contain a `name` field.");if(!e.model)throw new gt("Cached content must contain a `model` field.");const i=["model","systemInstruction"];for(const o of i)if(n!=null&&n[o]&&e[o]&&(n==null?void 0:n[o])!==e[o]){if(o==="model"){const a=n.model.startsWith("models/")?n.model.replace("models/",""):n.model,l=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(a===l)continue}throw new gt(`Different value for "${o}" specified in modelParams (${n[o]}) and cachedContent (${e[o]})`)}const r=Object.assign(Object.assign({},n),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new pr(this.apiKey,r,s)}}const Ph=()=>C.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-full h-full",children:[C.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4Z"}),C.jsx("path",{d:"M16.5 14C16.5 14 15 15.5 12 15.5C9 15.5 7.5 14 7.5 14",strokeLinecap:"round"}),C.jsx("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),C.jsx("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]}),Mh=()=>C.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-full h-full",children:[C.jsx("path",{d:"M12 12C14.2091 12 16 10.2091 16 8C16 5.79086 14.2091 4 12 4C9.79086 4 8 5.79086 8 8C8 10.2091 9.79086 12 12 12Z",strokeLinecap:"round"}),C.jsx("path",{d:"M19.21 17.14C19.21 17.14 19 19 12 19C5 19 4.79 17.14 4.79 17.14C4.79 17.14 6.33 15 12 15C17.67 15 19.21 17.14 19.21 17.14Z",strokeLinecap:"round"})]}),Rh=()=>C.jsxs("svg",{fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:[C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.875L6 12z"}),C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12h9"})]}),Dh=()=>C.jsxs("div",{className:"flex items-center space-x-1 p-3",children:[C.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse [animation-delay:-0.3s]"}),C.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse [animation-delay:-0.15s]"}),C.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse"})]}),Vh=t=>{const e=[];if(!t||t.length===0)return e;let s=t.reduce((r,o)=>{const a=r[r.length-1];return a&&a.sender===o.sender?a.text+=`
|
|
242
|
-
${o.text}`:r.push({...o}),r},[]).map(r=>({role:r.sender==="bot"?"model":"user",parts:[{text:r.text}]}));const i=s.findIndex(r=>r.role==="user");if(i>-1)s=s.slice(i);else return[];return s},Oh=({botName:t="ChatBot",botAvatar:e=C.jsx(Ph,{}),userAvatar:n=C.jsx(Mh,{}),welcomeMessage:s="Hello! How can I help?",placeholderText:i="Type a message...",isOpen:r=!1,disabled:o=!1,isTyping:a=!1,onSend:l=()=>{},theme:u={},geminiApiKey:c,messages:h})=>{const[d]=y.useState(()=>`chatbot-instance-${Math.random().toString(36).substring(2,9)}`),[f,m]=y.useState(r),[v,b]=y.useState(()=>s?[{id:1,text:s,sender:"bot"}]:[]),[g,E]=y.useState(""),[w,D]=y.useState(!1),x=typeof h<"u",A=x?h:v,O=x?()=>{}:b,P=y.useRef(null),L=y.useRef(null),B=y.useRef(null),Q=y.useRef(null),lt=y.useMemo(()=>{if(!c)return null;try{return new Ah(c).getGenerativeModel({model:"gemini-2.5-flash"})}catch(T){return console.error("Failed to initialize Gemini:",T),null}},[c]),M=y.useMemo(()=>{var $;const T=(($=u==null?void 0:u.window)==null?void 0:$.placement)==="center",V={launcher:{backgroundColor:"#4f46e5",iconColor:"#ffffff",size:"3.5rem"},header:{backgroundColor:"#4f46e5",textColor:"#ffffff",fontFamily:"inherit",fontWeight:"600"},messages:{userBackgroundColor:"#4f46e5",userTextColor:"#ffffff",botBackgroundColor:"#f3f4f6",botTextColor:"#1f2937",fontFamily:"inherit",fontSize:"0.9rem",showAvatars:!0,bubbleShape:"rounded",bubblePointer:!0},input:{backgroundColor:"#ffffff",textColor:"#1f2937",placeholderTextColor:"#9ca3af",borderColor:"#e5e7eb",focusRingColor:"#4f46e5"},window:{backgroundColor:"#ffffff",borderColor:"#e5e7eb",borderRadius:"0.75rem",width:T?"80vw":"22rem",height:T?"80vh":"30rem",placement:"bottom-right",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.4)",backdropBlur:"4px",scrollbarThumbColor:"#a1a1aa",scrollbarTrackColor:"#f1f5f9"}};return{launcher:{...V.launcher,...u.launcher},header:{...V.header,...u.header},messages:{...V.messages,...u.messages},input:{...V.input,...u.input},window:{...V.window,...u.window}}},[u]),vt=y.useMemo(()=>({"--chatbot-launcher-bg":M.launcher.backgroundColor,"--chatbot-launcher-icon-color":M.launcher.iconColor,"--chatbot-launcher-size":M.launcher.size,"--chatbot-header-bg":M.header.backgroundColor,"--chatbot-header-text-color":M.header.textColor,"--chatbot-header-font-family":M.header.fontFamily,"--chatbot-header-font-weight":M.header.fontWeight,"--chatbot-user-msg-bg":M.messages.userBackgroundColor,"--chatbot-user-msg-text-color":M.messages.userTextColor,"--chatbot-bot-msg-bg":M.messages.botBackgroundColor,"--chatbot-bot-msg-text-color":M.messages.botTextColor,"--chatbot-msg-font-family":M.messages.fontFamily,"--chatbot-msg-font-size":M.messages.fontSize,"--chatbot-input-bg":M.input.backgroundColor,"--chatbot-input-text-color":M.input.textColor,"--chatbot-input-placeholder-color":M.input.placeholderTextColor,"--chatbot-input-border-color":M.input.borderColor,"--chatbot-input-focus-ring":M.input.focusRingColor,"--chatbot-window-bg":M.window.backgroundColor,"--chatbot-window-border-color":M.window.borderColor,"--chatbot-window-border-radius":M.window.borderRadius,"--chatbot-window-width":M.window.width,"--chatbot-window-height":M.window.height}),[M]);y.useEffect(()=>{var ut;const T=M.window.scrollbarThumbColor,V=M.window.scrollbarTrackColor,$=`scrollbar-style-${d}`;(ut=document.getElementById($))==null||ut.remove();const G=document.createElement("style");return G.id=$,G.innerHTML=`
|
|
243
|
-
/* Modern browsers */
|
|
244
|
-
#${d} .chatbot-message-list {
|
|
245
|
-
scrollbar-width: thin;
|
|
246
|
-
scrollbar-color: ${T} ${V};
|
|
247
|
-
}
|
|
248
|
-
/* WebKit-based browsers (Chrome, Safari, Edge) */
|
|
249
|
-
#${d} .chatbot-message-list::-webkit-scrollbar {
|
|
250
|
-
width: 8px;
|
|
251
|
-
}
|
|
252
|
-
#${d} .chatbot-message-list::-webkit-scrollbar-track {
|
|
253
|
-
background: ${V};
|
|
254
|
-
border-radius: 4px;
|
|
255
|
-
}
|
|
256
|
-
#${d} .chatbot-message-list::-webkit-scrollbar-thumb {
|
|
257
|
-
background-color: ${T};
|
|
258
|
-
border-radius: 4px;
|
|
259
|
-
border: 2px solid ${V};
|
|
260
|
-
}
|
|
261
|
-
`,document.head.appendChild(G),()=>{var z;(z=document.getElementById($))==null||z.remove()}},[d,M.window.scrollbarThumbColor,M.window.scrollbarTrackColor]),y.useEffect(()=>{D(a)},[a]),y.useEffect(()=>{var T;(T=L.current)==null||T.scrollIntoView({behavior:"smooth"})},[A,w,a]),y.useEffect(()=>{var T,V;f?(T=P.current)==null||T.focus():(V=B.current)==null||V.focus()},[f]),y.useEffect(()=>{const T=V=>{V.key==="Escape"&&f&&m(!1)};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[f]);const At=y.useCallback(async()=>{var G,ut;const T=g.trim();if(!T||o||w||a)return;const V={id:Date.now(),text:T,sender:"user"},$=[...A,V];if(x||O(z=>[...z,V]),l(T),E(""),lt){D(!0);try{const z=Vh($),j=z.slice(0,-1),rt=((ut=(G=z[z.length-1])==null?void 0:G.parts[0])==null?void 0:ut.text)||"",Ih=(await(await lt.startChat({history:j}).sendMessage(rt)).response).text(),kh={id:Date.now()+1,text:Ih,sender:"bot"};O(_h=>[..._h,kh])}catch(z){console.error("Gemini API Error:",z);const j={id:Date.now()+1,text:"Sorry, an error occurred. Please try again.",sender:"bot"};O(rt=>[...rt,j])}finally{D(!1)}}else x||(D(!0),setTimeout(()=>{const z={id:Date.now()+1,text:`You said: "${T}"`,sender:"bot"};O(j=>[...j,z]),D(!1)},800))},[g,o,w,a,l,lt,x,A,O]),he=y.useCallback(T=>{T.key==="Enter"&&At()},[At]),N=T=>typeof T=="string"?C.jsx("img",{src:T,alt:"avatar",className:"w-8 h-8 rounded-full object-cover"}):C.jsx("div",{className:"w-8 h-8 rounded-full text-gray-500",children:T}),Y=w||a,ct={"bottom-right":"bottom-5 right-5","bottom-left":"bottom-5 left-5",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"},p=M.window.placement==="center",R={rounded:"rounded-xl",square:"rounded-md"};return C.jsxs("div",{id:d,style:vt,className:"font-sans",children:[C.jsx(es,{children:!f&&C.jsx(Wo.button,{ref:B,onClick:()=>m(!0),"aria-label":"Open Chat",initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"fixed bottom-10 right-10 z-50 rounded-full shadow-lg flex items-center justify-center cursor-pointer border-2 border-white/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[--chatbot-launcher-bg]",style:{backgroundColor:"var(--chatbot-launcher-bg)",color:"var(--chatbot-launcher-icon-color)",width:"var(--chatbot-launcher-size)",height:"var(--chatbot-launcher-size)"},children:C.jsx(yr.FontAwesomeIcon,{icon:vr.faCommentDots})})}),C.jsxs(es,{children:[f&&p&&M.window.backdrop&&C.jsx(Wo.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{backgroundColor:M.window.backdropColor,backdropFilter:`blur(${M.window.backdropBlur})`,WebkitBackdropFilter:`blur(${M.window.backdropBlur})`},className:"fixed inset-0 z-40",onClick:()=>m(!1)}),f&&C.jsxs("div",{ref:Q,"aria-modal":"true",role:"dialog",className:`fixed ${ct[M.window.placement]||ct["bottom-right"]} z-50 flex flex-col overflow-hidden shadow-2xl border`,style:{width:"var(--chatbot-window-width)",height:"var(--chatbot-window-height)",borderRadius:"var(--chatbot-window-border-radius)",backgroundColor:"var(--chatbot-window-bg)",borderColor:"var(--chatbot-window-border-color)"},children:[C.jsxs("header",{className:"flex items-center justify-between p-3 flex-shrink-0",style:{background:"var(--chatbot-header-bg)",color:"var(--chatbot-header-text-color)"},children:[C.jsxs("div",{className:"flex items-center space-x-3",children:[C.jsx("div",{className:"w-10 h-10 rounded-full bg-white/30 flex items-center justify-center p-1",children:N(e)}),C.jsx("span",{style:{fontFamily:"var(--chatbot-header-font-family)",fontWeight:"var(--chatbot-header-font-weight)"},className:"text-lg",children:t})]}),C.jsx("button",{onClick:()=>m(!1),"aria-label":"Close Chat",className:"p-1 rounded-full hover:bg-white/20 focus:outline-none focus-visible:ring-2 focus-visible:ring-white",children:C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-6 h-6",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),C.jsxs("div",{role:"log","aria-live":"polite",className:"chatbot-message-list flex-1 p-4 overflow-y-auto space-y-4",children:[A.map(T=>C.jsxs("div",{className:`flex items-end max-w-[85%] gap-2 ${T.sender==="user"?"ml-auto flex-row-reverse":"mr-auto"}`,children:[M.messages.showAvatars&&C.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 overflow-hidden",children:N(T.sender==="user"?n:e)}),C.jsx("div",{className:`px-3 py-2 ${R[M.messages.bubbleShape]||R.rounded} ${M.messages.bubblePointer?T.sender==="user"?"rounded-br-none":"rounded-bl-none":""}`,style:{backgroundColor:T.sender==="user"?"var(--chatbot-user-msg-bg)":"var(--chatbot-bot-msg-bg)",color:T.sender==="user"?"var(--chatbot-user-msg-text-color)":"var(--chatbot-bot-msg-text-color)",fontFamily:"var(--chatbot-msg-font-family)",fontSize:"var(--chatbot-msg-font-size)"},children:C.jsx("div",{className:"prose prose-sm max-w-none text-inherit prose-p:my-0 prose-headings:my-2 prose-ul:my-1 prose-li:my-0.5",style:{color:"inherit"},children:C.jsx(br,{children:T.text})})})]},T.id)),Y&&C.jsxs("div",{className:"flex items-end max-w-[85%] gap-2 mr-auto",children:[M.messages.showAvatars&&C.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 overflow-hidden",children:N(e)}),C.jsx("div",{className:`px-3 py-2 ${R[M.messages.bubbleShape]||R.rounded} rounded-bl-none`,style:{backgroundColor:"var(--chatbot-bot-msg-bg)"},children:C.jsx(Dh,{})})]}),C.jsx("div",{ref:L})]}),C.jsx("footer",{className:"p-3 border-t flex-shrink-0",style:{borderColor:"var(--chatbot-window-border-color)",backgroundColor:"var(--chatbot-input-bg)"},children:C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx("input",{ref:P,type:"text",value:g,onChange:T=>E(T.target.value),onKeyPress:he,placeholder:i,disabled:o||Y,"aria-label":"Chat input",className:"flex-1 w-full px-4 py-2 bg-transparent rounded-full border focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-60",style:{color:"var(--chatbot-input-text-color)",borderColor:"var(--chatbot-input-border-color)","--tw-ring-color":"var(--chatbot-input-focus-ring)"}}),C.jsx("button",{onClick:At,disabled:!g.trim()||o||Y,"aria-label":"Send Message",className:"px-4 h-10 rounded-full flex items-center justify-center flex-shrink-0 font-semibold text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"var(--chatbot-user-msg-bg)",color:"var(--chatbot-user-msg-text-color)","--tw-ring-color":"var(--chatbot-user-msg-bg)"},children:C.jsx(Rh,{})})]})})]})]})]})};nt.ChatBot=Oh,Object.defineProperty(nt,Symbol.toStringTag,{value:"Module"})});
|